@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,270 @@
|
|
|
1
|
+
import{C as e,E as t,b as n,h as r,n as i,v as a,y as o}from"./runtime-DxAbpr3S.js";import{a as s,n as c,r as l,t as u}from"./crossword-manifest-2qlu7AYd.js";import{t as d}from"./live-jdiyYln2.js";import{t as f}from"./keys-DU-Qknmz.js";import{t as p}from"./roving-focus-BxGgi2DD.js";import{t as m}from"./block-styles-CKo9x7Vt.js";var h=`astl.crossword`,g=[{namespace:h,locale:`en`,messages:c},{namespace:h,locale:`pl`,messages:u}],_=/^\p{L}$/u,v=e=>e===`across`?`down`:`across`,y=e=>[e.textContent??``,...[...e.querySelectorAll(`img`)].map(e=>e.alt)].join(` `).replace(/\s+/g,` `).trim(),b=class extends i{static manifest=l;static messages=g;static shadowRootOptions={...o.shadowRootOptions,slotAssignment:`manual`};static properties={letters:{state:!0},direction:{state:!0}};static styles=[t`
|
|
2
|
+
.board {
|
|
3
|
+
--astl-cw-edge: calc(var(--astl-focus-width) + var(--astl-focus-offset) + var(--astl-outline-width));
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
align-items: flex-start;
|
|
7
|
+
gap: var(--astl-space-4);
|
|
8
|
+
}
|
|
9
|
+
.field {
|
|
10
|
+
flex: 0 1 calc(var(--astl-cw-columns) * 2.75rem + 2 * var(--astl-cw-edge));
|
|
11
|
+
min-inline-size: 0;
|
|
12
|
+
max-inline-size: 100%;
|
|
13
|
+
container-type: inline-size;
|
|
14
|
+
}
|
|
15
|
+
.grid {
|
|
16
|
+
--astl-cw-cell: clamp(2rem, (100cqi - 2 * var(--astl-cw-edge)) / var(--astl-cw-columns), 2.75rem);
|
|
17
|
+
display: grid;
|
|
18
|
+
grid-template-columns: repeat(var(--astl-cw-columns), var(--astl-cw-cell));
|
|
19
|
+
grid-auto-rows: var(--astl-cw-cell);
|
|
20
|
+
inline-size: max-content;
|
|
21
|
+
padding: var(--astl-cw-edge);
|
|
22
|
+
}
|
|
23
|
+
.cell {
|
|
24
|
+
position: relative;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
margin-block-end: calc(-1 * var(--astl-outline-width));
|
|
27
|
+
margin-inline-end: calc(-1 * var(--astl-outline-width));
|
|
28
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
29
|
+
background: var(--astl-surface);
|
|
30
|
+
}
|
|
31
|
+
.cell[data-word] {
|
|
32
|
+
background: var(--astl-selected-soft);
|
|
33
|
+
box-shadow: inset 0 0 0 calc(var(--astl-selected-bar) / 2) var(--astl-selected);
|
|
34
|
+
}
|
|
35
|
+
.cell[data-verdict] {
|
|
36
|
+
z-index: 1;
|
|
37
|
+
}
|
|
38
|
+
.cell:focus-within {
|
|
39
|
+
z-index: 2;
|
|
40
|
+
}
|
|
41
|
+
.cell > input {
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
inline-size: 100%;
|
|
44
|
+
block-size: 100%;
|
|
45
|
+
margin: 0;
|
|
46
|
+
padding: calc(var(--astl-size-small) + 1px) 0 0;
|
|
47
|
+
border: 0;
|
|
48
|
+
background: none;
|
|
49
|
+
color: var(--astl-ink);
|
|
50
|
+
font: inherit;
|
|
51
|
+
font-size: min(var(--astl-cw-cell) * 0.5, var(--astl-cw-cell) - var(--astl-size-small) - 4px);
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
line-height: 1;
|
|
54
|
+
text-align: center;
|
|
55
|
+
caret-color: transparent;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
scroll-margin: var(--astl-cw-edge);
|
|
58
|
+
}
|
|
59
|
+
.cell > input::selection {
|
|
60
|
+
background: none;
|
|
61
|
+
}
|
|
62
|
+
.number,
|
|
63
|
+
.cell > .astl-verdict {
|
|
64
|
+
position: absolute;
|
|
65
|
+
line-height: 1;
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
}
|
|
68
|
+
.number {
|
|
69
|
+
inset-block-start: 1px;
|
|
70
|
+
inset-inline-start: 2px;
|
|
71
|
+
color: var(--astl-ink-muted);
|
|
72
|
+
font-size: var(--astl-size-small);
|
|
73
|
+
}
|
|
74
|
+
.cell > .astl-verdict {
|
|
75
|
+
inset-block-start: 1px;
|
|
76
|
+
inset-inline-end: 1px;
|
|
77
|
+
font-size: min(0.875rem, var(--astl-cw-cell) * 0.4);
|
|
78
|
+
}
|
|
79
|
+
`,t`
|
|
80
|
+
.field {
|
|
81
|
+
overflow-x: auto;
|
|
82
|
+
background:
|
|
83
|
+
linear-gradient(to right, var(--astl-surface) 40%, transparent) left / 2rem 100% no-repeat local,
|
|
84
|
+
linear-gradient(to left, var(--astl-surface) 40%, transparent) right / 2rem 100% no-repeat local,
|
|
85
|
+
radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)
|
|
86
|
+
left / 0.75rem 100% no-repeat scroll,
|
|
87
|
+
radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)
|
|
88
|
+
right / 0.75rem 100% no-repeat scroll;
|
|
89
|
+
scrollbar-color: var(--astl-outline) transparent;
|
|
90
|
+
}
|
|
91
|
+
`,t`
|
|
92
|
+
.current {
|
|
93
|
+
margin-block: 0 var(--astl-space-3);
|
|
94
|
+
padding-block: var(--astl-space-2);
|
|
95
|
+
padding-inline: var(--astl-space-3);
|
|
96
|
+
border-inline-start: var(--astl-focus-width) solid var(--astl-selected);
|
|
97
|
+
border-radius: var(--astl-radius-m);
|
|
98
|
+
background: var(--astl-selected-soft);
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
}
|
|
101
|
+
.clues {
|
|
102
|
+
flex: 1 1 16rem;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
gap: var(--astl-space-2);
|
|
106
|
+
}
|
|
107
|
+
.title {
|
|
108
|
+
margin: 0;
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
}
|
|
111
|
+
ol {
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
gap: var(--astl-space-1);
|
|
115
|
+
margin: 0;
|
|
116
|
+
padding: 0;
|
|
117
|
+
list-style: none;
|
|
118
|
+
}
|
|
119
|
+
.entry {
|
|
120
|
+
position: relative;
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-wrap: wrap;
|
|
123
|
+
align-items: center;
|
|
124
|
+
border: var(--astl-outline-width) solid transparent;
|
|
125
|
+
border-radius: var(--astl-radius-m);
|
|
126
|
+
}
|
|
127
|
+
.entry[data-current] {
|
|
128
|
+
border-color: var(--astl-selected);
|
|
129
|
+
background: var(--astl-selected-soft);
|
|
130
|
+
font-weight: var(--astl-selected-weight);
|
|
131
|
+
}
|
|
132
|
+
.entry[data-current]::before {
|
|
133
|
+
content: '';
|
|
134
|
+
position: absolute;
|
|
135
|
+
inset-block: 0;
|
|
136
|
+
inset-inline-start: 0;
|
|
137
|
+
inline-size: var(--astl-selected-bar);
|
|
138
|
+
background: var(--astl-selected);
|
|
139
|
+
}
|
|
140
|
+
.entry[data-crossing] {
|
|
141
|
+
border-color: var(--astl-outline);
|
|
142
|
+
}
|
|
143
|
+
.entry > button {
|
|
144
|
+
flex: 1 1 12rem;
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: baseline;
|
|
147
|
+
gap: var(--astl-space-2);
|
|
148
|
+
min-block-size: var(--astl-target-min);
|
|
149
|
+
margin: 0;
|
|
150
|
+
padding-block: var(--astl-space-1);
|
|
151
|
+
padding-inline: var(--astl-space-3);
|
|
152
|
+
border: 0;
|
|
153
|
+
background: none;
|
|
154
|
+
color: inherit;
|
|
155
|
+
font: inherit;
|
|
156
|
+
text-align: start;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
}
|
|
159
|
+
.entry .num {
|
|
160
|
+
flex: none;
|
|
161
|
+
min-inline-size: 1.5em;
|
|
162
|
+
font-weight: 700;
|
|
163
|
+
}
|
|
164
|
+
.entry .text {
|
|
165
|
+
min-inline-size: 0;
|
|
166
|
+
overflow-wrap: anywhere;
|
|
167
|
+
hyphens: auto;
|
|
168
|
+
}
|
|
169
|
+
.entry .length {
|
|
170
|
+
color: var(--astl-ink-muted);
|
|
171
|
+
white-space: nowrap;
|
|
172
|
+
}
|
|
173
|
+
.entry > .astl-verdict {
|
|
174
|
+
padding-inline-end: var(--astl-space-3);
|
|
175
|
+
}
|
|
176
|
+
.entry > .astl-solution {
|
|
177
|
+
flex-basis: 100%;
|
|
178
|
+
padding-inline: var(--astl-space-3);
|
|
179
|
+
padding-block-end: var(--astl-space-2);
|
|
180
|
+
}
|
|
181
|
+
.group-verdict {
|
|
182
|
+
margin-block: var(--astl-space-3) 0;
|
|
183
|
+
}
|
|
184
|
+
`,m];#e=null;#t=null;#n=!1;#r;#i;constructor(){super(),this.letters=new Map,this.direction=`across`;let e=this;this.#r=new p(this,{count:()=>this.#s*this.#c,item:e=>this.renderRoot.querySelector(`input[data-cell="${e}"]`),axis:`grid`,get columns(){return e.#c}}),this.#i=new p(this,{count:()=>this.#l.length,item:e=>this.renderRoot.querySelector(`button[data-index="${e}"]`),axis:`block`})}get slotIds(){return[...this.#u.slots.values()]}get groupIds(){return this.#l.map(e=>e.id)}getAnswers(){return Object.fromEntries(this.letters)}setAnswers(e){let t=new Map(this.letters);for(let n of this.slotIds){let r=e[n];if(r===void 0)continue;t.delete(n);let i=this.#g(r.trim().normalize(`NFC`));_.test(i)&&t.set(n,i)}this.letters=t}units(){let e=this.#l;return{answered:e.filter(e=>e.squares.every(e=>this.letters.has(this.#d(e)))).length,total:e.length}}willUpdate(){this.#e=null;let e=this.#l[0];e!==void 0&&!this.#u.slots.has(this.#r.active)&&(this.#r.focus(e.squares[0]??0),this.direction=e.direction)}updated(){this.renderRoot.querySelector(`.board`)?.style.setProperty(`--astl-cw-columns`,`${this.#c}`)}render(){let t=this.uiLanguage,{rows:r,columns:i,words:a}=this.#u,o=this.#f,s=this.#p;return e`<fieldset part="crossword">
|
|
185
|
+
<legend part="prompt">
|
|
186
|
+
<slot data-tag="astl-prompt"></slot>
|
|
187
|
+
<span class="hint" lang=${t.lang} dir=${t.dir}>${this.t(`ui.hint`)}</span>
|
|
188
|
+
</legend>
|
|
189
|
+
<p class="current" part="current" lang=${t.lang} dir=${t.dir}>${o===null?n:this.#m(o)}</p>
|
|
190
|
+
<div class="board">
|
|
191
|
+
<div class="field">
|
|
192
|
+
<div
|
|
193
|
+
class="grid"
|
|
194
|
+
part="grid"
|
|
195
|
+
role="group"
|
|
196
|
+
aria-label=${this.t(`ui.grid`,{rows:r,columns:i})}
|
|
197
|
+
aria-describedby="instructions"
|
|
198
|
+
@keydown=${this.#k}
|
|
199
|
+
@input=${this.#O}
|
|
200
|
+
@focusin=${this.#T}
|
|
201
|
+
@pointerdown=${this.#E}
|
|
202
|
+
@click=${this.#D}
|
|
203
|
+
>
|
|
204
|
+
${Array.from({length:r*i},(e,t)=>this.#a(t,o))}
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
<div class="clues" part="clues" role="group" aria-label=${this.t(`ui.clues`)} lang=${t.lang} dir=${t.dir}>
|
|
208
|
+
${[`across`,`down`].map(t=>{let r=a.filter(e=>e.direction===t);return r.length===0?n:e`<p class="title" id="title-${t}">${this.t(`ui.${t}`)}</p>
|
|
209
|
+
<ol role="list" aria-labelledby="title-${t}">
|
|
210
|
+
${r.map(e=>this.#o(e,e===o,e===s))}
|
|
211
|
+
</ol>`})}
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
<span class="astl-vh" id="instructions" lang=${t.lang} dir=${t.dir}>${this.t(`ui.instructions`)}</span>
|
|
215
|
+
${this.renderGroupVerdict()}
|
|
216
|
+
</fieldset>`}#a(t,r){let i=this.#u.slots.get(t);if(i===void 0)return e`<span aria-hidden="true"></span>`;let o=this.#u.through.get(t)??{},s=o[this.direction]??o[v(this.direction)],c=[o.across,o.down].find(e=>e?.squares[0]===t),l=this.#v(t),u=s===void 0?``:this.#h(s,t);return e`<span
|
|
217
|
+
class="cell astl-box astl-ring"
|
|
218
|
+
part="cell"
|
|
219
|
+
data-verdict=${a(l??void 0)}
|
|
220
|
+
?data-word=${r?.squares.includes(t)??!1}
|
|
221
|
+
>
|
|
222
|
+
${c===void 0?n:e`<span class="number" part="number" aria-hidden="true">${c.number}</span>`}
|
|
223
|
+
<input
|
|
224
|
+
type="text"
|
|
225
|
+
data-cell=${t}
|
|
226
|
+
tabindex=${this.#r.tabIndex(t)}
|
|
227
|
+
lang=${a(this.contentLang||void 0)}
|
|
228
|
+
autocomplete="off"
|
|
229
|
+
autocapitalize="characters"
|
|
230
|
+
autocorrect="off"
|
|
231
|
+
spellcheck="false"
|
|
232
|
+
enterkeyhint="next"
|
|
233
|
+
aria-label=${u}
|
|
234
|
+
aria-invalid=${l===`incorrect`?`true`:n}
|
|
235
|
+
aria-describedby=${a(l===null?void 0:`verdict-${t}`)}
|
|
236
|
+
?readonly=${this.disabled}
|
|
237
|
+
.value=${d(this.letters.get(i)??``)}
|
|
238
|
+
/>
|
|
239
|
+
${l===null?n:this.renderVerdict(l,{hiddenWord:!0,id:`verdict-${t}`})}
|
|
240
|
+
</span>`}#o(t,i,o){let s=this.uiLanguage,c=this.#l.indexOf(t),l=this.#_(t),u=this.#y(t),d=[l===null?``:`clue-verdict-${c}`,u===null?``:`solution-${c}`];return e`<li
|
|
241
|
+
class="entry astl-box astl-ring"
|
|
242
|
+
part="clue"
|
|
243
|
+
id=${t.id}
|
|
244
|
+
data-verdict=${a(l??void 0)}
|
|
245
|
+
?data-current=${i}
|
|
246
|
+
?data-crossing=${o}
|
|
247
|
+
>
|
|
248
|
+
<button
|
|
249
|
+
type="button"
|
|
250
|
+
data-index=${c}
|
|
251
|
+
tabindex=${this.#i.tabIndex(c)}
|
|
252
|
+
aria-current=${i?`true`:n}
|
|
253
|
+
aria-describedby=${d.filter(Boolean).join(` `)||n}
|
|
254
|
+
@click=${()=>this.#x(t)}
|
|
255
|
+
@keydown=${e=>this.#i.keydown(e)}
|
|
256
|
+
>
|
|
257
|
+
<span class="num">${t.number}</span>
|
|
258
|
+
<span class="text"
|
|
259
|
+
><span lang=${a(this.contentLang||void 0)}><slot data-word=${t.id}></slot></span>
|
|
260
|
+
<span class="length">${this.t(`ui.length`,{length:t.squares.length})}</span></span
|
|
261
|
+
>
|
|
262
|
+
${o?e`<span class="astl-vh">, ${this.t(`ui.crossing`)}</span>`:n}
|
|
263
|
+
</button>
|
|
264
|
+
${l===null?n:this.renderVerdict(l,{hiddenWord:!0,id:`clue-verdict-${c}`})}
|
|
265
|
+
${u===null?n:e`<p class="astl-solution" part="solution" id="solution-${c}" lang=${s.lang} dir=${s.dir}>
|
|
266
|
+
${r(`correct`)}<span class="astl-solution-label">${this.t(`ui.solution`)}</span>
|
|
267
|
+
<bdi lang=${a(this.contentLang||void 0)}>${u}</bdi>
|
|
268
|
+
</p>`}
|
|
269
|
+
</li>`}get#s(){return this.numberAttribute(`rows`)??0}get#c(){return this.numberAttribute(`columns`)??0}get#l(){return this.#u.words}get#u(){if(this.#e!==null)return this.#e;let e=this.#s,t=this.#c,n=this.childElements(`astl-crossword-word`).map(n=>{let r={row:Number(n.getAttribute(`row`)),column:Number(n.getAttribute(`column`)),direction:n.getAttribute(`direction`)===`down`?`down`:`across`,length:Number(n.getAttribute(`length`))},i=s(r).filter(([n,r])=>n>=0&&n<e&&r>=0&&r<t).map(([e,n])=>e*t+n);return{id:n.id,el:n,number:Number(n.getAttribute(`number`)),direction:r.direction,squares:i}}),r=new Map;for(let e of n)for(let t of e.squares)r.set(t,{...r.get(t),[e.direction]:e});let i=(this.getAttribute(`cells`)??``).split(` `).filter(Boolean),a=[...r.keys()].sort((e,t)=>e-t),o=new Map(a.flatMap((e,t)=>i[t]===void 0?[]:[[e,i[t]]]));return this.#e={rows:e,columns:t,words:n,slots:o,through:r},this.#e}#d(e){return this.#u.slots.get(e)??``}get#f(){let e=this.#u.through.get(this.#r.active)??{};return e[this.direction]??e[v(this.direction)]??null}get#p(){let e=this.#u.through.get(this.#r.active)??{},t=this.#f;return t===null?null:e[v(t.direction)]??null}#m(e){let{number:t,direction:n}=e;return this.t(`ui.current`,{number:t,direction:n,length:e.squares.length,clue:y(e.el)})}#h(e,t){let{number:n,direction:r,squares:i}=e;return this.t(`ui.cell`,{number:n,direction:r,position:i.indexOf(t)+1,length:i.length})}#g(e){try{return e.toLocaleUpperCase(this.contentLang||void 0)}catch{return e.toUpperCase()}}#_(e){let t=this.feedback;if(t===null)return null;let n=t.groups?.[e.id];return n===void 0?t.group===null?null:e.squares.every(e=>!this.letters.has(this.#d(e)))?`empty`:Object.keys(t.slots).length===0?null:e.squares.every(e=>t.slots[this.#d(e)]===`correct`)?`correct`:`incorrect`:n}#v(e){let t=this.#d(e);return this.letters.has(t)?this.slotVerdict(t):null}#y(e){let t=this.solution;if(t===null)return null;let n=e.squares.map(e=>t[this.#d(e)]??``);return n.every((t,n)=>t===this.letters.get(this.#d(e.squares[n]??-1)))?null:n.join(``)}#b(e,t=this.direction){let n=this.#u.through.get(e)??{};this.direction=n[t]===void 0?v(t):t,this.#r.focus(e);let r=this.#f;r!==null&&r.id!==this.#t&&(this.#t=r.id,this.announce(this.#m(r)))}#x(e){let t=e.squares.find(e=>!this.letters.has(this.#d(e)));this.#b(t??e.squares[0]??0,e.direction)}#S(e){let t=this.#f?.squares??[];return t[t.indexOf(this.#r.active)+e]??null}#C(e,t){let n=this.#d(e);if((this.letters.get(n)??``)===t)return;let r=new Map(this.letters);t===``?r.delete(n):r.set(n,t),this.letters=r,this.emitChange({[n]:t})}#w(e){let t=e.target.dataset.cell;return t===void 0?null:Number(t)}#T(e){let t=this.#w(e);t!==null&&(e.target.select(),(t!==this.#r.active||this.#f?.id!==this.#t)&&this.#b(t))}#E(e){let t=this.#w(e);this.#n=t===this.#r.active&&this.shadowRoot?.activeElement===e.target}#D(e){let t=this.#w(e);t!==null&&this.#n&&(this.#n=!1,this.#b(t,v(this.direction)))}#O(e){let t=this.#w(e);if(t===null||this.disabled)return;let n=e.target;if(e.inputType.startsWith(`delete`)){this.#C(t,``);return}let r=[...(e.data??n.value).normalize(`NFC`)].reverse().find(e=>_.test(e));r!==void 0&&this.#C(t,this.#g(r)),n.value=this.letters.get(this.#d(t))??``;let i=r===void 0?null:this.#S(1);i!==null&&this.#b(i,this.#f?.direction)}#k(e){let t=this.#w(e);if(t===null||e.altKey||e.ctrlKey||e.metaKey)return;let n=e.key;if(n===`Tab`||n===`Enter`){let t=this.#f,r=this.#l[(t===null?-1:this.#l.indexOf(t))+(e.shiftKey?-1:1)];if(r===void 0&&n===`Tab`)return;e.preventDefault(),r!==void 0&&this.#x(r)}else if(n===` `)e.preventDefault(),this.#b(t,v(this.direction));else if(n===`Backspace`){if(e.preventDefault(),this.disabled)return;let n=this.#S(-1);this.letters.has(this.#d(t))||n===null?this.#C(t,``):(this.#C(n,``),this.#b(n,this.#f?.direction))}else this.#A(e,t)}#A(e,t){let n=f(e,`inline`,this),r=f(e,`block`,this);if(n===0&&r===0)return;e.preventDefault();let i=n===0?`down`:`across`,a=this.#u.through.get(t)??{};if(i!==this.direction&&a[i]!==void 0){this.#b(t,i);return}let{rows:o,columns:s,slots:c}=this.#u,[l,u]=[Math.floor(t/s),t%s];for(;;){if(l+=r,u+=n,l<0||l>=o||u<0||u>=s)return;if(c.has(l*s+u))break}this.#b(l*s+u,i)}},x={manifest:l,element:b,messages:g};export{x as crosswordElement};
|
|
270
|
+
//# sourceMappingURL=crossword-Cb-a3Tjj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crossword-Cb-a3Tjj.js","names":["en","pl","LitElement","nothing","ifDefined","live","b","i$1","A","verdictIcon","AstlElement","o","i","squaresOf","en_default","crosswordManifest","pl_default","l","arrowDelta","RovingFocus","blockStyles","namespace","crosswordUiMessages","LETTER","other","d","said","el","img","CrosswordElement","element","#grid","#rows","#columns","#list","#words","#layoutNow","w","next","id","value","answers","letter","#upper","words","#slot","sq","#layout","first","ui","word","#activeWord","crossing","#crossing","#clueText","#keydown","#input","#focusin","#pointerdown","#click","rows","columns","#renderSquare","list","#renderClue","slot","ways","start","verdict","#squareVerdict","name","#squareName","active","index","#wordVerdict","solution","#wordSolution","refs","current","#goTo","event","placed","squares","r","c","through","ids","open","a","slots","k","square","feedback","own","letters","direction","#said","empty","#activate","steps","cell","#squareOf","#again","input","#set","typed","ch","#along","key","back","#arrow","across","down","way","crosswordElement"],"sources":["../../../../components/src/crossword/ui-messages.ts","../../../../components/src/crossword/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.crossword';\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 `crosswordMessages` would put the authoring strings into the element's chunk.\n */\nexport const crosswordUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type {\n Answers,\n ComponentManifest,\n GroupVerdict,\n MessageCatalog,\n SlotVerdict,\n Units,\n} from '@astl/core';\nimport { AstlElement, type ElementRegistration, verdictIcon } from '@astl/player';\nimport { arrowDelta, RovingFocus } 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 { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { blockStyles } from '../block-styles.js';\nimport { type Direction, squaresOf } from './grid.js';\nimport { crosswordManifest } from './manifest.js';\nimport { crosswordUiMessages } from './ui-messages.js';\n\n/** A word of the view: its clue (the light-DOM child) and its squares, by index (row x columns + column). */\ninterface Word {\n readonly id: string;\n readonly el: HTMLElement;\n readonly number: number;\n readonly direction: Direction;\n readonly squares: readonly number[];\n}\n\ninterface Layout {\n readonly rows: number;\n readonly columns: number;\n /** In clue order: across, then down, by number. */\n readonly words: readonly Word[];\n /** The slot id of each open square. */\n readonly slots: ReadonlyMap<number, string>;\n readonly through: ReadonlyMap<number, Partial<Record<Direction, Word>>>;\n}\n\nconst LETTER = /^\\p{L}$/u;\nconst other = (d: Direction): Direction => (d === 'across' ? 'down' : 'across');\n/** What a clue says: its text, with the alt text of its pictures. */\nconst said = (el: Element): string =>\n [el.textContent ?? '', ...[...el.querySelectorAll('img')].map((img) => img.alt)]\n .join(' ')\n .replace(/\\s+/g, ' ')\n .trim();\n\n/**\n * `<astl-crossword>`: a grid of squares, every open one an `<input>` (one `letter` slot, the view's `cells` in reading\n * order), and the clues, the light-DOM `<astl-crossword-word>` children (slotted manually, never moved).\n * - One tab stop in the grid (`RovingFocus`): a letter moves along the active word, the arrows to the nearest open\n * square (first turning where two words cross), Space turns, Tab and Enter go to the next clue (Shift back) and Tab\n * leaves at the ends. The clue list is one more tab stop; pressing a clue goes to its first empty square.\n * - The current clue shows above the grid and goes to the player's live region when it changes.\n * - Verdicts: per word (`feedback.groups`, scoring `word`), per square (`letter`), or for the grid (`whole`).\n */\nexport class CrosswordElement extends AstlElement {\n static override manifest: ComponentManifest = crosswordManifest;\n static override messages: readonly MessageCatalog[] = crosswordUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n letters: { state: true },\n direction: { state: true },\n };\n\n static override styles: CSSResultGroup = [\n // Squares of 32 to 44 px share the room of the field (a container); a grid wider than that scrolls in it, with a\n // cue (below). The floor is not the WCAG 2.5.8 minimum (24 px: squares touch, so its spacing exception cannot apply\n // and each square must reach it itself) but what a square must hold: its number at the smallest text size (14 px,\n // as all text young students read) above its letter, at least 14 px too, in a text entry at least 24 px tall. At\n // 32 px both fit, the letter on its own line under the number's, so they never meet; the letter grows with the\n // square and keeps that line. A 20-column grid now fits a 760 px player; a 30-column one scrolls there. The field\n // clips, so the grid's padding (the edge) is as wide as a focus ring reaches past a square, plus a border: squares\n // share borders, so the last column and row hang a border past their tracks. A square scrolled into view keeps\n // the same room by its input's scroll margin (the input sits a border inside its square, which draws the ring).\n css`\n .board {\n --astl-cw-edge: calc(var(--astl-focus-width) + var(--astl-focus-offset) + var(--astl-outline-width));\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: var(--astl-space-4);\n }\n .field {\n flex: 0 1 calc(var(--astl-cw-columns) * 2.75rem + 2 * var(--astl-cw-edge));\n min-inline-size: 0;\n max-inline-size: 100%;\n container-type: inline-size;\n }\n .grid {\n --astl-cw-cell: clamp(2rem, (100cqi - 2 * var(--astl-cw-edge)) / var(--astl-cw-columns), 2.75rem);\n display: grid;\n grid-template-columns: repeat(var(--astl-cw-columns), var(--astl-cw-cell));\n grid-auto-rows: var(--astl-cw-cell);\n inline-size: max-content;\n padding: var(--astl-cw-edge);\n }\n .cell {\n position: relative;\n box-sizing: border-box;\n margin-block-end: calc(-1 * var(--astl-outline-width));\n margin-inline-end: calc(-1 * var(--astl-outline-width));\n border: var(--astl-outline-width) solid var(--astl-outline);\n background: var(--astl-surface);\n }\n .cell[data-word] {\n background: var(--astl-selected-soft);\n box-shadow: inset 0 0 0 calc(var(--astl-selected-bar) / 2) var(--astl-selected);\n }\n .cell[data-verdict] {\n z-index: 1;\n }\n .cell:focus-within {\n z-index: 2;\n }\n .cell > input {\n box-sizing: border-box;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n padding: calc(var(--astl-size-small) + 1px) 0 0;\n border: 0;\n background: none;\n color: var(--astl-ink);\n font: inherit;\n font-size: min(var(--astl-cw-cell) * 0.5, var(--astl-cw-cell) - var(--astl-size-small) - 4px);\n font-weight: 600;\n line-height: 1;\n text-align: center;\n caret-color: transparent;\n cursor: pointer;\n scroll-margin: var(--astl-cw-edge);\n }\n .cell > input::selection {\n background: none;\n }\n .number,\n .cell > .astl-verdict {\n position: absolute;\n line-height: 1;\n pointer-events: none;\n }\n .number {\n inset-block-start: 1px;\n inset-inline-start: 2px;\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-small);\n }\n .cell > .astl-verdict {\n inset-block-start: 1px;\n inset-inline-end: 1px;\n font-size: min(0.875rem, var(--astl-cw-cell) * 0.4);\n }\n `,\n // A grid wider than its field scrolls sideways, and shows it: a shadow at each edge that has more to scroll to\n // (scroll shadows: covers that move with the content over shadows that stay with the field).\n css`\n .field {\n overflow-x: auto;\n background:\n linear-gradient(to right, var(--astl-surface) 40%, transparent) left / 2rem 100% no-repeat local,\n linear-gradient(to left, var(--astl-surface) 40%, transparent) right / 2rem 100% no-repeat local,\n radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)\n left / 0.75rem 100% no-repeat scroll,\n radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)\n right / 0.75rem 100% no-repeat scroll;\n scrollbar-color: var(--astl-outline) transparent;\n }\n `,\n // The current clue sits above the grid; in the list the current clue is marked like a picked item (a bar and a\n // weight where the theme has them, never colour alone), the crossing one with a quiet border.\n css`\n .current {\n margin-block: 0 var(--astl-space-3);\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n border-inline-start: var(--astl-focus-width) solid var(--astl-selected);\n border-radius: var(--astl-radius-m);\n background: var(--astl-selected-soft);\n font-weight: 600;\n }\n .clues {\n flex: 1 1 16rem;\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n }\n .title {\n margin: 0;\n font-weight: 600;\n }\n ol {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-1);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n .entry {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n border: var(--astl-outline-width) solid transparent;\n border-radius: var(--astl-radius-m);\n }\n .entry[data-current] {\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n font-weight: var(--astl-selected-weight);\n }\n .entry[data-current]::before {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline-start: 0;\n inline-size: var(--astl-selected-bar);\n background: var(--astl-selected);\n }\n .entry[data-crossing] {\n border-color: var(--astl-outline);\n }\n .entry > button {\n flex: 1 1 12rem;\n display: flex;\n align-items: baseline;\n gap: var(--astl-space-2);\n min-block-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-1);\n padding-inline: var(--astl-space-3);\n border: 0;\n background: none;\n color: inherit;\n font: inherit;\n text-align: start;\n cursor: pointer;\n }\n .entry .num {\n flex: none;\n min-inline-size: 1.5em;\n font-weight: 700;\n }\n .entry .text {\n min-inline-size: 0;\n overflow-wrap: anywhere;\n hyphens: auto;\n }\n .entry .length {\n color: var(--astl-ink-muted);\n white-space: nowrap;\n }\n .entry > .astl-verdict {\n padding-inline-end: var(--astl-space-3);\n }\n .entry > .astl-solution {\n flex-basis: 100%;\n padding-inline: var(--astl-space-3);\n padding-block-end: var(--astl-space-2);\n }\n .group-verdict {\n margin-block: var(--astl-space-3) 0;\n }\n `,\n blockStyles,\n ];\n\n /** Slot id to its letter. */\n declare protected letters: ReadonlyMap<string, string>;\n /** The direction of the active word where two words cross. */\n declare protected direction: Direction;\n #layout: Layout | null = null;\n /** The active word announced last, so moving inside it says nothing. */\n #said: string | null = null;\n /** A press on the square that already had the focus turns the direction. */\n #again = false;\n readonly #grid: RovingFocus;\n readonly #list: RovingFocus;\n\n constructor() {\n super();\n this.letters = new Map();\n this.direction = 'across';\n const element = this;\n this.#grid = new RovingFocus(this, {\n count: () => this.#rows * this.#columns,\n item: (i) => this.renderRoot.querySelector<HTMLElement>(`input[data-cell=\"${i}\"]`),\n axis: 'grid',\n get columns() {\n return element.#columns;\n },\n });\n this.#list = new RovingFocus(this, {\n count: () => this.#words.length,\n item: (i) => this.renderRoot.querySelector<HTMLElement>(`button[data-index=\"${i}\"]`),\n axis: 'block',\n });\n }\n\n get slotIds(): readonly string[] {\n return [...this.#layoutNow.slots.values()];\n }\n\n get groupIds(): readonly string[] {\n return this.#words.map((w) => w.id);\n }\n\n getAnswers(): Answers {\n return Object.fromEntries(this.letters);\n }\n\n /** One letter per slot, in capitals; anything else is not shown, so the slot stays empty. */\n setAnswers(answers: Answers): void {\n const next = new Map(this.letters);\n for (const id of this.slotIds) {\n const value = answers[id];\n if (value === undefined) continue;\n next.delete(id);\n const letter = this.#upper(value.trim().normalize('NFC'));\n if (LETTER.test(letter)) next.set(id, letter);\n }\n this.letters = next;\n }\n\n /** One unit per word, answered when every square of it holds a letter. */\n units(): Units {\n const words = this.#words;\n const full = words.filter((w) => w.squares.every((sq) => this.letters.has(this.#slot(sq))));\n return { answered: full.length, total: words.length };\n }\n\n protected override willUpdate(): void {\n // The view is read again once per render (a view is immutable, so this is cheap insurance, not a cache miss).\n this.#layout = null;\n // The tab stop starts on the first square of the first clue.\n const first = this.#words[0];\n if (first !== undefined && !this.#layoutNow.slots.has(this.#grid.active)) {\n this.#grid.focus(first.squares[0] ?? 0);\n this.direction = first.direction;\n }\n }\n\n protected override updated(): void {\n // Through the CSSOM, which a strict Content Security Policy allows (an inline style attribute it blocks).\n this.renderRoot\n .querySelector<HTMLElement>('.board')\n ?.style.setProperty('--astl-cw-columns', `${this.#columns}`);\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const { rows, columns, words } = this.#layoutNow;\n const word = this.#activeWord;\n const crossing = this.#crossing;\n return html`<fieldset part=\"crossword\">\n <legend part=\"prompt\">\n <slot data-tag=\"astl-prompt\"></slot>\n <span class=\"hint\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.hint')}</span>\n </legend>\n <p class=\"current\" part=\"current\" lang=${ui.lang} dir=${ui.dir}>${word === null ? nothing : this.#clueText(word)}</p>\n <div class=\"board\">\n <div class=\"field\">\n <div\n class=\"grid\"\n part=\"grid\"\n role=\"group\"\n aria-label=${this.t('ui.grid', { rows, columns })}\n aria-describedby=\"instructions\"\n @keydown=${this.#keydown}\n @input=${this.#input}\n @focusin=${this.#focusin}\n @pointerdown=${this.#pointerdown}\n @click=${this.#click}\n >\n ${Array.from({ length: rows * columns }, (_, i) => this.#renderSquare(i, word))}\n </div>\n </div>\n <div class=\"clues\" part=\"clues\" role=\"group\" aria-label=${this.t('ui.clues')} lang=${ui.lang} dir=${ui.dir}>\n ${(['across', 'down'] as const).map((d) => {\n const list = words.filter((w) => w.direction === d);\n return list.length === 0\n ? nothing\n : html`<p class=\"title\" id=\"title-${d}\">${this.t(`ui.${d}`)}</p>\n <ol role=\"list\" aria-labelledby=\"title-${d}\">\n ${list.map((w) => this.#renderClue(w, w === word, w === crossing))}\n </ol>`;\n })}\n </div>\n </div>\n <span class=\"astl-vh\" id=\"instructions\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.instructions')}</span>\n ${this.renderGroupVerdict()}\n </fieldset>`;\n }\n\n #renderSquare(i: number, active: Word | null): TemplateResult {\n const slot = this.#layoutNow.slots.get(i);\n if (slot === undefined) return html`<span aria-hidden=\"true\"></span>`;\n const ways = this.#layoutNow.through.get(i) ?? {};\n const word = ways[this.direction] ?? ways[other(this.direction)];\n const start = [ways.across, ways.down].find((w) => w?.squares[0] === i);\n const verdict = this.#squareVerdict(i);\n const name = word === undefined ? '' : this.#squareName(word, i);\n return html`<span\n class=\"cell astl-box astl-ring\"\n part=\"cell\"\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-word=${active?.squares.includes(i) ?? false}\n >\n ${start === undefined ? nothing : html`<span class=\"number\" part=\"number\" aria-hidden=\"true\">${start.number}</span>`}\n <input\n type=\"text\"\n data-cell=${i}\n tabindex=${this.#grid.tabIndex(i)}\n lang=${ifDefined(this.contentLang || undefined)}\n autocomplete=\"off\"\n autocapitalize=\"characters\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n enterkeyhint=\"next\"\n aria-label=${name}\n aria-invalid=${verdict === 'incorrect' ? 'true' : nothing}\n aria-describedby=${ifDefined(verdict === null ? undefined : `verdict-${i}`)}\n ?readonly=${this.disabled}\n .value=${live(this.letters.get(slot) ?? '')}\n />\n ${verdict === null ? nothing : this.renderVerdict(verdict, { hiddenWord: true, id: `verdict-${i}` })}\n </span>`;\n }\n\n #renderClue(word: Word, current: boolean, crossing: boolean): TemplateResult {\n const ui = this.uiLanguage;\n const index = this.#words.indexOf(word);\n const verdict = this.#wordVerdict(word);\n const solution = this.#wordSolution(word);\n const refs = [\n verdict === null ? '' : `clue-verdict-${index}`,\n solution === null ? '' : `solution-${index}`,\n ];\n return html`<li\n class=\"entry astl-box astl-ring\"\n part=\"clue\"\n id=${word.id}\n data-verdict=${ifDefined(verdict ?? undefined)}\n ?data-current=${current}\n ?data-crossing=${crossing}\n >\n <button\n type=\"button\"\n data-index=${index}\n tabindex=${this.#list.tabIndex(index)}\n aria-current=${current ? 'true' : nothing}\n aria-describedby=${refs.filter(Boolean).join(' ') || nothing}\n @click=${() => this.#goTo(word)}\n @keydown=${(event: KeyboardEvent) => this.#list.keydown(event)}\n >\n <span class=\"num\">${word.number}</span>\n <span class=\"text\"\n ><span lang=${ifDefined(this.contentLang || undefined)}><slot data-word=${word.id}></slot></span>\n <span class=\"length\">${this.t('ui.length', { length: word.squares.length })}</span></span\n >\n ${crossing ? html`<span class=\"astl-vh\">, ${this.t('ui.crossing')}</span>` : nothing}\n </button>\n ${verdict === null ? nothing : this.renderVerdict(verdict, { hiddenWord: true, id: `clue-verdict-${index}` })}\n ${\n solution === null\n ? nothing\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(this.contentLang || undefined)}>${solution}</bdi>\n </p>`\n }\n </li>`;\n }\n\n // The layout\n\n get #rows(): number {\n return this.numberAttribute('rows') ?? 0;\n }\n\n get #columns(): number {\n return this.numberAttribute('columns') ?? 0;\n }\n\n get #words(): readonly Word[] {\n return this.#layoutNow.words;\n }\n\n /** Read from the view, once between two renders: the words and where they lie, the slot of each open square. */\n get #layoutNow(): Layout {\n if (this.#layout !== null) return this.#layout;\n const rows = this.#rows;\n const columns = this.#columns;\n const words = this.childElements('astl-crossword-word').map((el): Word => {\n const placed = {\n row: Number(el.getAttribute('row')),\n column: Number(el.getAttribute('column')),\n direction: el.getAttribute('direction') === 'down' ? ('down' as const) : ('across' as const),\n length: Number(el.getAttribute('length')),\n };\n const squares = squaresOf(placed)\n .filter(([r, c]) => r >= 0 && r < rows && c >= 0 && c < columns)\n .map(([r, c]) => r * columns + c);\n return {\n id: el.id,\n el,\n number: Number(el.getAttribute('number')),\n direction: placed.direction,\n squares,\n };\n });\n const through = new Map<number, Partial<Record<Direction, Word>>>();\n for (const w of words)\n for (const sq of w.squares) through.set(sq, { ...through.get(sq), [w.direction]: w });\n const ids = (this.getAttribute('cells') ?? '').split(' ').filter(Boolean);\n const open = [...through.keys()].sort((a, b) => a - b);\n const slots = new Map(open.flatMap((sq, k) => (ids[k] === undefined ? [] : [[sq, ids[k]] as const])));\n this.#layout = { rows, columns, words, slots, through };\n return this.#layout;\n }\n\n #slot(square: number): string {\n return this.#layoutNow.slots.get(square) ?? '';\n }\n\n /** The word the active square belongs to in the active direction, else its other one. */\n get #activeWord(): Word | null {\n const ways = this.#layoutNow.through.get(this.#grid.active) ?? {};\n return ways[this.direction] ?? ways[other(this.direction)] ?? null;\n }\n\n /** The other word through the active square, if two cross there. */\n get #crossing(): Word | null {\n const ways = this.#layoutNow.through.get(this.#grid.active) ?? {};\n const word = this.#activeWord;\n return word === null ? null : (ways[other(word.direction)] ?? null);\n }\n\n #clueText(word: Word): string {\n const { number, direction } = word;\n return this.t('ui.current', { number, direction, length: word.squares.length, clue: said(word.el) });\n }\n\n #squareName(word: Word, square: number): string {\n const { number, direction, squares } = word;\n return this.t('ui.cell', {\n number,\n direction,\n position: squares.indexOf(square) + 1,\n length: squares.length,\n });\n }\n\n #upper(value: string): string {\n try {\n return value.toLocaleUpperCase(this.contentLang || undefined);\n } catch {\n return value.toUpperCase();\n }\n }\n\n // Verdicts and solutions\n\n /**\n * A word's verdict after a check, until the next edit: its group's (scoring `word`); else, under the element's\n * verdict, \"no answer\" for a word without a letter and, with square verdicts (`letter`), right when every square is.\n */\n #wordVerdict(word: Word): GroupVerdict | null {\n const feedback = this.feedback;\n if (feedback === null) return null;\n const own = feedback.groups?.[word.id];\n if (own !== undefined) return own;\n if (feedback.group === null) return null;\n if (word.squares.every((sq) => !this.letters.has(this.#slot(sq)))) return 'empty';\n if (Object.keys(feedback.slots).length === 0) return null;\n return word.squares.every((sq) => feedback.slots[this.#slot(sq)] === 'correct') ? 'correct' : 'incorrect';\n }\n\n /**\n * A filled square's own verdict (`letter`); a word's verdict (`word`) shows at its clue only, so a wrong word never\n * marks its right letters, nor a crossing square, wrong.\n */\n #squareVerdict(square: number): SlotVerdict | null {\n const slot = this.#slot(square);\n if (!this.letters.has(slot)) return null;\n return this.slotVerdict(slot);\n }\n\n /** The correct word when the student's letters differ from it. */\n #wordSolution(word: Word): string | null {\n const solution = this.solution;\n if (solution === null) return null;\n const letters = word.squares.map((sq) => solution[this.#slot(sq)] ?? '');\n if (letters.every((l, k) => l === this.letters.get(this.#slot(word.squares[k] ?? -1)))) return null;\n return letters.join('');\n }\n\n // Moving and typing\n\n /** Makes `square` active, in `direction` when a word runs that way there, and says the clue when it changes. */\n #activate(square: number, direction: Direction = this.direction): void {\n const ways = this.#layoutNow.through.get(square) ?? {};\n this.direction = ways[direction] === undefined ? other(direction) : direction;\n this.#grid.focus(square);\n const word = this.#activeWord;\n if (word !== null && word.id !== this.#said) {\n this.#said = word.id;\n this.announce(this.#clueText(word));\n }\n }\n\n /** A word's first empty square, else its first (the focus follows when it is in the element). */\n #goTo(word: Word): void {\n const empty = word.squares.find((sq) => !this.letters.has(this.#slot(sq)));\n this.#activate(empty ?? word.squares[0] ?? 0, word.direction);\n }\n\n /** The square `steps` along the active word from the active one, or null past its ends. */\n #along(steps: number): number | null {\n const squares = this.#activeWord?.squares ?? [];\n return squares[squares.indexOf(this.#grid.active) + steps] ?? null;\n }\n\n #set(square: number, letter: string): void {\n const slot = this.#slot(square);\n if ((this.letters.get(slot) ?? '') === letter) return;\n const next = new Map(this.letters);\n if (letter === '') next.delete(slot);\n else next.set(slot, letter);\n this.letters = next;\n this.emitChange({ [slot]: letter });\n }\n\n #squareOf(event: Event): number | null {\n const cell = (event.target as HTMLElement).dataset.cell;\n return cell === undefined ? null : Number(cell);\n }\n\n #focusin(event: FocusEvent): void {\n const square = this.#squareOf(event);\n if (square === null) return;\n (event.target as HTMLInputElement).select();\n if (square !== this.#grid.active || this.#activeWord?.id !== this.#said) this.#activate(square);\n }\n\n #pointerdown(event: PointerEvent): void {\n const square = this.#squareOf(event);\n this.#again = square === this.#grid.active && this.shadowRoot?.activeElement === event.target;\n }\n\n /** Pressing the active square again turns to the other word there. */\n #click(event: MouseEvent): void {\n const square = this.#squareOf(event);\n if (square === null || !this.#again) return;\n this.#again = false;\n this.#activate(square, other(this.direction));\n }\n\n /** A letter fills the square and moves on along the word; other characters are ignored; deleting clears it. */\n #input(event: InputEvent): void {\n const square = this.#squareOf(event);\n if (square === null || this.disabled) return;\n const input = event.target as HTMLInputElement;\n if (event.inputType.startsWith('delete')) {\n this.#set(square, '');\n return;\n }\n const typed = [...(event.data ?? input.value).normalize('NFC')].reverse().find((ch) => LETTER.test(ch));\n if (typed !== undefined) this.#set(square, this.#upper(typed));\n input.value = this.letters.get(this.#slot(square)) ?? '';\n const next = typed === undefined ? null : this.#along(1);\n if (next !== null) this.#activate(next, this.#activeWord?.direction);\n }\n\n #keydown(event: KeyboardEvent): void {\n const square = this.#squareOf(event);\n if (square === null || event.altKey || event.ctrlKey || event.metaKey) return;\n const key = event.key;\n if (key === 'Tab' || key === 'Enter') {\n const word = this.#activeWord;\n const next = this.#words[(word === null ? -1 : this.#words.indexOf(word)) + (event.shiftKey ? -1 : 1)];\n // Tab past the first or the last clue leaves the grid.\n if (next === undefined && key === 'Tab') return;\n event.preventDefault();\n if (next !== undefined) this.#goTo(next);\n } else if (key === ' ') {\n event.preventDefault();\n this.#activate(square, other(this.direction));\n } else if (key === 'Backspace') {\n event.preventDefault();\n if (this.disabled) return;\n const back = this.#along(-1);\n if (this.letters.has(this.#slot(square)) || back === null) this.#set(square, '');\n else {\n this.#set(back, '');\n this.#activate(back, this.#activeWord?.direction);\n }\n } else this.#arrow(event, square);\n }\n\n /** An arrow: the first press turns where a word runs that way, else it moves to the nearest open square. */\n #arrow(event: KeyboardEvent, square: number): void {\n const across = arrowDelta(event, 'inline', this);\n const down = arrowDelta(event, 'block', this);\n if (across === 0 && down === 0) return;\n event.preventDefault();\n const way: Direction = across === 0 ? 'down' : 'across';\n const ways = this.#layoutNow.through.get(square) ?? {};\n if (way !== this.direction && ways[way] !== undefined) {\n this.#activate(square, way);\n return;\n }\n const { rows, columns, slots } = this.#layoutNow;\n let [r, c] = [Math.floor(square / columns), square % columns];\n for (;;) {\n r += down;\n c += across;\n if (r < 0 || r >= rows || c < 0 || c >= columns) return;\n if (slots.has(r * columns + c)) break;\n }\n this.#activate(r * columns + c, way);\n }\n}\n\nexport const crosswordElement: ElementRegistration = {\n manifest: crosswordManifest,\n element: CrosswordElement,\n messages: crosswordUiMessages,\n};\n"],"mappings":"A,0UAIA,IAAMqB,EAAY,iBAMLC,EAAiD,CAC5D,CAAE,YAAW,OAAQ,KAAM,SAAUtB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECgCMsB,EAAS,WACTC,EAAS,GAA6BC,IAAM,SAAW,OAAS,SAEhEC,EAAQ,GACZ,CAACC,EAAG,aAAe,GAAI,GAAG,CAAC,GAAGA,EAAG,iBAAiB,KAAK,CAAC,CAAC,CAAC,IAAK,GAAQC,EAAI,GAAG,CAAC,CAAC,CAC7E,KAAK,GAAG,CAAC,CACT,QAAQ,OAAQ,GAAG,CAAC,CACpB,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AAa/C,EAAK+C,KAAS,IAAA,GAAW,CACrD,KAAKf,GAAUP,EAAQsB,CAAG,EAC1B,MACF,CACA,GAAM,CAAE,OAAM,UAAS,SAAU,KAAK7E,GAClC,CAAC+C,EAAGC,GAAK,CAAC,KAAK,MAAMO,EAAS9B,CAAO,EAAG8B,EAAS9B,CAAO,EAC5D,OAAS,CAGP,GAFA,GAAKmD,EACL,GAAKD,EACD5B,EAAI,GAAKA,GAAKvB,GAAQwB,EAAI,GAAKA,GAAKvB,EAAS,OACjD,GAAI4B,EAAM,IAAIN,EAAItB,EAAUuB,CAAC,EAAG,KAClC,CACA,KAAKc,GAAUf,EAAItB,EAAUuB,EAAG6B,CAAG,CACrC,CACF,EAEaC,EAAwC,CACnD,SAAUnG,EACV,QAASc,EACT,SAAUP,CACZ,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return Array.from({length:e.length},(t,n)=>e.direction===`across`?[e.row,e.column+n]:[e.row+n,e.column])}var t=(e,t)=>`${e}-${t}`,n={tag:`astl-crossword`,version:1,display:`block`,graded:!0,attributes:[{name:`rows`,type:`integer`,visibility:`public`,required:!0,min:2,max:30},{name:`columns`,type:`integer`,visibility:`public`,required:!0,min:2,max:30},{name:`cells`,type:`string`,visibility:`derived`}],children:[{tag:`astl-prompt`,visibility:`public`,content:`inline`,min:0,max:1,attributes:[]},{tag:`astl-crossword-word`,visibility:`public`,content:`inline`,min:1,max:null,attributes:[{name:`id`,type:`id`,visibility:`public`,required:!0},{name:`answer`,type:`string`,visibility:`private`,required:!0},{name:`row`,type:`integer`,visibility:`public`,required:!0,min:0,max:29},{name:`column`,type:`integer`,visibility:`public`,required:!0,min:0,max:29},{name:`direction`,type:`enum`,visibility:`public`,required:!0,values:[`across`,`down`]},{name:`number`,type:`integer`,visibility:`derived`},{name:`length`,type:`integer`,visibility:`derived`}]}],scoring:{default:`word`,modes:{word:`all-correct`,letter:`per-slot`,whole:`all-correct`}},variants:null,slotKinds:[`letter`],issues:[`CROSSWORD_ANSWER_LETTERS`,`CROSSWORD_ANSWER_SHORT`,`CROSSWORD_OUTSIDE`,`CROSSWORD_OVERLAP`,`CROSSWORD_CROSSING`,`CROSSWORD_CLUE_EMPTY`,`CROSSWORD_CLUE_LINK`,`CROSSWORD_PROMPT_EMPTY`],messages:`astl.crossword`,a11y:{pattern:`a group of text fields, one per square: a letter fills the square and moves along the word; the arrow keys move to the nearest square, the first press turning to the other direction where two words cross; Space turns; Tab or Enter goes to the next clue, Shift back, and Tab leaves the grid after the last clue; Backspace clears the square or the one before; the clue list is one more tab stop: the arrow keys move, Enter goes to the word`,keys:[`Tab`,`Enter`,`Space`,`Backspace`,`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]},cssParts:[`crossword`,`prompt`,`current`,`grid`,`cell`,`number`,`clues`,`clue`,`verdict`,`solution`]},r={"ui.hint":`Write one letter in each square. Press a clue to go to its word.`,"ui.instructions":`A letter moves on along the word. The arrow keys move, Space turns to the other direction, Tab or Enter goes to the next clue.`,"ui.grid":`Crossword, {rows, plural, one {# row} other {# rows}}, {columns, plural, one {# column} other {# columns}}`,"ui.cell":`{number} {direction, select, across {across} other {down}}, letter {position} of {length}`,"ui.current":`{number} {direction, select, across {across} other {down}}, {length, plural, one {# letter} other {# letters}}: {clue}`,"ui.clues":`Clues`,"ui.across":`Across`,"ui.down":`Down`,"ui.length":`({length, plural, one {# letter} other {# letters}})`,"ui.crossing":`crosses the current word`,"ui.solution":`Correct answer:`},i={"ui.hint":`Wpisz po jednej literze w każdą kratkę. Naciśnij wskazówkę, aby przejść do jej hasła.`,"ui.instructions":`Po wpisaniu litery kursor przechodzi dalej wzdłuż hasła. Strzałki przesuwają, spacja zmienia kierunek, Tab albo Enter przechodzi do następnej wskazówki.`,"ui.grid":`Krzyżówka, {rows, plural, one {# wiersz} few {# wiersze} many {# wierszy} other {# wiersza}}, {columns, plural, one {# kolumna} few {# kolumny} many {# kolumn} other {# kolumny}}`,"ui.cell":`{number} {direction, select, across {poziomo} other {pionowo}}, litera {position} z {length}`,"ui.current":`{number} {direction, select, across {poziomo} other {pionowo}}, {length, plural, one {# litera} few {# litery} many {# liter} other {# litery}}: {clue}`,"ui.clues":`Wskazówki`,"ui.across":`Poziomo`,"ui.down":`Pionowo`,"ui.length":`({length, plural, one {# litera} few {# litery} many {# liter} other {# litery}})`,"ui.crossing":`krzyżuje się z bieżącym hasłem`,"ui.solution":`Poprawna odpowiedź:`};export{e as a,t as i,r as n,n as r,i as t};
|
|
2
|
+
//# sourceMappingURL=crossword-manifest-2qlu7AYd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crossword-manifest-2qlu7AYd.js","names":["squaresOf","word","k","squareId","row","column","crosswordManifest","en_default","pl_default"],"sources":["../../../../components/src/crossword/grid.ts","../../../../components/src/crossword/manifest.ts","../../../../components/src/crossword/messages/ui/en.json","../../../../components/src/crossword/messages/ui/pl.json"],"sourcesContent":["/** Where a word lies, shared by the definition (from the source) and the element (from the view). No letters here. */\n\nexport type Direction = 'across' | 'down';\n\nexport interface Placed {\n readonly row: number;\n readonly column: number;\n readonly direction: Direction;\n readonly length: number;\n}\n\n/** The squares of a word, first to last, as [row, column] from 0. */\nexport function squaresOf(word: Placed): (readonly [number, number])[] {\n return Array.from({ length: word.length }, (_, k) =>\n word.direction === 'across' ? [word.row, word.column + k] : [word.row + k, word.column],\n );\n}\n\n/** A square's local id, `<row>-<column>`: it starts with a digit, so it never meets a source id. */\nexport const squareId = (row: number, column: number): string => `${row}-${column}`;\n","import type { ComponentManifest } from '@astl/core';\n\n/**\n * Crossword: the author places every word (its first square and its direction); the open squares are the squares of\n * the words, numbered where words start, in reading order. Each open square grades one `letter` slot (local id\n * `<row>-<column>`). Scoring `word` makes each word a group of its own (right when all its letters are), `letter`\n * grades each letter, `whole` the grid at once. The view says where the words are, never their letters.\n */\nexport const crosswordManifest: ComponentManifest = {\n tag: 'astl-crossword',\n version: 1,\n display: 'block',\n graded: true,\n attributes: [\n { name: 'rows', type: 'integer', visibility: 'public', required: true, min: 2, max: 30 },\n { name: 'columns', type: 'integer', visibility: 'public', required: true, min: 2, max: 30 },\n /** The slot ids of the open squares in reading order, space separated. */\n { name: 'cells', type: 'string', visibility: 'derived' },\n ],\n children: [\n /** The task. */\n { tag: 'astl-prompt', visibility: 'public', content: 'inline', min: 0, max: 1, attributes: [] },\n /**\n * A word, its content the clue: `answer` (private) its letters, spaces dropped, in capitals of the content\n * language; `row` and `column` (from 0) its first square; `direction` across or down. The view gives each word its\n * clue `number` and `length` and lists the words across, then down, by number.\n */\n {\n tag: 'astl-crossword-word',\n visibility: 'public',\n content: 'inline',\n min: 1,\n max: null,\n attributes: [\n { name: 'id', type: 'id', visibility: 'public', required: true },\n { name: 'answer', type: 'string', visibility: 'private', required: true },\n { name: 'row', type: 'integer', visibility: 'public', required: true, min: 0, max: 29 },\n { name: 'column', type: 'integer', visibility: 'public', required: true, min: 0, max: 29 },\n { name: 'direction', type: 'enum', visibility: 'public', required: true, values: ['across', 'down'] },\n { name: 'number', type: 'integer', visibility: 'derived' },\n { name: 'length', type: 'integer', visibility: 'derived' },\n ],\n },\n ],\n scoring: { default: 'word', modes: { word: 'all-correct', letter: 'per-slot', whole: 'all-correct' } },\n variants: null,\n slotKinds: ['letter'],\n issues: [\n 'CROSSWORD_ANSWER_LETTERS',\n 'CROSSWORD_ANSWER_SHORT',\n 'CROSSWORD_OUTSIDE',\n 'CROSSWORD_OVERLAP',\n 'CROSSWORD_CROSSING',\n 'CROSSWORD_CLUE_EMPTY',\n 'CROSSWORD_CLUE_LINK',\n 'CROSSWORD_PROMPT_EMPTY',\n ],\n messages: 'astl.crossword',\n a11y: {\n pattern:\n 'a group of text fields, one per square: a letter fills the square and moves along the word; the arrow keys move to the nearest square, the first press turning to the other direction where two words cross; Space turns; Tab or Enter goes to the next clue, Shift back, and Tab leaves the grid after the last clue; Backspace clears the square or the one before; the clue list is one more tab stop: the arrow keys move, Enter goes to the word',\n keys: [\n 'Tab',\n 'Enter',\n 'Space',\n 'Backspace',\n 'ArrowUp',\n 'ArrowDown',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n ],\n },\n cssParts: [\n 'crossword',\n 'prompt',\n 'current',\n 'grid',\n 'cell',\n 'number',\n 'clues',\n 'clue',\n 'verdict',\n 'solution',\n ],\n};\n","{\n \"ui.hint\": \"Write one letter in each square. Press a clue to go to its word.\",\n \"ui.instructions\": \"A letter moves on along the word. The arrow keys move, Space turns to the other direction, Tab or Enter goes to the next clue.\",\n \"ui.grid\": \"Crossword, {rows, plural, one {# row} other {# rows}}, {columns, plural, one {# column} other {# columns}}\",\n \"ui.cell\": \"{number} {direction, select, across {across} other {down}}, letter {position} of {length}\",\n \"ui.current\": \"{number} {direction, select, across {across} other {down}}, {length, plural, one {# letter} other {# letters}}: {clue}\",\n \"ui.clues\": \"Clues\",\n \"ui.across\": \"Across\",\n \"ui.down\": \"Down\",\n \"ui.length\": \"({length, plural, one {# letter} other {# letters}})\",\n \"ui.crossing\": \"crosses the current word\",\n \"ui.solution\": \"Correct answer:\"\n}\n","{\n \"ui.hint\": \"Wpisz po jednej literze w każdą kratkę. Naciśnij wskazówkę, aby przejść do jej hasła.\",\n \"ui.instructions\": \"Po wpisaniu litery kursor przechodzi dalej wzdłuż hasła. Strzałki przesuwają, spacja zmienia kierunek, Tab albo Enter przechodzi do następnej wskazówki.\",\n \"ui.grid\": \"Krzyżówka, {rows, plural, one {# wiersz} few {# wiersze} many {# wierszy} other {# wiersza}}, {columns, plural, one {# kolumna} few {# kolumny} many {# kolumn} other {# kolumny}}\",\n \"ui.cell\": \"{number} {direction, select, across {poziomo} other {pionowo}}, litera {position} z {length}\",\n \"ui.current\": \"{number} {direction, select, across {poziomo} other {pionowo}}, {length, plural, one {# litera} few {# litery} many {# liter} other {# litery}}: {clue}\",\n \"ui.clues\": \"Wskazówki\",\n \"ui.across\": \"Poziomo\",\n \"ui.down\": \"Pionowo\",\n \"ui.length\": \"({length, plural, one {# litera} few {# litery} many {# liter} other {# litery}})\",\n \"ui.crossing\": \"krzyżuje się z bieżącym hasłem\",\n \"ui.solution\": \"Poprawna odpowiedź:\"\n}\n"],"mappings":"AAYA,SAAgBA,EAAU,EAA6C,CACrE,OAAO,MAAM,KAAK,CAAE,OAAQC,EAAK,MAAO,GAAI,EAAG,IAC7CA,EAAK,YAAc,SAAW,CAACA,EAAK,IAAKA,EAAK,OAASC,CAAC,EAAI,CAACD,EAAK,IAAMC,EAAGD,EAAK,MAAM,CACxF,CACF,CAGA,IAAaE,GAAY,EAAa,IAA2B,GAAGC,EAAI,GAAGC,ICX9DC,EAAuC,CAClD,IAAK,iBACL,QAAS,EACT,QAAS,QACT,OAAQ,GACR,WAAY,CACV,CAAE,KAAM,OAAQ,KAAM,UAAW,WAAY,SAAU,SAAU,GAAM,IAAK,EAAG,IAAK,EAAG,EACvF,CAAE,KAAM,UAAW,KAAM,UAAW,WAAY,SAAU,SAAU,GAAM,IAAK,EAAG,IAAK,EAAG,EAE1F,CAAE,KAAM,QAAS,KAAM,SAAU,WAAY,SAAU,CACzD,EACA,SAAU,CAER,CAAE,IAAK,cAAe,WAAY,SAAU,QAAS,SAAU,IAAK,EAAG,IAAK,EAAG,WAAY,CAAC,CAAE,EAM9F,CACE,IAAK,sBACL,WAAY,SACZ,QAAS,SACT,IAAK,EACL,IAAK,KACL,WAAY,CACV,CAAE,KAAM,KAAM,KAAM,KAAM,WAAY,SAAU,SAAU,EAAK,EAC/D,CAAE,KAAM,SAAU,KAAM,SAAU,WAAY,UAAW,SAAU,EAAK,EACxE,CAAE,KAAM,MAAO,KAAM,UAAW,WAAY,SAAU,SAAU,GAAM,IAAK,EAAG,IAAK,EAAG,EACtF,CAAE,KAAM,SAAU,KAAM,UAAW,WAAY,SAAU,SAAU,GAAM,IAAK,EAAG,IAAK,EAAG,EACzF,CAAE,KAAM,YAAa,KAAM,OAAQ,WAAY,SAAU,SAAU,GAAM,OAAQ,CAAC,SAAU,MAAM,CAAE,EACpG,CAAE,KAAM,SAAU,KAAM,UAAW,WAAY,SAAU,EACzD,CAAE,KAAM,SAAU,KAAM,UAAW,WAAY,SAAU,CAC3D,CACF,CACF,EACA,QAAS,CAAE,QAAS,OAAQ,MAAO,CAAE,KAAM,cAAe,OAAQ,WAAY,MAAO,aAAc,CAAE,EACrG,SAAU,KACV,UAAW,CAAC,QAAQ,EACpB,OAAQ,CACN,2BACA,yBACA,oBACA,oBACA,qBACA,uBACA,sBACA,wBACF,EACA,SAAU,iBACV,KAAM,CACJ,QACE,wbACF,KAAM,CACJ,MACA,QACA,QACA,YACA,UACA,YACA,YACA,aACA,OACA,KACF,CACF,EACA,SAAU,CACR,YACA,SACA,UACA,OACA,OACA,SACA,QACA,OACA,UACA,UACF,CACF,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=2e3,t=100,n=1e6,r=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,i=/^(?:astl-|tiptap|prosemirror)/i;function a(e){return r.test(e)&&!i.test(e)}function o(e){return[...new Set(e.split(/\s+/).filter(a))].join(` `)}function s(e,t){let n=[],r=0,i=``,a=0;for(let o=0;o<e.length;o++){let s=e.charAt(o);i===``?s===`"`||s===`'`?i=s:s===`(`?r++:s===`)`?r--:r===0&&(s===t||t===` `&&/\s/.test(s))&&(n.push(e.slice(a,o)),a=o+1):s===i&&(i=``)}return n.push(e.slice(a)),n.map(e=>e.trim()).filter(e=>e!==``)}var c=(...e)=>t=>e.includes(t)?t:null,l=(...e)=>t=>{for(let n of e){let e=n(t);if(e!==null)return e}return null},u=(e,t)=>n=>{let r=s(n,` `);if(r.length===0||r.length>e)return null;let i=r.map(t);return i.includes(null)?null:i.join(` `)},d=(...e)=>t=>{let n=[...e],r=s(t,` `);if(r.length===0)return null;let i=[];for(let e of r){let t=n.findIndex(t=>t(e)!==null);if(t<0)return null;i.push(n[t](e)),n.splice(t,1)}return i.join(` `)},f=/^\d{1,6}(?:\.\d{1,6})?$|^\.\d{1,6}$/,p=/^(\d{1,6}(?:\.\d{1,6})?|\.\d{1,6})(px|pt|em|rem|%)?$/,m={px:1,pt:4/3,em:16,rem:16},h=(e,t)=>e>=t[0]&&e<=t[1],g=e=>t=>{let n=p.exec(t);if(n===null)return null;let r=Number(n[1]),i=n[2];return i===void 0?e.number===void 0?r===0&&e.px!==void 0&&e.px[0]===0?`0`:null:h(r,e.number)?t:null:i===`%`?e.percent!==void 0&&h(r,e.percent)?t:null:e.px!==void 0&&h(r*m[i],e.px)?t:null},_=/^var\(--astl-palette-[1-8](?:-soft)?\)$/,v=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/,y=/^rgba?\(([^()]*)\)$/;function b(e){let t=e.trim().toLowerCase();if(v.test(t)){let e=t.slice(1),n=e.length<6,r=t=>Number.parseInt(n?`${e.charAt(t)}${e.charAt(t)}`:e.slice(t*2,t*2+2),16);return[r(0),r(1),r(2),e.length%4==0?r(3)/255:1]}let n=y.exec(t)?.[1];if(n===void 0)return null;let r=n.split(/[\s,/]+/).filter(e=>e!==``);if(r.length<3||r.length>4)return null;let[i,a,o]=r.slice(0,3).map(e=>f.test(e)?Number(e):NaN),s=r[3]??`1`,c=s.endsWith(`%`),l=c?s.slice(0,-1):s,u=f.test(l)?Number(l)/(c?100:1):NaN;return i===void 0||a===void 0||o===void 0||!(i<=255&&a<=255&&o<=255&&u<=1)?null:[Math.round(i),Math.round(a),Math.round(o),Math.round(u*1e3)/1e3]}var x=e=>{if(e===`transparent`||e===`currentcolor`||_.test(e)||v.test(e))return e;let t=b(e);if(t===null)return null;let[n,r,i,a]=t;return a===1?`rgb(${n}, ${r}, ${i})`:`rgba(${n}, ${r}, ${i}, ${a})`},S=e=>{if(e===`transparent`)return null;let t=b(e);return t!==null&&t[3]<.4?null:x(e)},C=/^[\p{L}\p{N} _-]{1,64}$/u,w=/^[\p{L}_][\p{L}\p{N} _-]{0,63}$/u,T=e=>{let t=s(e,`,`);if(t.length===0||t.length>8)return null;let n=t.map(e=>{let t=e.charAt(0);if(t!==`"`&&t!==`'`)return w.test(e)?e:null;let n=e.slice(1,-1);return e.length>2&&e.endsWith(t)&&C.test(n)?`"${n}"`:null});return n.includes(null)?null:n.join(`, `)},E=l(c(`xx-small`,`x-small`,`small`,`medium`,`large`,`x-large`,`xx-large`),g({px:[10,96],percent:[62.5,600]})),D=l(c(`auto`),g({px:[0,128],percent:[0,50]})),O=g({px:[0,64],percent:[0,25]}),k=g({px:[8,1200],percent:[1,100]}),A=l(c(`thin`,`medium`,`thick`),g({px:[0,16]})),j=c(`none`,`hidden`,`solid`,`dashed`,`dotted`,`double`,`groove`,`ridge`,`inset`,`outset`),M=g({px:[0,128],percent:[0,50]}),N=l(c(`normal`),g({px:[0,64],percent:[0,10]})),P=c(`none`,`underline`,`overline`,`line-through`),F=c(`solid`,`double`,`dotted`,`dashed`,`wavy`),I=c(`none`,`disc`,`circle`,`square`,`decimal`,`decimal-leading-zero`,`lower-alpha`,`upper-alpha`,`lower-latin`,`upper-latin`,`lower-roman`,`upper-roman`,`lower-greek`),L=c(`inside`,`outside`),R=e=>{if(e===`none`)return e;let t=s(e,`,`);if(t.length===0||t.length>3)return null;let n=[g({px:[0,32]}),g({px:[0,32]}),g({px:[0,64]}),g({px:[0,16]})],r=t.map(e=>{let t=0,r=s(e,` `).map(e=>{if(e===`inset`)return e;let r=n[t]?.(e)??null;return r!==null&&t++,r??x(e)});return t<2||r.includes(null)?null:r.join(` `)});return r.includes(null)?null:r.join(`, `)},z=[`top`,`right`,`bottom`,`left`,`inline`,`block`,`inline-start`,`inline-end`,`block-start`,`block-end`],B=[`top-left`,`top-right`,`bottom-left`,`bottom-right`,`start-start`,`start-end`,`end-start`,`end-end`],V=d(A,j,x),H=(e,t)=>u(e===`inline`||e===`block`?2:1,t),U=new Map([[`color`,S],[`background-color`,x],[`font-family`,T],[`font-size`,E],[`font-weight`,l(c(`normal`,`bold`,`bolder`,`lighter`),g({number:[100,900]}))],[`font-style`,c(`normal`,`italic`,`oblique`)],[`text-decoration`,d(P,P,P,F,x)],[`text-decoration-line`,u(3,P)],[`text-decoration-style`,F],[`text-decoration-color`,x],[`text-align`,c(`left`,`right`,`center`,`justify`,`start`,`end`)],[`text-indent`,g({px:[0,64],percent:[0,25]})],[`text-transform`,c(`none`,`uppercase`,`lowercase`,`capitalize`)],[`line-height`,l(c(`normal`),g({number:[.8,4],px:[8,160],percent:[80,400]}))],[`letter-spacing`,l(c(`normal`),g({px:[0,16]}))],[`margin`,u(4,D)],...z.map(e=>[`margin-${e}`,H(e,D)]),[`padding`,u(4,O)],...z.map(e=>[`padding-${e}`,H(e,O)]),[`border`,V],[`border-width`,u(4,A)],[`border-style`,u(4,j)],[`border-color`,u(4,x)],...z.flatMap(e=>[[`border-${e}`,V],[`border-${e}-width`,H(e,A)],[`border-${e}-style`,H(e,j)],[`border-${e}-color`,H(e,x)]]),[`border-image`,c(`none`,`initial`)],[`border-radius`,u(4,M)],...B.map(e=>[`border-${e}-radius`,u(2,M)]),[`box-shadow`,R],[`width`,l(c(`auto`),k)],[`max-width`,l(c(`none`),k)],[`inline-size`,l(c(`auto`),k)],[`max-inline-size`,l(c(`none`),k)],[`float`,c(`none`,`left`,`right`,`inline-start`,`inline-end`)],[`clear`,c(`none`,`left`,`right`,`both`,`inline-start`,`inline-end`)],[`display`,c(`block`,`inline`,`inline-block`)],[`vertical-align`,c(`baseline`,`top`,`middle`,`bottom`,`sub`,`super`,`text-top`,`text-bottom`)],[`list-style`,d(I,L,c(`none`))],[`list-style-type`,I],[`list-style-position`,L],[`gap`,u(2,N)],[`column-gap`,N],[`row-gap`,N],[`align-items`,c(`normal`,`stretch`,`start`,`end`,`center`,`baseline`,`flex-start`,`flex-end`)],[`flex-grow`,g({number:[0,12]})]]),W=[...U.keys()];function G(...e){let t=new Map;for(let n of e)for(let[e,r]of n)t.delete(e),t.set(e,r);return[...t]}function K(e){return e.map(([e,t])=>`${e}: ${t}`).join(`; `)}var q=e=>e.trim().slice(0,40);function J(e){if(e.length>2e3)return{style:``,declarations:[],removed:[`style`]};let t=[],n=[];for(let r of s(e,`;`)){let e=r.indexOf(`:`);if(e<0){n.push(q(r));continue}let i=r.slice(0,e).trim().toLowerCase(),a=r.slice(e+1).trim(),o=i===`background`?`background-color`:i,s=U.get(o)?.(o===`font-family`?a:a.toLowerCase())??null;s===null?n.push(q(i)):t.push([o,s])}let r=G(t);return{style:K(r),declarations:r,removed:n}}var Y=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};function X(e){return .2126*Y(e[0])+.7152*Y(e[1])+.0722*Y(e[2])}function Z(e,t){let n=e[3],r=r=>e[r]*n+t[r]*(1-n);return[r(0),r(1),r(2),1]}function Q(e,t){let[n,r]=[X(e),X(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}export{o as a,G as c,Q as d,X as f,W as i,Z as l,e as n,J as o,K as p,t as r,a as s,n as t,b as u};
|
|
2
|
+
//# sourceMappingURL=declarations-BhqOz1ap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations-BhqOz1ap.js","names":["MAX_STYLE_LENGTH","MAX_STYLE_RULES","MAX_INLINED_STYLES","STYLE_NAME","RESERVED_NAME","isStyleName","name","cleanClass","value","splitTop","parts","depth","quote","start","i","text","c","separator","part","words","allowed","either","kinds","kind","kept","upTo","max","anyOrder","free","index","NUMBER","DIMENSION","PX","within","n","range","size","match","unit","bounds","PALETTE_COLOR","HEX_COLOR","FUNCTION_COLOR","parseStyleColor","digits","short","pair","inner","red","green","blue","written","percent","number","alpha","color","parsed","inkColor","NAMED_FONT","PLAIN_FONT","fontFamily","names","fontSize","margin","padding","measure","lineWidth","lineStyle","corner","gap","line","decorationStyle","listType","listPosition","boxShadow","shadows","limits","lengths","shadow","length","SIDES","CORNERS","border","ends","side","ALLOWED","at","STYLE_PROPERTIES","mergeStyles","lists","merged","list","styleText","declarations","refusedName","cleanStyle","removed","colon","clean","channel","styleLuminance","overStyleColor","a","top","mix","below","styleContrast","hi","lo","ink","ground","b"],"sources":["../../../../core/src/declarations.ts"],"sourcesContent":["/**\n * The `style` allow-list of content format 1: which properties an author may set and what each may hold, value by\n * value. The output is rebuilt from validated tokens only, so whatever a style hides (comments, escapes, `!important`,\n * an unclosed parenthesis) never reaches a browser. Exercises play on public pages: nothing here can leave its box,\n * cover other content, load anything or hide text.\n *\n * `@astl/core/declarations`, not in the main entry: every bundle re-exports that one, so this table would load with every\n * player, and it is needed only by exercises that use styles.\n */\n\n/** Longest `style` value read; a longer one is dropped whole. */\nexport const MAX_STYLE_LENGTH = 2000;\n/** Most `<astl-style>` rules a document may have. */\nexport const MAX_STYLE_RULES = 100;\n/** Most characters of `style` inlining may write in one view: rules are short, the elements they reach may be many. */\nexport const MAX_INLINED_STYLES = 1_000_000;\n\n/** `name` of a named style, the only classes that exist: never one of the editing surface's own. */\nconst STYLE_NAME = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;\nconst RESERVED_NAME = /^(?:astl-|tiptap|prosemirror)/i;\n\n/** Whether `name` can name a style: the grammar, and none of the reserved prefixes `astl-`, `tiptap`, `prosemirror`. */\nexport function isStyleName(name: string): boolean {\n return STYLE_NAME.test(name) && !RESERVED_NAME.test(name);\n}\n\n/** A `class` value as an editing surface keeps it: the tokens that can name a style, each once. */\nexport function cleanClass(value: string): string {\n return [...new Set(value.split(/\\s+/).filter(isStyleName))].join(' ');\n}\n\n/** One kept declaration: lowercase property, normalised value. */\nexport type StyleDeclaration = readonly [name: string, value: string];\n\nexport interface CleanedStyle {\n /** The kept declarations as a `style` value: `name: value; name: value`, empty when none is left. */\n readonly style: string;\n readonly declarations: readonly StyleDeclaration[];\n /** The property names refused, in order; for what is not a declaration at all, its first characters. */\n readonly removed: readonly string[];\n}\n\n/** Red, green and blue (0 to 255) and alpha (0 to 1). */\nexport type StyleColor = readonly [red: number, green: number, blue: number, alpha: number];\n\n/** Checks a lowercase value (font names keep their case) and returns its normal form, or null to refuse it. */\ntype Kind = (value: string) => string | null;\n\n/** `text` split at `separator` (a space stands for any white space) outside parentheses and quotes. */\nfunction splitTop(text: string, separator: ';' | ',' | ' '): string[] {\n const parts: string[] = [];\n let depth = 0;\n let quote = '';\n let start = 0;\n for (let i = 0; i < text.length; i++) {\n const c = text.charAt(i);\n if (quote !== '') {\n if (c === quote) quote = '';\n } else if (c === '\"' || c === \"'\") quote = c;\n else if (c === '(') depth++;\n else if (c === ')') depth--;\n else if (depth === 0 && (c === separator || (separator === ' ' && /\\s/.test(c)))) {\n parts.push(text.slice(start, i));\n start = i + 1;\n }\n }\n parts.push(text.slice(start));\n return parts.map((part) => part.trim()).filter((part) => part !== '');\n}\n\nconst words =\n (...allowed: readonly string[]): Kind =>\n (value) =>\n allowed.includes(value) ? value : null;\n\nconst either =\n (...kinds: readonly Kind[]): Kind =>\n (value) => {\n for (const kind of kinds) {\n const kept = kind(value);\n if (kept !== null) return kept;\n }\n return null;\n };\n\n/** One to `max` space-separated values. */\nconst upTo =\n (max: number, kind: Kind): Kind =>\n (value) => {\n const parts = splitTop(value, ' ');\n if (parts.length === 0 || parts.length > max) return null;\n const kept = parts.map(kind);\n return kept.includes(null) ? null : kept.join(' ');\n };\n\n/** Values of the kinds given, in any order, each kind at most once: the shape of `border` and its like. */\nconst anyOrder =\n (...kinds: readonly Kind[]): Kind =>\n (value) => {\n const free = [...kinds];\n const parts = splitTop(value, ' ');\n if (parts.length === 0) return null;\n const kept: string[] = [];\n for (const part of parts) {\n const index = free.findIndex((kind) => kind(part) !== null);\n if (index < 0) return null;\n kept.push((free[index] as Kind)(part) as string);\n free.splice(index, 1);\n }\n return kept.join(' ');\n };\n\nconst NUMBER = /^\\d{1,6}(?:\\.\\d{1,6})?$|^\\.\\d{1,6}$/;\nconst DIMENSION = /^(\\d{1,6}(?:\\.\\d{1,6})?|\\.\\d{1,6})(px|pt|em|rem|%)?$/;\n/** What a length comes to, for its bound: 1em and 1rem count as 16 px, whatever they turn out to be in a page. */\nconst PX: Readonly<Record<string, number>> = { px: 1, pt: 4 / 3, em: 16, rem: 16 };\n\ninterface Bounds {\n /** Lengths, in px. Without it, no lengths. */\n readonly px?: readonly [min: number, max: number];\n /** Percentages. Without it, none. */\n readonly percent?: readonly [min: number, max: number];\n /** Bare numbers. Without it, only a bare zero, where lengths may be zero. */\n readonly number?: readonly [min: number, max: number];\n}\n\nconst within = (n: number, range: readonly [number, number]): boolean => n >= range[0] && n <= range[1];\n\n/** A number with its unit, within bounds. Signs never parse: no negative length exists. */\nconst size =\n (bounds: Bounds): Kind =>\n (value) => {\n const match = DIMENSION.exec(value);\n if (match === null) return null;\n const n = Number(match[1]);\n const unit = match[2];\n if (unit === undefined) {\n if (bounds.number !== undefined) return within(n, bounds.number) ? value : null;\n return n === 0 && bounds.px !== undefined && bounds.px[0] === 0 ? '0' : null;\n }\n if (unit === '%') return bounds.percent !== undefined && within(n, bounds.percent) ? value : null;\n return bounds.px !== undefined && within(n * (PX[unit] as number), bounds.px) ? value : null;\n };\n\nconst PALETTE_COLOR = /^var\\(--astl-palette-[1-8](?:-soft)?\\)$/;\nconst HEX_COLOR = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/;\nconst FUNCTION_COLOR = /^rgba?\\(([^()]*)\\)$/;\n\n/** A hex colour or `rgb()`, or null: what has a value of its own, as opposed to a palette token or a keyword. */\nexport function parseStyleColor(value: string): StyleColor | null {\n const text = value.trim().toLowerCase();\n if (HEX_COLOR.test(text)) {\n const digits = text.slice(1);\n const short = digits.length < 6;\n const pair = (i: number) =>\n Number.parseInt(short ? `${digits.charAt(i)}${digits.charAt(i)}` : digits.slice(i * 2, i * 2 + 2), 16);\n return [pair(0), pair(1), pair(2), digits.length % 4 === 0 ? pair(3) / 255 : 1];\n }\n const inner = FUNCTION_COLOR.exec(text)?.[1];\n if (inner === undefined) return null;\n const parts = inner.split(/[\\s,/]+/).filter((part) => part !== '');\n if (parts.length < 3 || parts.length > 4) return null;\n const [red, green, blue] = parts.slice(0, 3).map((part) => (NUMBER.test(part) ? Number(part) : Number.NaN));\n const written = parts[3] ?? '1';\n const percent = written.endsWith('%');\n const number = percent ? written.slice(0, -1) : written;\n const alpha = NUMBER.test(number) ? Number(number) / (percent ? 100 : 1) : Number.NaN;\n if (!(red !== undefined && green !== undefined && blue !== undefined)) return null;\n if (!(red <= 255 && green <= 255 && blue <= 255 && alpha <= 1)) return null;\n return [Math.round(red), Math.round(green), Math.round(blue), Math.round(alpha * 1000) / 1000];\n}\n\n/** A colour's normal form: `rgb(r, g, b)` for a function, as the browser writes it; hex stays hex, lowercase. */\nconst color: Kind = (value) => {\n if (value === 'transparent' || value === 'currentcolor' || PALETTE_COLOR.test(value)) return value;\n if (HEX_COLOR.test(value)) return value;\n const parsed = parseStyleColor(value);\n if (parsed === null) return null;\n const [red, green, blue, alpha] = parsed;\n return alpha === 1 ? `rgb(${red}, ${green}, ${blue})` : `rgba(${red}, ${green}, ${blue}, ${alpha})`;\n};\n\n/** A text colour: also legible by itself, so never transparent or nearly so. */\nconst inkColor: Kind = (value) => {\n if (value === 'transparent') return null;\n const parsed = parseStyleColor(value);\n return parsed !== null && parsed[3] < 0.4 ? null : color(value);\n};\n\nconst NAMED_FONT = /^[\\p{L}\\p{N} _-]{1,64}$/u;\nconst PLAIN_FONT = /^[\\p{L}_][\\p{L}\\p{N} _-]{0,63}$/u;\n\n/** A list of at most 8 font names: letters, digits, spaces, `_` and `-`, so never a function or an escape. */\nconst fontFamily: Kind = (value) => {\n const names = splitTop(value, ',');\n if (names.length === 0 || names.length > 8) return null;\n const kept = names.map((name) => {\n const quote = name.charAt(0);\n if (quote !== '\"' && quote !== \"'\") return PLAIN_FONT.test(name) ? name : null;\n const inner = name.slice(1, -1);\n return name.length > 2 && name.endsWith(quote) && NAMED_FONT.test(inner) ? `\"${inner}\"` : null;\n });\n return kept.includes(null) ? null : kept.join(', ');\n};\n\n/** The size words a browser may write back; `larger` and `smaller` are left out: nested, they have no bound. */\nconst fontSize = either(\n words('xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'),\n size({ px: [10, 96], percent: [62.5, 600] }),\n);\n\nconst margin = either(words('auto'), size({ px: [0, 128], percent: [0, 50] }));\nconst padding = size({ px: [0, 64], percent: [0, 25] });\nconst measure = size({ px: [8, 1200], percent: [1, 100] });\nconst lineWidth = either(words('thin', 'medium', 'thick'), size({ px: [0, 16] }));\nconst lineStyle = words(\n 'none',\n 'hidden',\n 'solid',\n 'dashed',\n 'dotted',\n 'double',\n 'groove',\n 'ridge',\n 'inset',\n 'outset',\n);\nconst corner = size({ px: [0, 128], percent: [0, 50] });\nconst gap = either(words('normal'), size({ px: [0, 64], percent: [0, 10] }));\nconst line = words('none', 'underline', 'overline', 'line-through');\nconst decorationStyle = words('solid', 'double', 'dotted', 'dashed', 'wavy');\nconst listType = words(\n 'none',\n 'disc',\n 'circle',\n 'square',\n 'decimal',\n 'decimal-leading-zero',\n 'lower-alpha',\n 'upper-alpha',\n 'lower-latin',\n 'upper-latin',\n 'lower-roman',\n 'upper-roman',\n 'lower-greek',\n);\nconst listPosition = words('inside', 'outside');\n\n/** Up to three shadows, down and to the end only: offsets to 32 px, blur to 64 px, spread to 16 px. */\nconst boxShadow: Kind = (value) => {\n if (value === 'none') return value;\n const shadows = splitTop(value, ',');\n if (shadows.length === 0 || shadows.length > 3) return null;\n const limits = [size({ px: [0, 32] }), size({ px: [0, 32] }), size({ px: [0, 64] }), size({ px: [0, 16] })];\n const kept = shadows.map((shadow) => {\n let lengths = 0;\n const parts = splitTop(shadow, ' ').map((part) => {\n if (part === 'inset') return part;\n const length = limits[lengths]?.(part) ?? null;\n if (length !== null) lengths++;\n return length ?? color(part);\n });\n return lengths < 2 || parts.includes(null) ? null : parts.join(' ');\n });\n return kept.includes(null) ? null : kept.join(', ');\n};\n\nconst SIDES = [\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'inline',\n 'block',\n 'inline-start',\n 'inline-end',\n 'block-start',\n 'block-end',\n];\nconst CORNERS = [\n 'top-left',\n 'top-right',\n 'bottom-left',\n 'bottom-right',\n 'start-start',\n 'start-end',\n 'end-start',\n 'end-end',\n];\n\nconst border = anyOrder(lineWidth, lineStyle, color);\n/** How many values a side takes: `inline` and `block` have two ends, and browsers write different ends together. */\nconst ends = (side: string, kind: Kind): Kind => upTo(side === 'inline' || side === 'block' ? 2 : 1, kind);\n\n/** The properties an author may set, each with what it may hold. Anything else is refused. */\nconst ALLOWED: ReadonlyMap<string, Kind> = new Map<string, Kind>([\n // Text.\n ['color', inkColor],\n ['background-color', color],\n ['font-family', fontFamily],\n ['font-size', fontSize],\n ['font-weight', either(words('normal', 'bold', 'bolder', 'lighter'), size({ number: [100, 900] }))],\n ['font-style', words('normal', 'italic', 'oblique')],\n ['text-decoration', anyOrder(line, line, line, decorationStyle, color)],\n ['text-decoration-line', upTo(3, line)],\n ['text-decoration-style', decorationStyle],\n ['text-decoration-color', color],\n ['text-align', words('left', 'right', 'center', 'justify', 'start', 'end')],\n ['text-indent', size({ px: [0, 64], percent: [0, 25] })],\n ['text-transform', words('none', 'uppercase', 'lowercase', 'capitalize')],\n ['line-height', either(words('normal'), size({ number: [0.8, 4], px: [8, 160], percent: [80, 400] }))],\n ['letter-spacing', either(words('normal'), size({ px: [0, 16] }))],\n // Box.\n ['margin', upTo(4, margin)],\n ...SIDES.map((side): [string, Kind] => [`margin-${side}`, ends(side, margin)]),\n ['padding', upTo(4, padding)],\n ...SIDES.map((side): [string, Kind] => [`padding-${side}`, ends(side, padding)]),\n ['border', border],\n ['border-width', upTo(4, lineWidth)],\n ['border-style', upTo(4, lineStyle)],\n ['border-color', upTo(4, color)],\n ...SIDES.flatMap((side): [string, Kind][] => [\n [`border-${side}`, border],\n [`border-${side}-width`, ends(side, lineWidth)],\n [`border-${side}-style`, ends(side, lineStyle)],\n [`border-${side}-color`, ends(side, color)],\n ]),\n // Nothing an author would write: Chromium expands `border` with it, and a style must survive that.\n ['border-image', words('none', 'initial')],\n ['border-radius', upTo(4, corner)],\n ...CORNERS.map((at): [string, Kind] => [`border-${at}-radius`, upTo(2, corner)]),\n ['box-shadow', boxShadow],\n // Size and flow.\n ['width', either(words('auto'), measure)],\n ['max-width', either(words('none'), measure)],\n ['inline-size', either(words('auto'), measure)],\n ['max-inline-size', either(words('none'), measure)],\n ['float', words('none', 'left', 'right', 'inline-start', 'inline-end')],\n ['clear', words('none', 'left', 'right', 'both', 'inline-start', 'inline-end')],\n ['display', words('block', 'inline', 'inline-block')],\n ['vertical-align', words('baseline', 'top', 'middle', 'bottom', 'sub', 'super', 'text-top', 'text-bottom')],\n // The third value is the image a browser may write back: `none` is the only one that exists here.\n ['list-style', anyOrder(listType, listPosition, words('none'))],\n ['list-style-type', listType],\n ['list-style-position', listPosition],\n // Columns.\n ['gap', upTo(2, gap)],\n ['column-gap', gap],\n ['row-gap', gap],\n ['align-items', words('normal', 'stretch', 'start', 'end', 'center', 'baseline', 'flex-start', 'flex-end')],\n ['flex-grow', size({ number: [0, 12] })],\n]);\n\n/** Every property a `style` may set, as a host lists them (`background` is read as `background-color`). */\nexport const STYLE_PROPERTIES: readonly string[] = [...ALLOWED.keys()];\n\n/** Declarations in order, the later of one property in the place of the earlier: what the cascade would keep. */\nexport function mergeStyles(...lists: readonly (readonly StyleDeclaration[])[]): StyleDeclaration[] {\n const merged = new Map<string, string>();\n for (const list of lists) {\n for (const [name, value] of list) {\n // Deleted first, so it goes after a shorthand or longhand of the same box written earlier.\n merged.delete(name);\n merged.set(name, value);\n }\n }\n return [...merged];\n}\n\n/** Declarations as a `style` value. */\nexport function styleText(declarations: readonly StyleDeclaration[]): string {\n return declarations.map(([name, value]) => `${name}: ${value}`).join('; ');\n}\n\nconst refusedName = (text: string): string => text.trim().slice(0, 40);\n\n/**\n * A `style` value through the allow-list: the declarations it may keep, and the names of those it may not. Refused:\n * every property outside the table, and any declaration whose value is not exactly what the table allows (comments,\n * escapes, `!important`, `url()`, custom properties, `var()` other than `--astl-palette-<n>` and its `-soft`, a size\n * out of bounds). Idempotent, also on what browsers write back (`rgb(47, 86, 217)`, quoted font names, `0px`).\n */\nexport function cleanStyle(value: string): CleanedStyle {\n if (value.length > MAX_STYLE_LENGTH) return { style: '', declarations: [], removed: ['style'] };\n const kept: StyleDeclaration[] = [];\n const removed: string[] = [];\n for (const part of splitTop(value, ';')) {\n const colon = part.indexOf(':');\n if (colon < 0) {\n removed.push(refusedName(part));\n continue;\n }\n const written = part.slice(0, colon).trim().toLowerCase();\n const text = part.slice(colon + 1).trim();\n // The browser's form of a background of one colour, and the one way to write it here.\n const name = written === 'background' ? 'background-color' : written;\n const kind = ALLOWED.get(name);\n const clean = kind?.(name === 'font-family' ? text : text.toLowerCase()) ?? null;\n if (clean === null) removed.push(refusedName(written));\n else kept.push([name, clean]);\n }\n const declarations = mergeStyles(kept);\n return { style: styleText(declarations), declarations, removed };\n}\n\nconst channel = (value: number): number => {\n const c = value / 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n};\n\n/** The WCAG relative luminance of a colour, its alpha left out. */\nexport function styleLuminance(value: StyleColor): number {\n return 0.2126 * channel(value[0]) + 0.7152 * channel(value[1]) + 0.0722 * channel(value[2]);\n}\n\n/** `top` over `below`: what the eye sees of a colour with alpha. */\nexport function overStyleColor(top: StyleColor, below: StyleColor): StyleColor {\n const a = top[3];\n const mix = (i: 0 | 1 | 2) => top[i] * a + below[i] * (1 - a);\n return [mix(0), mix(1), mix(2), 1];\n}\n\n/** The WCAG contrast ratio of an opaque text colour and background, from 1 to 21. */\nexport function styleContrast(ink: StyleColor, ground: StyleColor): number {\n const [hi, lo] = [styleLuminance(ink), styleLuminance(ground)].sort((a, b) => b - a) as [number, number];\n return (hi + 0.05) / (lo + 0.05);\n}\n"],"mappings":"AAWA,IAAaA,EAAmB,IAEnBC,EAAkB,IAElBC,EAAqB,IAG5BC,EAAa,gCACbC,EAAgB,iCAGtB,SAAgBC,EAAY,EAA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