@astl/astrolabe 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +119 -0
- package/LICENSE +202 -0
- package/README.md +64 -2
- package/dist/cdn/astrolabe-editor.js +1441 -0
- package/dist/cdn/astrolabe-editor.js.map +1 -0
- package/dist/cdn/astrolabe-player.js +2 -0
- package/dist/cdn/astrolabe-player.js.map +1 -0
- package/dist/cdn/astrolabe.css +238 -0
- package/dist/cdn/astrolabe.js +3 -0
- package/dist/cdn/astrolabe.js.map +1 -0
- package/dist/cdn/astrolabe.standalone.js +8007 -0
- package/dist/cdn/chunks/audio-B0LSIn5N.js +48 -0
- package/dist/cdn/chunks/audio-B0LSIn5N.js.map +1 -0
- package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js +2 -0
- package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js.map +1 -0
- package/dist/cdn/chunks/block-styles-CKo9x7Vt.js +68 -0
- package/dist/cdn/chunks/block-styles-CKo9x7Vt.js.map +1 -0
- package/dist/cdn/chunks/book-CHzDDaim.js +15 -0
- package/dist/cdn/chunks/book-CHzDDaim.js.map +1 -0
- package/dist/cdn/chunks/callout-QFLFLPc5.js +49 -0
- package/dist/cdn/chunks/callout-QFLFLPc5.js.map +1 -0
- package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js +2 -0
- package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js.map +1 -0
- package/dist/cdn/chunks/categorise-BO2tNVJ3.js +203 -0
- package/dist/cdn/chunks/categorise-BO2tNVJ3.js.map +1 -0
- package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js +2 -0
- package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js.map +1 -0
- package/dist/cdn/chunks/chip-styles-Dme5daTO.js +77 -0
- package/dist/cdn/chunks/chip-styles-Dme5daTO.js.map +1 -0
- package/dist/cdn/chunks/choice-CExBvqKj.js +136 -0
- package/dist/cdn/chunks/choice-CExBvqKj.js.map +1 -0
- package/dist/cdn/chunks/choice-manifest-C-XahD7m.js +2 -0
- package/dist/cdn/chunks/choice-manifest-C-XahD7m.js.map +1 -0
- package/dist/cdn/chunks/color-control-Cl5cuMSO.js +91 -0
- package/dist/cdn/chunks/color-control-Cl5cuMSO.js.map +1 -0
- package/dist/cdn/chunks/crossword-Cb-a3Tjj.js +270 -0
- package/dist/cdn/chunks/crossword-Cb-a3Tjj.js.map +1 -0
- package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js +2 -0
- package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js.map +1 -0
- package/dist/cdn/chunks/declarations-BhqOz1ap.js +2 -0
- package/dist/cdn/chunks/declarations-BhqOz1ap.js.map +1 -0
- package/dist/cdn/chunks/definitions-CNX90WtL.js +6 -0
- package/dist/cdn/chunks/definitions-CNX90WtL.js.map +1 -0
- package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js +14 -0
- package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js.map +1 -0
- package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js +2 -0
- package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js.map +1 -0
- package/dist/cdn/chunks/drop-vRXndjHu.js +86 -0
- package/dist/cdn/chunks/drop-vRXndjHu.js.map +1 -0
- package/dist/cdn/chunks/flash-cards-0NrrKdrx.js +87 -0
- package/dist/cdn/chunks/flash-cards-0NrrKdrx.js.map +1 -0
- package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js +2 -0
- package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js.map +1 -0
- package/dist/cdn/chunks/gap-lor-khst.js +78 -0
- package/dist/cdn/chunks/gap-lor-khst.js.map +1 -0
- package/dist/cdn/chunks/gap-manifest-RSydA41N.js +2 -0
- package/dist/cdn/chunks/gap-manifest-RSydA41N.js.map +1 -0
- package/dist/cdn/chunks/help-C-woafz5.js +138 -0
- package/dist/cdn/chunks/help-C-woafz5.js.map +1 -0
- package/dist/cdn/chunks/help-form-DaC6KaFG.js +160 -0
- package/dist/cdn/chunks/help-form-DaC6KaFG.js.map +1 -0
- package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js +2 -0
- package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js.map +1 -0
- package/dist/cdn/chunks/hotspot-oel1Eelo.js +154 -0
- package/dist/cdn/chunks/hotspot-oel1Eelo.js.map +1 -0
- package/dist/cdn/chunks/image-drop-Dkprw0Kn.js +295 -0
- package/dist/cdn/chunks/image-drop-Dkprw0Kn.js.map +1 -0
- package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js +2 -0
- package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js.map +1 -0
- package/dist/cdn/chunks/image-label-Dm5shQSh.js +177 -0
- package/dist/cdn/chunks/image-label-Dm5shQSh.js.map +1 -0
- package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js +2 -0
- package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js.map +1 -0
- package/dist/cdn/chunks/inline-styles-CTgXWnHb.js +80 -0
- package/dist/cdn/chunks/inline-styles-CTgXWnHb.js.map +1 -0
- package/dist/cdn/chunks/insert-menu-LgrifBYT.js +80 -0
- package/dist/cdn/chunks/insert-menu-LgrifBYT.js.map +1 -0
- package/dist/cdn/chunks/issue-list-BgnXzXRM.js +51 -0
- package/dist/cdn/chunks/issue-list-BgnXzXRM.js.map +1 -0
- package/dist/cdn/chunks/keys-DU-Qknmz.js +2 -0
- package/dist/cdn/chunks/keys-DU-Qknmz.js.map +1 -0
- package/dist/cdn/chunks/live-jdiyYln2.js +7 -0
- package/dist/cdn/chunks/live-jdiyYln2.js.map +1 -0
- package/dist/cdn/chunks/long-answer-CtzClLAx.js +71 -0
- package/dist/cdn/chunks/long-answer-CtzClLAx.js.map +1 -0
- package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js +2 -0
- package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js.map +1 -0
- package/dist/cdn/chunks/mark-words-CpH3gTcX.js +131 -0
- package/dist/cdn/chunks/mark-words-CpH3gTcX.js.map +1 -0
- package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js +2 -0
- package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js.map +1 -0
- package/dist/cdn/chunks/match-DKE_4o-x.js +352 -0
- package/dist/cdn/chunks/match-DKE_4o-x.js.map +1 -0
- package/dist/cdn/chunks/match-manifest-D0UfoajU.js +2 -0
- package/dist/cdn/chunks/match-manifest-D0UfoajU.js.map +1 -0
- package/dist/cdn/chunks/memory-B6hSyHyz.js +187 -0
- package/dist/cdn/chunks/memory-B6hSyHyz.js.map +1 -0
- package/dist/cdn/chunks/memory-manifest-D1589iR0.js +2 -0
- package/dist/cdn/chunks/memory-manifest-D1589iR0.js.map +1 -0
- package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js +2 -0
- package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js.map +1 -0
- package/dist/cdn/chunks/messages-9xiYDvRT.js +2 -0
- package/dist/cdn/chunks/messages-9xiYDvRT.js.map +1 -0
- package/dist/cdn/chunks/option-styles-WKzjKmCH.js +50 -0
- package/dist/cdn/chunks/option-styles-WKzjKmCH.js.map +1 -0
- package/dist/cdn/chunks/order-BhG_6IC-.js +225 -0
- package/dist/cdn/chunks/order-BhG_6IC-.js.map +1 -0
- package/dist/cdn/chunks/order-manifest-J5IXN0he.js +2 -0
- package/dist/cdn/chunks/order-manifest-J5IXN0he.js.map +1 -0
- package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js +2 -0
- package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js.map +1 -0
- package/dist/cdn/chunks/picture-D10YRMYH.js +2 -0
- package/dist/cdn/chunks/picture-D10YRMYH.js.map +1 -0
- package/dist/cdn/chunks/picture-view-BKnAyScQ.js +92 -0
- package/dist/cdn/chunks/picture-view-BKnAyScQ.js.map +1 -0
- package/dist/cdn/chunks/repeat-CY2W2URZ.js +8 -0
- package/dist/cdn/chunks/repeat-CY2W2URZ.js.map +1 -0
- package/dist/cdn/chunks/roving-focus-BxGgi2DD.js +2 -0
- package/dist/cdn/chunks/roving-focus-BxGgi2DD.js.map +1 -0
- package/dist/cdn/chunks/runtime-DxAbpr3S.js +526 -0
- package/dist/cdn/chunks/runtime-DxAbpr3S.js.map +1 -0
- package/dist/cdn/chunks/scan-jWgPnVxA.js +2 -0
- package/dist/cdn/chunks/scan-jWgPnVxA.js.map +1 -0
- package/dist/cdn/chunks/select-DTA3dJzr.js +345 -0
- package/dist/cdn/chunks/select-DTA3dJzr.js.map +1 -0
- package/dist/cdn/chunks/select-manifest-BBMbvdkH.js +2 -0
- package/dist/cdn/chunks/select-manifest-BBMbvdkH.js.map +1 -0
- package/dist/cdn/chunks/source-view-DXKPFCl9.js +29 -0
- package/dist/cdn/chunks/source-view-DXKPFCl9.js.map +1 -0
- package/dist/cdn/chunks/style-form-D5haJtWM.js +240 -0
- package/dist/cdn/chunks/style-form-D5haJtWM.js.map +1 -0
- package/dist/cdn/chunks/style-messages-BbZpeD2a.js +2 -0
- package/dist/cdn/chunks/style-messages-BbZpeD2a.js.map +1 -0
- package/dist/cdn/chunks/style-model-ZXNe_c8R.js +2 -0
- package/dist/cdn/chunks/style-model-ZXNe_c8R.js.map +1 -0
- package/dist/cdn/chunks/style-placing-DPw1zyrz.js +2 -0
- package/dist/cdn/chunks/style-placing-DPw1zyrz.js.map +1 -0
- package/dist/cdn/chunks/style-popups-BobgX1WK.js +74 -0
- package/dist/cdn/chunks/style-popups-BobgX1WK.js.map +1 -0
- package/dist/cdn/chunks/style-rules-D45PZLCv.js +136 -0
- package/dist/cdn/chunks/style-rules-D45PZLCv.js.map +1 -0
- package/dist/cdn/chunks/styled-Dmx5Yjv7.js +57 -0
- package/dist/cdn/chunks/styled-Dmx5Yjv7.js.map +1 -0
- package/dist/cdn/chunks/styles-DxJJxVNH.js +136 -0
- package/dist/cdn/chunks/styles-DxJJxVNH.js.map +1 -0
- package/dist/cdn/chunks/surface-CgxfAwCR.js +1019 -0
- package/dist/cdn/chunks/surface-CgxfAwCR.js.map +1 -0
- package/dist/cdn/chunks/true-false-DP3MO599.js +146 -0
- package/dist/cdn/chunks/true-false-DP3MO599.js.map +1 -0
- package/dist/cdn/chunks/true-false-manifest-B4exv60u.js +2 -0
- package/dist/cdn/chunks/true-false-manifest-B4exv60u.js.map +1 -0
- package/dist/cdn/chunks/video-j9MCH6Kw.js +98 -0
- package/dist/cdn/chunks/video-j9MCH6Kw.js.map +1 -0
- package/dist/cdn/chunks/video-manifest-8OwkhhAI.js +2 -0
- package/dist/cdn/chunks/video-manifest-8OwkhhAI.js.map +1 -0
- package/dist/cdn/chunks/word-bank-ARjwUKZf.js +80 -0
- package/dist/cdn/chunks/word-bank-ARjwUKZf.js.map +1 -0
- package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js +2 -0
- package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js.map +1 -0
- package/dist/cdn/chunks/word-search-AHvM7yCJ.js +274 -0
- package/dist/cdn/chunks/word-search-AHvM7yCJ.js.map +1 -0
- package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js +2 -0
- package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js.map +1 -0
- package/dist/editor.d.ts +32 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +51 -0
- package/dist/editor.js.map +1 -0
- package/dist/engine.d.ts +33 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +53 -0
- package/dist/engine.js.map +1 -0
- package/dist/player.d.ts +19 -0
- package/dist/player.d.ts.map +1 -0
- package/dist/player.js +22 -0
- package/dist/player.js.map +1 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +8 -0
- package/dist/server.js.map +1 -0
- package/package.json +70 -3
- package/src/bundles/astrolabe-editor.ts +11 -0
- package/src/bundles/astrolabe-player.ts +10 -0
- package/src/bundles/astrolabe-standalone.ts +23 -0
- package/src/bundles/astrolabe.ts +12 -0
- package/src/editor.ts +98 -0
- package/src/engine.ts +59 -0
- package/src/player.ts +23 -0
- package/src/server.ts +7 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import{C as e,D as t,E as n,T as r,b as i,h as a,m as o,n as s,v as c,y as l}from"./runtime-DxAbpr3S.js";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./word-search-manifest-Fg1a59Z1.js";import{t as g}from"./roving-focus-BxGgi2DD.js";import{t as _}from"./block-styles-CKo9x7Vt.js";var v=`astl.word-search`,y=[{namespace:v,locale:`en`,messages:u},{namespace:v,locale:`pl`,messages:d}],b=e=>(e.textContent??``).replace(/\s+/g,` `).trim(),x=e=>b(e)||[...e.querySelectorAll(`img`)].map(e=>e.alt).join(` `).trim(),S=(e,t)=>e[0]===t[0]&&e[1]===t[1];function C(e,t){let n=m(t);return e===t||n!==null&&e===h(n[1],n[0])}var w=r`<path d="M4 10h12" stroke="currentColor" stroke-width="6" stroke-linecap="round"/>`,T=class extends s{static manifest=p;static messages=y;static shadowRootOptions={...l.shadowRootOptions,slotAssignment:`manual`};static properties={lines:{state:!0},anchor:{state:!0},clue:{state:!0},status:{state:!0}};static styles=[n`
|
|
2
|
+
.board {
|
|
3
|
+
--astl-ws-edge: calc(var(--astl-focus-width) + var(--astl-focus-offset));
|
|
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-ws-size) * var(--astl-target-min) + 2 * var(--astl-ws-edge));
|
|
11
|
+
min-inline-size: 0;
|
|
12
|
+
container-type: inline-size;
|
|
13
|
+
}
|
|
14
|
+
.paper {
|
|
15
|
+
--astl-ws-cell: clamp(1.5rem, (100cqi - 2 * var(--astl-ws-edge)) / var(--astl-ws-size), var(--astl-target-min));
|
|
16
|
+
position: relative;
|
|
17
|
+
inline-size: calc(var(--astl-ws-cell) * var(--astl-ws-size));
|
|
18
|
+
padding: var(--astl-ws-edge);
|
|
19
|
+
}
|
|
20
|
+
.grid {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
touch-action: none;
|
|
24
|
+
user-select: none;
|
|
25
|
+
-webkit-user-select: none;
|
|
26
|
+
-webkit-touch-callout: none;
|
|
27
|
+
}
|
|
28
|
+
.row {
|
|
29
|
+
display: flex;
|
|
30
|
+
}
|
|
31
|
+
.cell {
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
display: grid;
|
|
34
|
+
place-items: center;
|
|
35
|
+
flex: none;
|
|
36
|
+
inline-size: var(--astl-ws-cell);
|
|
37
|
+
block-size: var(--astl-ws-cell);
|
|
38
|
+
font-family: var(--astl-font-mono);
|
|
39
|
+
font-size: max(var(--astl-size-small), calc(var(--astl-ws-cell) * 0.55));
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
line-height: 1;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
scroll-margin: var(--astl-ws-edge);
|
|
44
|
+
}
|
|
45
|
+
.grid[aria-disabled] .cell {
|
|
46
|
+
cursor: default;
|
|
47
|
+
}
|
|
48
|
+
.cell[data-first] {
|
|
49
|
+
border-radius: var(--astl-radius-m);
|
|
50
|
+
box-shadow: inset 0 0 0 var(--astl-focus-width) var(--astl-selected);
|
|
51
|
+
font-weight: 800;
|
|
52
|
+
}
|
|
53
|
+
.status {
|
|
54
|
+
margin-block: var(--astl-space-2) 0;
|
|
55
|
+
color: var(--astl-ink-muted);
|
|
56
|
+
font-size: var(--astl-size-ui);
|
|
57
|
+
}
|
|
58
|
+
`,n`
|
|
59
|
+
.field {
|
|
60
|
+
overflow-x: auto;
|
|
61
|
+
background:
|
|
62
|
+
linear-gradient(to right, var(--astl-surface) 40%, transparent) left / 2rem 100% no-repeat local,
|
|
63
|
+
linear-gradient(to left, var(--astl-surface) 40%, transparent) right / 2rem 100% no-repeat local,
|
|
64
|
+
radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)
|
|
65
|
+
left / 0.75rem 100% no-repeat scroll,
|
|
66
|
+
radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--astl-ink) 35%, transparent), transparent)
|
|
67
|
+
right / 0.75rem 100% no-repeat scroll;
|
|
68
|
+
scrollbar-color: var(--astl-outline) transparent;
|
|
69
|
+
}
|
|
70
|
+
`,n`
|
|
71
|
+
@media (forced-colors: active) {
|
|
72
|
+
.cell[data-first] {
|
|
73
|
+
outline: var(--astl-focus-width) solid var(--astl-selected);
|
|
74
|
+
outline-offset: calc(-1 * var(--astl-focus-width));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
`,n`
|
|
78
|
+
.grid {
|
|
79
|
+
position: relative;
|
|
80
|
+
}
|
|
81
|
+
.lines {
|
|
82
|
+
position: absolute;
|
|
83
|
+
inset: var(--astl-ws-edge);
|
|
84
|
+
inline-size: calc(100% - 2 * var(--astl-ws-edge));
|
|
85
|
+
block-size: calc(100% - 2 * var(--astl-ws-edge));
|
|
86
|
+
overflow: visible;
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
forced-color-adjust: none;
|
|
89
|
+
}
|
|
90
|
+
.lines line {
|
|
91
|
+
stroke: var(--astl-ws-ink);
|
|
92
|
+
stroke-width: 0.76;
|
|
93
|
+
stroke-linecap: round;
|
|
94
|
+
}
|
|
95
|
+
.lines .fill {
|
|
96
|
+
stroke: var(--astl-ws-soft);
|
|
97
|
+
stroke-width: 0.6;
|
|
98
|
+
}
|
|
99
|
+
.lines .draft {
|
|
100
|
+
stroke: var(--astl-selected);
|
|
101
|
+
}
|
|
102
|
+
.lines .draft.fill {
|
|
103
|
+
stroke: var(--astl-selected-soft);
|
|
104
|
+
}
|
|
105
|
+
.lines circle {
|
|
106
|
+
fill: var(--astl-success-soft);
|
|
107
|
+
stroke: var(--astl-success);
|
|
108
|
+
stroke-width: 0.08;
|
|
109
|
+
}
|
|
110
|
+
`,n`
|
|
111
|
+
.words {
|
|
112
|
+
flex: 1 1 12rem;
|
|
113
|
+
display: grid;
|
|
114
|
+
grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr));
|
|
115
|
+
gap: var(--astl-space-2);
|
|
116
|
+
margin: 0;
|
|
117
|
+
padding: 0;
|
|
118
|
+
list-style: none;
|
|
119
|
+
}
|
|
120
|
+
.entry {
|
|
121
|
+
position: relative;
|
|
122
|
+
box-sizing: border-box;
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-wrap: wrap;
|
|
125
|
+
align-items: center;
|
|
126
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
127
|
+
border-radius: var(--astl-radius-m);
|
|
128
|
+
background: var(--astl-surface);
|
|
129
|
+
overflow: clip;
|
|
130
|
+
}
|
|
131
|
+
.entry:has(> [data-clue], > .astl-solution) {
|
|
132
|
+
grid-column: 1 / -1;
|
|
133
|
+
}
|
|
134
|
+
.entry > button {
|
|
135
|
+
flex: 1 1 auto;
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: var(--astl-space-2);
|
|
139
|
+
min-inline-size: var(--astl-target-min);
|
|
140
|
+
min-block-size: var(--astl-target-min);
|
|
141
|
+
margin: 0;
|
|
142
|
+
padding-block: var(--astl-space-1);
|
|
143
|
+
padding-inline: var(--astl-space-3);
|
|
144
|
+
border: 0;
|
|
145
|
+
background: none;
|
|
146
|
+
color: inherit;
|
|
147
|
+
font: inherit;
|
|
148
|
+
text-align: start;
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
}
|
|
151
|
+
.entry > button:disabled {
|
|
152
|
+
cursor: default;
|
|
153
|
+
}
|
|
154
|
+
.text {
|
|
155
|
+
min-inline-size: 0;
|
|
156
|
+
overflow-wrap: anywhere;
|
|
157
|
+
hyphens: auto;
|
|
158
|
+
}
|
|
159
|
+
.sign {
|
|
160
|
+
flex: none;
|
|
161
|
+
display: inline-flex;
|
|
162
|
+
inline-size: 1.1em;
|
|
163
|
+
color: var(--astl-ws-ink);
|
|
164
|
+
}
|
|
165
|
+
.sign > svg {
|
|
166
|
+
inline-size: 1.1em;
|
|
167
|
+
block-size: 1.1em;
|
|
168
|
+
}
|
|
169
|
+
.entry[data-marked] {
|
|
170
|
+
background: var(--astl-ws-soft);
|
|
171
|
+
}
|
|
172
|
+
.entry[data-picked] {
|
|
173
|
+
border-color: var(--astl-selected);
|
|
174
|
+
background: var(--astl-selected-soft);
|
|
175
|
+
font-weight: var(--astl-selected-weight);
|
|
176
|
+
}
|
|
177
|
+
.entry[data-picked]::before {
|
|
178
|
+
content: '';
|
|
179
|
+
position: absolute;
|
|
180
|
+
inset-block: 0;
|
|
181
|
+
inset-inline-start: 0;
|
|
182
|
+
inline-size: var(--astl-selected-bar);
|
|
183
|
+
background: var(--astl-selected);
|
|
184
|
+
}
|
|
185
|
+
.entry > .astl-verdict {
|
|
186
|
+
margin-inline-start: auto;
|
|
187
|
+
padding-inline-end: var(--astl-space-3);
|
|
188
|
+
}
|
|
189
|
+
.entry > .astl-solution {
|
|
190
|
+
flex-basis: 100%;
|
|
191
|
+
padding-inline: var(--astl-space-3);
|
|
192
|
+
padding-block-end: var(--astl-space-2);
|
|
193
|
+
}
|
|
194
|
+
.group-verdict {
|
|
195
|
+
margin-block: var(--astl-space-3) 0;
|
|
196
|
+
}
|
|
197
|
+
`,t(Array.from({length:8},(e,t)=>`[data-palette='${t+1}']{--astl-ws-ink:var(--astl-palette-${t+1});--astl-ws-soft:var(--astl-palette-${t+1}-soft)}`).join(``)),_];#e=null;#t={value:``,rows:[]};#n;constructor(){super(),this.lines=new Map,this.anchor=null,this.clue=null,this.status=``;let e=this;this.#n=new g(this,{count:()=>this.#s**2,item:e=>this.renderRoot.querySelector(`[data-cell="${e}"]`),axis:`grid`,get columns(){return e.#s}})}get slotIds(){return this.#c.map(e=>e.id)}getAnswers(){return Object.fromEntries(this.lines)}setAnswers(e){let t=new Map(this.lines);for(let n of this.#c){let r=e[n.id];if(r===void 0)continue;t.delete(n.id);let i=m(r),a=i===null?null:f(i[0],i[1],this.#s);a!==null&&(n.clue||this.#f(a,n.letters))&&t.set(n.id,r)}this.lines=t,this.anchor=null,this.clue=null,this.status=``}units(){return{answered:this.lines.size,total:this.#c.length}}render(){let t=this.uiLanguage,n=this.#o,r=n.length,a=this.#c,s=this.#e?.from??this.anchor,c=new Set([...this.lines.values()].flatMap(e=>this.#u(e).map(([e,t])=>e*r+t))),l=this.groupVerdict;return e`<fieldset part="word-search">
|
|
198
|
+
<legend part="prompt">
|
|
199
|
+
<slot class="prompt-slot"></slot>
|
|
200
|
+
<span class="hint" lang=${t.lang} dir=${t.dir}>${this.#T(`ui.hint`)}</span>
|
|
201
|
+
</legend>
|
|
202
|
+
<div class="board">
|
|
203
|
+
<div class="field">
|
|
204
|
+
<div class="paper">
|
|
205
|
+
<svg class="lines" part="line" viewBox="0 0 ${r} ${r}" preserveAspectRatio="none" aria-hidden="true" focusable="false">
|
|
206
|
+
${this.#a()}
|
|
207
|
+
</svg>
|
|
208
|
+
<div
|
|
209
|
+
class="grid"
|
|
210
|
+
part="grid"
|
|
211
|
+
role="grid"
|
|
212
|
+
lang=${t.lang}
|
|
213
|
+
aria-label=${this.t(`ui.grid`,{size:r})}
|
|
214
|
+
aria-describedby="instructions"
|
|
215
|
+
aria-disabled=${this.disabled?`true`:i}
|
|
216
|
+
tabindex=${this.disabled?`0`:i}
|
|
217
|
+
@pointerdown=${this.#h}
|
|
218
|
+
@pointermove=${this.#g}
|
|
219
|
+
@pointerup=${this.#_}
|
|
220
|
+
@pointercancel=${this.#v}
|
|
221
|
+
@lostpointercapture=${this.#v}
|
|
222
|
+
@keydown=${this.#y}
|
|
223
|
+
>
|
|
224
|
+
${n.map((t,n)=>e`<div class="row" role="row">
|
|
225
|
+
${t.map((t,a)=>{let o=n*r+a,l=s!==null&&S(s,[n,a])?`first`:c.has(o)?`marked`:`other`;return e`<div
|
|
226
|
+
class="cell"
|
|
227
|
+
part="cell"
|
|
228
|
+
role="gridcell"
|
|
229
|
+
data-cell=${o}
|
|
230
|
+
tabindex=${this.disabled?i:this.#n.tabIndex(o)}
|
|
231
|
+
aria-label=${this.t(`ui.cell`,{letter:t,row:n+1,column:a+1,state:l})}
|
|
232
|
+
?data-first=${l===`first`}
|
|
233
|
+
>${t}</div>`})}
|
|
234
|
+
</div>`)}
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
<p class="status" part="status" lang=${t.lang} dir=${t.dir} ?hidden=${this.status===``}>${this.status}</p>
|
|
238
|
+
</div>
|
|
239
|
+
<ul class="words" part="words" role="list" aria-label=${this.t(`ui.words`)}>
|
|
240
|
+
${a.map((e,t)=>this.#r(e,t))}
|
|
241
|
+
</ul>
|
|
242
|
+
</div>
|
|
243
|
+
<span class="astl-vh" id="instructions" lang=${t.lang} dir=${t.dir}>${this.t(`ui.instructions`)}</span>
|
|
244
|
+
<span class="astl-vh" id="list-help" lang=${t.lang} dir=${t.dir}>${this.t(`ui.listHelp`)}</span>
|
|
245
|
+
${l===null?i:e`<p class="group-verdict" part="verdict" data-verdict=${l}>${o(l,(e,t)=>this.t(e,t),t)}</p>`}
|
|
246
|
+
</fieldset>`}#r(t,n){let r=this.uiLanguage,a=this.lines.get(t.id),s=Object.keys(this.feedback?.slots??{}).length>0,l=(a===void 0?s?`empty`:null:this.slotVerdict(t.id))??void 0,u=this.solution?.[t.id],d=u===void 0||a!==void 0&&C(a,u)?null:u,f=t.clue?a?`ui.marked`:`ui.notMarked`:a?`ui.found`:`ui.notFound`,p=[l&&`verdict-${n}`,d&&`solution-${n}`,this.disabled?``:`list-help`];return e`<li
|
|
247
|
+
class="entry astl-box astl-ring"
|
|
248
|
+
part="word"
|
|
249
|
+
data-item=${t.id}
|
|
250
|
+
data-palette=${c(a===void 0?void 0:n%8+1)}
|
|
251
|
+
data-verdict=${c(l)}
|
|
252
|
+
?data-marked=${a!==void 0}
|
|
253
|
+
?data-picked=${this.clue===t.id}
|
|
254
|
+
>
|
|
255
|
+
<button
|
|
256
|
+
type="button"
|
|
257
|
+
data-item=${t.id}
|
|
258
|
+
?data-clue=${t.clue}
|
|
259
|
+
aria-pressed=${t.clue?String(this.clue===t.id):i}
|
|
260
|
+
aria-describedby=${p.filter(Boolean).join(` `)||i}
|
|
261
|
+
?disabled=${this.disabled}
|
|
262
|
+
@click=${()=>this.#S(t)}
|
|
263
|
+
>
|
|
264
|
+
<span class="sign" aria-hidden="true"
|
|
265
|
+
>${a===void 0?i:e`<svg viewBox="0 0 20 20">${w}</svg>`}</span
|
|
266
|
+
><span class="text"><slot data-item=${t.id}></slot></span
|
|
267
|
+
><span class="astl-vh" lang=${r.lang} dir=${r.dir}>, ${this.t(f)}</span>
|
|
268
|
+
</button>
|
|
269
|
+
${l===void 0?i:o(l,(e,t)=>this.t(e,t),{hiddenWord:!0,id:`verdict-${n}`,part:`verdict`,...r})}
|
|
270
|
+
${d===null?i:this.#i(d,n,t.clue)}
|
|
271
|
+
</li>`}#i(t,n,r){let i=this.uiLanguage,[[o,s],[c,l]]=m(t),u={clue:r?`yes`:`no`,word:this.#d(this.#u(t)),fromRow:o+1,fromColumn:s+1,toRow:c+1,toColumn:l+1};return e`<p class="astl-solution" part="solution" id="solution-${n}" data-span=${t} lang=${i.lang} dir=${i.dir}
|
|
272
|
+
>${a(`correct`)}<span class="astl-solution-label">${this.t(`ui.solution`,u)}</span></p
|
|
273
|
+
>`}#a(){let e=(e,t,n,a)=>{let o=m(e);if(o===null)return i;let[[s,l],[u,d]]=o,f={x1:l+.5,y1:s+.5,x2:d+.5,y2:u+.5};return r`<line class=${t} data-span=${e} data-item=${c(n)} data-palette=${c(a)} x1=${f.x1} y1=${f.y1} x2=${f.x2} y2=${f.y2}></line><line class="${t} fill" data-palette=${c(a)} x1=${f.x1} y1=${f.y1} x2=${f.x2} y2=${f.y2}></line>`},t=e=>r`<g class="solution" data-span=${e}>${this.#u(e).map(([e,t])=>r`<circle cx=${t+.5} cy=${e+.5} r="0.4"></circle>`)}</g>`,n=this.#c,a=this.#e,o=this.#l(this.#n.active),s=a?.from??this.anchor,l=a?.to??o,u=s!==null&&f(s,l,this.#s)!==null?h(s,l):null;return r`${n.map((t,n)=>{let r=this.lines.get(t.id);return r===void 0?i:e(r,`found`,t.id,n%8+1)})}${n.map(e=>{let n=this.solution?.[e.id],r=this.lines.get(e.id);return n===void 0||r!==void 0&&C(r,n)?i:t(n)})}${u===null?i:e(u,`draft`)}`}updated(){let e=this.renderRoot,t=Array.from(this.children).find(e=>e.localName===`astl-prompt`);e.querySelector(`slot.prompt-slot`)?.assign(...t?[t]:[]);let n=new Map(this.#c.map(e=>[e.id,e.el]));for(let t of e.querySelectorAll(`slot[data-item]`)){let e=n.get(t.dataset.item??``);t.assign(...e?[e]:[])}e.querySelector(`.board`)?.style.setProperty(`--astl-ws-size`,`${this.#s}`)}get#o(){let e=this.getAttribute(`grid`)??``;return e!==this.#t.value&&(this.#t={value:e,rows:e.split(` `).filter(e=>e!==``).map(e=>[...e])}),this.#t.rows}get#s(){return this.#o.length}get#c(){return Array.from(this.children).filter(e=>e.localName===`astl-search-word`&&e.id!==``).map(e=>{let t=e.hasAttribute(`clue`);return{id:e.id,el:e,clue:t,letters:t?``:b(e)}})}#l(e){let t=Math.max(1,this.#s);return[Math.floor(e/t),e%t]}#u(e){let t=m(e);return(t===null?null:f(t[0],t[1],this.#s))??[]}#d(e){return e.map(([e,t])=>this.#o[e]?.[t]??``).join(``)}#f(e,t){let n=this.#d(e);return t!==``&&(n===t||[...n].reverse().join(``)===t)}#p(e,t=!1){let n=e.currentTarget.getBoundingClientRect(),r=this.#s,i=Math.floor((e.clientY-n.top)/n.height*r),a=Math.floor((e.clientX-n.left)/n.width*r),o=e=>e>=0&&e<r;if(!t&&!(o(i)&&o(a)))return null;let s=e=>Math.min(Math.max(e,0),r-1);return[s(i),s(a)]}#m(e,t){let n=t[0]-e[0],r=t[1]-e[1],[i,a]=[Math.abs(n),Math.abs(r)],o=i*2<a?[0,Math.sign(r)]:a*2<i?[Math.sign(n),0]:[Math.sign(n),Math.sign(r)],s=o[0]!==0&&o[1]!==0?Math.round((i+a)/2):Math.max(i,a),c=this.#s-1,l=t=>[e[0]+o[0]*t,e[1]+o[1]*t].every(e=>e>=0&&e<=c);for(;s>0&&!l(s);)s--;return[e[0]+o[0]*s,e[1]+o[1]*s]}#h(e){if(this.disabled||e.button!==0||!e.isPrimary)return;let t=this.#p(e);t!==null&&(e.currentTarget.setPointerCapture(e.pointerId),this.#e={pointer:e.pointerId,from:t,to:t},this.#n.focus(t[0]*this.#s+t[1]))}#g(e){let t=this.#e;if(t===null||e.pointerId!==t.pointer)return;let n=this.#m(t.from,this.#p(e,!0));S(n,t.to)||(this.#e={...t,to:n},this.requestUpdate())}#_(e){let t=this.#e;t!==null&&e.pointerId===t.pointer&&(this.#e=null,S(t.from,t.to)?this.#b(t.from):(this.anchor=null,this.#x(t.from,t.to)),this.requestUpdate())}#v(e){this.#e?.pointer===e.pointerId&&(this.#e=null,this.requestUpdate())}#y(e){this.disabled||(e.key===`Enter`||e.key===` `?(e.preventDefault(),e.repeat||this.#b(this.#l(this.#n.active))):e.key===`Escape`&&(this.anchor!==null||this.clue!==null)?(e.preventDefault(),this.anchor===null?this.clue=null:this.anchor=null,this.#E(`cancel`)):this.#n.keydown(e))}#b(e){let t=this.anchor;if(t===null){this.anchor=e;let t=this.#d([e]);this.#E(`first`,{letter:t,row:e[0]+1,column:e[1]+1})}else S(t,e)?(this.anchor=null,this.#E(`cancel`)):(this.anchor=null,this.#x(t,e))}#x(e,t){let n=f(e,t,this.#s);if(n===null){this.#E(`notStraight`);return}let r=h(e,t),i=this.#c,a=i.find(e=>e.id===this.clue);if(a!==void 0){this.clue=null,this.#C(a.id,r),this.#E(`saved`,{clue:x(a.el),...this.#w()});return}let o=i.find(e=>!e.clue&&this.#f(n,e.letters));o===void 0?this.#E(`none`,{letters:this.#d(n)}):this.lines.has(o.id)?this.#E(`again`,{word:o.letters}):(this.#C(o.id,r),this.#E(`found`,{word:o.letters,...this.#w()}))}#S(e){this.disabled||(this.lines.has(e.id)?(this.#C(e.id,``),this.#E(`released`,{word:e.clue?x(e.el):e.letters,...this.#w()})):e.clue?this.clue===e.id?(this.clue=null,this.#E(`cancel`)):(this.clue=e.id,this.anchor=null,this.#E(`clue`,{clue:x(e.el)}),this.#n.focus(this.#n.active)):this.#E(`find`,{word:e.letters}))}#C(e,t){let n=new Map(this.lines);t===``?n.delete(e):n.set(e,t),this.lines=n,this.emitChange({[e]:t})}#w(){return{count:this.lines.size,total:this.#c.length}}#T(e,t){let n=this.t(e,t);return this.#c.some(e=>e.clue)?`${n} ${this.t(`ui.hintClues`)}`:n}#E(e,t){this.status=e===`none`?this.#T(`ui.status.none`,t):this.t(`ui.status.${e}`,t),this.announce(this.status)}},E={manifest:p,element:T,messages:y};export{E as wordSearchElement};
|
|
274
|
+
//# sourceMappingURL=word-search-AHvM7yCJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"word-search-AHvM7yCJ.js","names":["en","pl","LitElement","unsafeCSS","nothing","ifDefined","b","r","i$1","w","A","verdictIcon","renderVerdict","AstlElement","o","i","en_default","pl_default","lineCells","wordSearchManifest","parseSpan","formatSpan","RovingFocus","blockStyles","namespace","wordSearchUiMessages","textOf","el","nameOf","img","same","a","sameLine","ends","MARKED","WordSearchElement","element","#roving","#size","#entries","entry","next","span","answers","cells","#spells","ui","rows","#rows","size","entries","first","#press","marked","#cells","c","group","#withClues","#strokes","#down","#move","#up","#lost","#keydown","row","state","letter","#renderEntry","key","params","line","verdict","correct","solution","refs","#pressEntry","#renderSolution","fromRow","fromColumn","toRow","toColumn","clue","#letters","r1","c1","r2","c2","ends2","kind","palette","dots","press","active","#cellOf","from","to","draft","root","prompt","child","items","slot","item","value","#grid","index","letters","word","box","event","column","inside","n","clamp","fit","dr","dc","ar","ac","step","last","k","v","cell","#hit","#snap","#tap","#complete","#say","anchor","#set","#progress","id","message","wordSearchElement"],"sources":["../../../../components/src/word-search/ui-messages.ts","../../../../components/src/word-search/element.ts"],"sourcesContent":["import type { MessageCatalog } from '@astl/core';\nimport en from './messages/ui/en.json' with { type: 'json' };\nimport pl from './messages/ui/pl.json' with { type: 'json' };\n\nconst namespace = 'astl.word-search';\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 `wordSearchMessages` would put the authoring strings into the element's chunk.\n */\nexport const wordSearchUiMessages: readonly MessageCatalog[] = [\n { namespace, locale: 'en', messages: en },\n { namespace, locale: 'pl', messages: pl },\n];\n","import type { Answers, ComponentManifest, MessageCatalog, MessageParams, Units } from '@astl/core';\nimport { AstlElement, type ElementRegistration, renderVerdict, verdictIcon } from '@astl/player';\nimport { RovingFocus } from '@astl/player/interaction';\nimport {\n type CSSResultGroup,\n css,\n html,\n LitElement,\n nothing,\n type PropertyDeclarations,\n svg,\n type TemplateResult,\n unsafeCSS,\n} from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { blockStyles } from '../block-styles.js';\nimport { wordSearchManifest } from './manifest.js';\nimport { type Cell, formatSpan, lineCells, parseSpan } from './span.js';\nimport { wordSearchUiMessages } from './ui-messages.js';\n\n/** An entry of the list: a word to find (its letters are in the view) or a clue (its word is not). */\ninterface Entry {\n readonly id: string;\n readonly el: HTMLElement;\n readonly clue: boolean;\n readonly letters: string;\n}\n\n/** A press on the grid: a tap while it stays on its first cell, else a drag to `to`. */\ninterface Press {\n readonly pointer: number;\n readonly from: Cell;\n readonly to: Cell;\n}\n\nconst textOf = (el: Element): string => (el.textContent ?? '').replace(/\\s+/g, ' ').trim();\n/** What an entry is called in messages: its text, else the alt text of its pictures. */\nconst nameOf = (el: Element): string =>\n textOf(el) ||\n [...el.querySelectorAll('img')]\n .map((img) => img.alt)\n .join(' ')\n .trim();\nconst same = (a: Cell, b: Cell): boolean => a[0] === b[0] && a[1] === b[1];\n/** Whether two spans cover the same line, either way. */\nfunction sameLine(a: string, b: string): boolean {\n const ends = parseSpan(b);\n return a === b || (ends !== null && a === formatSpan(ends[1], ends[0]));\n}\n\nconst MARKED = svg`<path d=\"M4 10h12\" stroke=\"currentColor\" stroke-width=\"6\" stroke-linecap=\"round\"/>`;\n\n/**\n * `<astl-word-search>`: a grid of letters (the view's `grid`) and a list of entries, the light-DOM `<astl-search-word>`\n * children (slotted manually, never moved or changed). Slots: one per entry (its id), answered with the span of a\n * line, `r2c3-r2c5`.\n * - The grid is an ARIA grid with one tab stop (`RovingFocus`); a line goes from a first to a last letter: a drag\n * (pointer capture: mouse, touch, pen; snapped to the nearest of the 8 directions), two taps, or Enter / Space twice\n * on the keyboard. Escape cancels.\n * - A line is matched against the listed words not yet found; with a clue pressed first, it is saved for that clue\n * without a check. Found words and marked clues take a stroke in their palette slot; pressing them releases it.\n * - Messages show in a status line and go to the player's live region.\n */\nexport class WordSearchElement extends AstlElement {\n static override manifest: ComponentManifest = wordSearchManifest;\n static override messages: readonly MessageCatalog[] = wordSearchUiMessages;\n static override shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n slotAssignment: 'manual',\n };\n\n static override properties: PropertyDeclarations = {\n lines: { state: true },\n anchor: { state: true },\n clue: { state: true },\n status: { state: true },\n };\n\n static override styles: CSSResultGroup = [\n // The grid gets up to 44px a letter and shrinks with the room it has (a container), down to 24 px a letter (the\n // WCAG 2.5.8 minimum target: letters touch, so each must be the minimum itself); a wider grid scrolls sideways in\n // its field, with a cue (below). The list sits beside it when there is room, else below. The field clips what it\n // scrolls, so a letter keeps room around it as wide as a focus ring reaches: the paper's padding at the edges of\n // the grid, its scroll margin when it is scrolled into view (the ring shows whole, and the next letter in part, so\n // a step scrolls one column: focus() centres a letter it finds wholly hidden).\n css`\n .board {\n --astl-ws-edge: calc(var(--astl-focus-width) + var(--astl-focus-offset));\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-ws-size) * var(--astl-target-min) + 2 * var(--astl-ws-edge));\n min-inline-size: 0;\n container-type: inline-size;\n }\n .paper {\n --astl-ws-cell: clamp(1.5rem, (100cqi - 2 * var(--astl-ws-edge)) / var(--astl-ws-size), var(--astl-target-min));\n position: relative;\n inline-size: calc(var(--astl-ws-cell) * var(--astl-ws-size));\n padding: var(--astl-ws-edge);\n }\n .grid {\n display: flex;\n flex-direction: column;\n touch-action: none;\n user-select: none;\n -webkit-user-select: none;\n -webkit-touch-callout: none;\n }\n .row {\n display: flex;\n }\n .cell {\n box-sizing: border-box;\n display: grid;\n place-items: center;\n flex: none;\n inline-size: var(--astl-ws-cell);\n block-size: var(--astl-ws-cell);\n font-family: var(--astl-font-mono);\n font-size: max(var(--astl-size-small), calc(var(--astl-ws-cell) * 0.55));\n font-weight: 600;\n line-height: 1;\n cursor: pointer;\n scroll-margin: var(--astl-ws-edge);\n }\n .grid[aria-disabled] .cell {\n cursor: default;\n }\n .cell[data-first] {\n border-radius: var(--astl-radius-m);\n box-shadow: inset 0 0 0 var(--astl-focus-width) var(--astl-selected);\n font-weight: 800;\n }\n .status {\n margin-block: var(--astl-space-2) 0;\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-ui);\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 // Forced colours drop box shadows: the first letter gets an outline there (a focus ring wins over it).\n css`\n @media (forced-colors: active) {\n .cell[data-first] {\n outline: var(--astl-focus-width) solid var(--astl-selected);\n outline-offset: calc(-1 * var(--astl-focus-width));\n }\n }\n `,\n // Strokes lie on the grid (inside the paper's padding) and under the letters, in grid units (one cell = 1): a found\n // word or a marked clue is a loop around its letters, an edge in its palette slot (3:1 on the page in every theme)\n // round a fill of that slot's soft colour (the letters read on it); the line being made the same in the selection\n // colour; a solution a ring in the success colour behind each letter. Under, because the grid is positioned too and\n // comes after them: positioned boxes paint after in-flow ones, and among themselves in tree order (CSS 2.1,\n // appendix E). The cells have no fill, so the strokes show through.\n css`\n .grid {\n position: relative;\n }\n .lines {\n position: absolute;\n inset: var(--astl-ws-edge);\n inline-size: calc(100% - 2 * var(--astl-ws-edge));\n block-size: calc(100% - 2 * var(--astl-ws-edge));\n overflow: visible;\n pointer-events: none;\n forced-color-adjust: none;\n }\n .lines line {\n stroke: var(--astl-ws-ink);\n stroke-width: 0.76;\n stroke-linecap: round;\n }\n .lines .fill {\n stroke: var(--astl-ws-soft);\n stroke-width: 0.6;\n }\n .lines .draft {\n stroke: var(--astl-selected);\n }\n .lines .draft.fill {\n stroke: var(--astl-selected-soft);\n }\n .lines circle {\n fill: var(--astl-success-soft);\n stroke: var(--astl-success);\n stroke-width: 0.08;\n }\n `,\n css`\n .words {\n flex: 1 1 12rem;\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr));\n gap: var(--astl-space-2);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n .entry {\n position: relative;\n box-sizing: border-box;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n overflow: clip;\n }\n .entry:has(> [data-clue], > .astl-solution) {\n grid-column: 1 / -1;\n }\n .entry > button {\n flex: 1 1 auto;\n display: flex;\n align-items: center;\n gap: var(--astl-space-2);\n min-inline-size: var(--astl-target-min);\n min-block-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-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 > button:disabled {\n cursor: default;\n }\n .text {\n min-inline-size: 0;\n overflow-wrap: anywhere;\n hyphens: auto;\n }\n .sign {\n flex: none;\n display: inline-flex;\n inline-size: 1.1em;\n color: var(--astl-ws-ink);\n }\n .sign > svg {\n inline-size: 1.1em;\n block-size: 1.1em;\n }\n .entry[data-marked] {\n background: var(--astl-ws-soft);\n }\n .entry[data-picked] {\n border-color: var(--astl-selected);\n background: var(--astl-selected-soft);\n font-weight: var(--astl-selected-weight);\n }\n .entry[data-picked]::before {\n content: '';\n position: absolute;\n inset-block: 0;\n inset-inline-start: 0;\n inline-size: var(--astl-selected-bar);\n background: var(--astl-selected);\n }\n .entry > .astl-verdict {\n margin-inline-start: auto;\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 // Palette slots through an attribute: a strict Content Security Policy blocks inline style attributes.\n unsafeCSS(\n Array.from(\n { length: 8 },\n (_, i) =>\n `[data-palette='${i + 1}']{--astl-ws-ink:var(--astl-palette-${i + 1});--astl-ws-soft:var(--astl-palette-${i + 1}-soft)}`,\n ).join(''),\n ),\n blockStyles,\n ];\n\n /** Entry id to the span of its line. */\n declare protected lines: ReadonlyMap<string, string>;\n /** The first letter of a line being made with taps or the keyboard. */\n declare protected anchor: Cell | null;\n /** The clue pressed: the next line is saved for it. */\n declare protected clue: string | null;\n declare protected status: string;\n #press: Press | null = null;\n #grid: { readonly value: string; readonly rows: readonly (readonly string[])[] } = { value: '', rows: [] };\n readonly #roving: RovingFocus;\n\n constructor() {\n super();\n this.lines = new Map();\n this.anchor = null;\n this.clue = null;\n this.status = '';\n const element = this;\n this.#roving = new RovingFocus(this, {\n count: () => this.#size ** 2,\n item: (i) => this.renderRoot.querySelector<HTMLElement>(`[data-cell=\"${i}\"]`),\n axis: 'grid',\n get columns() {\n return element.#size;\n },\n });\n }\n\n get slotIds(): readonly string[] {\n return this.#entries.map((entry) => entry.id);\n }\n\n getAnswers(): Answers {\n return Object.fromEntries(this.lines);\n }\n\n /** Spans the element can show: a straight line in the grid, for a listed word one that spells it. */\n setAnswers(answers: Answers): void {\n const next = new Map(this.lines);\n for (const entry of this.#entries) {\n const span = answers[entry.id];\n if (span === undefined) continue;\n next.delete(entry.id);\n const ends = parseSpan(span);\n const cells = ends === null ? null : lineCells(ends[0], ends[1], this.#size);\n if (cells !== null && (entry.clue || this.#spells(cells, entry.letters))) next.set(entry.id, span);\n }\n this.lines = next;\n this.anchor = null;\n this.clue = null;\n this.status = '';\n }\n\n units(): Units {\n return { answered: this.lines.size, total: this.#entries.length };\n }\n\n protected override render(): TemplateResult {\n const ui = this.uiLanguage;\n const rows = this.#rows;\n const size = rows.length;\n const entries = this.#entries;\n const first = this.#press?.from ?? this.anchor;\n const marked = new Set(\n [...this.lines.values()].flatMap((span) => this.#cells(span).map(([r, c]) => r * size + c)),\n );\n const group = this.groupVerdict;\n const say = (key: string, params?: MessageParams) => this.t(key, params);\n return html`<fieldset part=\"word-search\">\n <legend part=\"prompt\">\n <slot class=\"prompt-slot\"></slot>\n <span class=\"hint\" lang=${ui.lang} dir=${ui.dir}>${this.#withClues('ui.hint')}</span>\n </legend>\n <div class=\"board\">\n <div class=\"field\">\n <div class=\"paper\">\n <svg class=\"lines\" part=\"line\" viewBox=\"0 0 ${size} ${size}\" preserveAspectRatio=\"none\" aria-hidden=\"true\" focusable=\"false\">\n ${this.#strokes()}\n </svg>\n <div\n class=\"grid\"\n part=\"grid\"\n role=\"grid\"\n lang=${ui.lang}\n aria-label=${this.t('ui.grid', { size })}\n aria-describedby=\"instructions\"\n aria-disabled=${this.disabled ? 'true' : nothing}\n tabindex=${this.disabled ? '0' : nothing}\n @pointerdown=${this.#down}\n @pointermove=${this.#move}\n @pointerup=${this.#up}\n @pointercancel=${this.#lost}\n @lostpointercapture=${this.#lost}\n @keydown=${this.#keydown}\n >\n ${rows.map(\n (row, r) => html`<div class=\"row\" role=\"row\">\n ${row.map((letter, c) => {\n const i = r * size + c;\n const state =\n first !== null && same(first, [r, c]) ? 'first' : marked.has(i) ? 'marked' : 'other';\n return html`<div\n class=\"cell\"\n part=\"cell\"\n role=\"gridcell\"\n data-cell=${i}\n tabindex=${this.disabled ? nothing : this.#roving.tabIndex(i)}\n aria-label=${this.t('ui.cell', { letter, row: r + 1, column: c + 1, state })}\n ?data-first=${state === 'first'}\n >${letter}</div>`;\n })}\n </div>`,\n )}\n </div>\n </div>\n <p class=\"status\" part=\"status\" lang=${ui.lang} dir=${ui.dir} ?hidden=${this.status === ''}>${this.status}</p>\n </div>\n <ul class=\"words\" part=\"words\" role=\"list\" aria-label=${this.t('ui.words')}>\n ${entries.map((entry, i) => this.#renderEntry(entry, i))}\n </ul>\n </div>\n <span class=\"astl-vh\" id=\"instructions\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.instructions')}</span>\n <span class=\"astl-vh\" id=\"list-help\" lang=${ui.lang} dir=${ui.dir}>${this.t('ui.listHelp')}</span>\n ${\n group === null\n ? nothing\n : html`<p class=\"group-verdict\" part=\"verdict\" data-verdict=${group}>${renderVerdict(group, say, ui)}</p>`\n }\n </fieldset>`;\n }\n\n #renderEntry(entry: Entry, i: number): TemplateResult {\n const ui = this.uiLanguage;\n const line = this.lines.get(entry.id);\n // Marked one by one, a word not found shows \"no answer\" (dotted), as in every type.\n const marked = Object.keys(this.feedback?.slots ?? {}).length > 0;\n const verdict =\n (line === undefined ? (marked ? 'empty' : null) : this.slotVerdict(entry.id)) ?? undefined;\n const correct = this.solution?.[entry.id];\n const solution =\n correct === undefined || (line !== undefined && sameLine(line, correct)) ? null : correct;\n const state = entry.clue ? (line ? 'ui.marked' : 'ui.notMarked') : line ? 'ui.found' : 'ui.notFound';\n const refs = [verdict && `verdict-${i}`, solution && `solution-${i}`, this.disabled ? '' : 'list-help'];\n return html`<li\n class=\"entry astl-box astl-ring\"\n part=\"word\"\n data-item=${entry.id}\n data-palette=${ifDefined(line === undefined ? undefined : (i % 8) + 1)}\n data-verdict=${ifDefined(verdict)}\n ?data-marked=${line !== undefined}\n ?data-picked=${this.clue === entry.id}\n >\n <button\n type=\"button\"\n data-item=${entry.id}\n ?data-clue=${entry.clue}\n aria-pressed=${entry.clue ? String(this.clue === entry.id) : nothing}\n aria-describedby=${refs.filter(Boolean).join(' ') || nothing}\n ?disabled=${this.disabled}\n @click=${() => this.#pressEntry(entry)}\n >\n <span class=\"sign\" aria-hidden=\"true\"\n >${line === undefined ? nothing : html`<svg viewBox=\"0 0 20 20\">${MARKED}</svg>`}</span\n ><span class=\"text\"><slot data-item=${entry.id}></slot></span\n ><span class=\"astl-vh\" lang=${ui.lang} dir=${ui.dir}>, ${this.t(state)}</span>\n </button>\n ${\n verdict === undefined\n ? nothing\n : renderVerdict(verdict, (key, params) => this.t(key, params), {\n hiddenWord: true,\n id: `verdict-${i}`,\n part: 'verdict',\n ...ui,\n })\n }\n ${solution === null ? nothing : this.#renderSolution(solution, i, entry.clue)}\n </li>`;\n }\n\n /** \"Correct answer: KOT, row 2, column 3 to row 2, column 5\": where the word is, and for a clue the word itself. */\n #renderSolution(span: string, i: number, clue: boolean): TemplateResult {\n const ui = this.uiLanguage;\n const [[fromRow, fromColumn], [toRow, toColumn]] = parseSpan(span) as readonly [Cell, Cell];\n const params = {\n clue: clue ? 'yes' : 'no',\n word: this.#letters(this.#cells(span)),\n fromRow: fromRow + 1,\n fromColumn: fromColumn + 1,\n toRow: toRow + 1,\n toColumn: toColumn + 1,\n };\n return html`<p class=\"astl-solution\" part=\"solution\" id=\"solution-${i}\" data-span=${span} lang=${ui.lang} dir=${ui.dir}\n >${verdictIcon('correct')}<span class=\"astl-solution-label\">${this.t('ui.solution', params)}</span></p\n >`;\n }\n\n /** Saved lines, the solutions not shown by them, then the line being made. */\n #strokes(): TemplateResult {\n const line = (span: string, kind: string, entry?: string, palette?: number) => {\n const ends = parseSpan(span);\n if (ends === null) return nothing;\n const [[r1, c1], [r2, c2]] = ends;\n const ends2 = { x1: c1 + 0.5, y1: r1 + 0.5, x2: c2 + 0.5, y2: r2 + 0.5 };\n // The edge, then the fill over it: a loop round the letters.\n return svg`<line class=${kind} data-span=${span} data-item=${ifDefined(entry)} data-palette=${ifDefined(palette)} x1=${ends2.x1} y1=${ends2.y1} x2=${ends2.x2} y2=${ends2.y2}></line><line class=\"${kind} fill\" data-palette=${ifDefined(palette)} x1=${ends2.x1} y1=${ends2.y1} x2=${ends2.x2} y2=${ends2.y2}></line>`;\n };\n // A solution is a dot behind each of its letters: a pattern apart from the strokes students draw.\n const dots = (span: string) =>\n svg`<g class=\"solution\" data-span=${span}>${this.#cells(span).map(\n ([r, c]) => svg`<circle cx=${c + 0.5} cy=${r + 0.5} r=\"0.4\"></circle>`,\n )}</g>`;\n const entries = this.#entries;\n const press = this.#press;\n const active = this.#cellOf(this.#roving.active);\n const from = press?.from ?? this.anchor;\n const to = press?.to ?? active;\n const draft = from !== null && lineCells(from, to, this.#size) !== null ? formatSpan(from, to) : null;\n return svg`${entries.map((entry, i) => {\n const span = this.lines.get(entry.id);\n return span === undefined ? nothing : line(span, 'found', entry.id, (i % 8) + 1);\n })}${entries.map((entry) => {\n const correct = this.solution?.[entry.id];\n const span = this.lines.get(entry.id);\n return correct === undefined || (span !== undefined && sameLine(span, correct))\n ? nothing\n : dots(correct);\n })}${draft === null ? nothing : line(draft, 'draft')}`;\n }\n\n protected override updated(): void {\n // Manual slot assignment: the view's light DOM is projected as is, never moved or rewritten.\n const root = this.renderRoot as ShadowRoot;\n const prompt = Array.from(this.children).find((child) => child.localName === 'astl-prompt');\n root.querySelector<HTMLSlotElement>('slot.prompt-slot')?.assign(...(prompt ? [prompt] : []));\n const items = new Map(this.#entries.map((entry) => [entry.id, entry.el]));\n for (const slot of root.querySelectorAll<HTMLSlotElement>('slot[data-item]')) {\n const item = items.get(slot.dataset.item ?? '');\n slot.assign(...(item ? [item] : []));\n }\n // Through the CSSOM, which a strict Content Security Policy allows (an inline style attribute it blocks).\n root.querySelector<HTMLElement>('.board')?.style.setProperty('--astl-ws-size', `${this.#size}`);\n }\n\n // The grid and the list\n\n get #rows(): readonly (readonly string[])[] {\n const value = this.getAttribute('grid') ?? '';\n if (value !== this.#grid.value) {\n this.#grid = {\n value,\n rows: value\n .split(' ')\n .filter((row) => row !== '')\n .map((row) => [...row]),\n };\n }\n return this.#grid.rows;\n }\n\n get #size(): number {\n return this.#rows.length;\n }\n\n get #entries(): readonly Entry[] {\n return Array.from(this.children)\n .filter((child): child is HTMLElement => child.localName === 'astl-search-word' && child.id !== '')\n .map((el) => {\n const clue = el.hasAttribute('clue');\n return { id: el.id, el, clue, letters: clue ? '' : textOf(el) };\n });\n }\n\n #cellOf(index: number): Cell {\n const size = Math.max(1, this.#size);\n return [Math.floor(index / size), index % size];\n }\n\n #cells(span: string): readonly Cell[] {\n const ends = parseSpan(span);\n return (ends === null ? null : lineCells(ends[0], ends[1], this.#size)) ?? [];\n }\n\n #letters(cells: readonly Cell[]): string {\n return cells.map(([r, c]) => this.#rows[r]?.[c] ?? '').join('');\n }\n\n #spells(cells: readonly Cell[], word: string): boolean {\n const letters = this.#letters(cells);\n return word !== '' && (letters === word || [...letters].reverse().join('') === word);\n }\n\n // Marking lines\n\n /** The cell under a pointer, or (`clamp`) the nearest one; null outside the grid. */\n #hit(event: PointerEvent, clamp = false): Cell | null {\n const box = (event.currentTarget as HTMLElement).getBoundingClientRect();\n const size = this.#size;\n const row = Math.floor(((event.clientY - box.top) / box.height) * size);\n const column = Math.floor(((event.clientX - box.left) / box.width) * size);\n const inside = (n: number) => n >= 0 && n < size;\n if (!clamp && !(inside(row) && inside(column))) return null;\n const fit = (n: number) => Math.min(Math.max(n, 0), size - 1);\n return [fit(row), fit(column)];\n }\n\n /** A drag from `from` towards `to`, snapped to the nearest of the 8 directions and kept inside the grid. */\n #snap(from: Cell, to: Cell): Cell {\n const dr = to[0] - from[0];\n const dc = to[1] - from[1];\n const [ar, ac] = [Math.abs(dr), Math.abs(dc)];\n const step: Cell =\n ar * 2 < ac ? [0, Math.sign(dc)] : ac * 2 < ar ? [Math.sign(dr), 0] : [Math.sign(dr), Math.sign(dc)];\n let n = step[0] !== 0 && step[1] !== 0 ? Math.round((ar + ac) / 2) : Math.max(ar, ac);\n const last = this.#size - 1;\n const inside = (k: number) =>\n [from[0] + step[0] * k, from[1] + step[1] * k].every((v) => v >= 0 && v <= last);\n while (n > 0 && !inside(n)) n--;\n return [from[0] + step[0] * n, from[1] + step[1] * n];\n }\n\n #down(event: PointerEvent): void {\n if (this.disabled || event.button !== 0 || !event.isPrimary) return;\n const cell = this.#hit(event);\n if (cell === null) return;\n (event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);\n this.#press = { pointer: event.pointerId, from: cell, to: cell };\n this.#roving.focus(cell[0] * this.#size + cell[1]);\n }\n\n #move(event: PointerEvent): void {\n const press = this.#press;\n if (press === null || event.pointerId !== press.pointer) return;\n const to = this.#snap(press.from, this.#hit(event, true) as Cell);\n if (same(to, press.to)) return;\n this.#press = { ...press, to };\n this.requestUpdate();\n }\n\n #up(event: PointerEvent): void {\n const press = this.#press;\n if (press === null || event.pointerId !== press.pointer) return;\n this.#press = null;\n if (same(press.from, press.to)) this.#tap(press.from);\n else {\n this.anchor = null;\n this.#complete(press.from, press.to);\n }\n this.requestUpdate();\n }\n\n #lost(event: PointerEvent): void {\n if (this.#press?.pointer !== event.pointerId) return;\n this.#press = null;\n this.requestUpdate();\n }\n\n #keydown(event: KeyboardEvent): void {\n if (this.disabled) return;\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n if (!event.repeat) this.#tap(this.#cellOf(this.#roving.active));\n } else if (event.key === 'Escape' && (this.anchor !== null || this.clue !== null)) {\n // The first letter goes first, then the clue chosen.\n event.preventDefault();\n if (this.anchor !== null) this.anchor = null;\n else this.clue = null;\n this.#say('cancel');\n } else this.#roving.keydown(event);\n }\n\n /** A first letter, then a last one; the same letter again cancels. */\n #tap(cell: Cell): void {\n const anchor = this.anchor;\n if (anchor === null) {\n this.anchor = cell;\n const letter = this.#letters([cell]);\n this.#say('first', { letter, row: cell[0] + 1, column: cell[1] + 1 });\n } else if (same(anchor, cell)) {\n this.anchor = null;\n this.#say('cancel');\n } else {\n this.anchor = null;\n this.#complete(anchor, cell);\n }\n }\n\n /** A line from `from` to `to`: saved for the pressed clue, else matched against the listed words not found yet. */\n #complete(from: Cell, to: Cell): void {\n const cells = lineCells(from, to, this.#size);\n if (cells === null) {\n this.#say('notStraight');\n return;\n }\n const span = formatSpan(from, to);\n const entries = this.#entries;\n const clue = entries.find((entry) => entry.id === this.clue);\n if (clue !== undefined) {\n this.clue = null;\n this.#set(clue.id, span);\n this.#say('saved', { clue: nameOf(clue.el), ...this.#progress() });\n return;\n }\n const word = entries.find((entry) => !entry.clue && this.#spells(cells, entry.letters));\n if (word === undefined) {\n this.#say('none', { letters: this.#letters(cells) });\n } else if (this.lines.has(word.id)) {\n this.#say('again', { word: word.letters });\n } else {\n this.#set(word.id, span);\n this.#say('found', { word: word.letters, ...this.#progress() });\n }\n }\n\n /** A found word or a marked clue is released; a clue is pressed or let go; a word not found yet gets a hint. */\n #pressEntry(entry: Entry): void {\n if (this.disabled) return;\n if (this.lines.has(entry.id)) {\n this.#set(entry.id, '');\n this.#say('released', { word: entry.clue ? nameOf(entry.el) : entry.letters, ...this.#progress() });\n } else if (!entry.clue) {\n this.#say('find', { word: entry.letters });\n } else if (this.clue === entry.id) {\n this.clue = null;\n this.#say('cancel');\n } else {\n this.clue = entry.id;\n this.anchor = null;\n this.#say('clue', { clue: nameOf(entry.el) });\n // On to the letters: keyboard users mark the word next.\n this.#roving.focus(this.#roving.active);\n }\n }\n\n /** Sets (or with '' clears) the line of an entry and reports it. */\n #set(id: string, span: string): void {\n const next = new Map(this.lines);\n if (span === '') next.delete(id);\n else next.set(id, span);\n this.lines = next;\n this.emitChange({ [id]: span });\n }\n\n #progress(): { readonly count: number; readonly total: number } {\n return { count: this.lines.size, total: this.#entries.length };\n }\n\n /** A message, followed by how to mark a clue's word when the list has clues. */\n #withClues(key: string, params?: MessageParams): string {\n const message = this.t(key, params);\n return this.#entries.some((entry) => entry.clue) ? `${message} ${this.t('ui.hintClues')}` : message;\n }\n\n /** Shows a message in the status line and announces it; a line that spells no word also says how clues work. */\n #say(key: string, params?: MessageParams): void {\n this.status =\n key === 'none' ? this.#withClues('ui.status.none', params) : this.t(`ui.status.${key}`, params);\n this.announce(this.status);\n }\n}\n\nexport const wordSearchElement: ElementRegistration = {\n manifest: wordSearchManifest,\n element: WordSearchElement,\n messages: wordSearchUiMessages,\n};\n"],"mappings":"A,iSAIA,IAAMwB,EAAY,mBAMLC,EAAkD,CAC7D,CAAE,YAAW,OAAQ,KAAM,SAAUzB,CAAG,EACxC,CAAE,YAAW,OAAQ,KAAM,SAAUC,CAAG,CAC1C,ECsBMyB,EAAU,IAAyBC,EAAG,aAAe,GAAA,CAAI,QAAQ,OAAQ,GAAG,CAAC,CAAC,KAAK,EAEnFC,EAAU,GACdF,EAAOC,CAAE,GACT,CAAC,GAAGA,EAAG,iBAAiB,KAAK,CAAC,CAAC,CAC5B,IAAK,GAAQE,EAAI,GAAG,CAAC,CACrB,KAAK,GAAG,CAAC,CACT,KAAK,EACJC,GAAQ,EAAS,IAAqBC,EAAE,KAAOzB,EAAE,IAAMyB,EAAE,KAAOzB,EAAE,GAExE,SAAS0B,EAAS,EAAW,EAAoB,CAC/C,IAAMC,EAAOb,EAAUd,CAAC,EACxB,OAAOyB,IAAMzB,GAAM2B,IAAS,MAAQF,IAAMV,EAAWY,EAAK,GAAIA,EAAK,EAAE,CACv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,CAAE,EAC1B3F,EAAK,IAAI2F,EAAI1F,CAAI,EACtB,KAAK,MAAQD,EACb,KAAK,WAAW,EAAG2F,GAAK1F,CAAK,CAAC,CAChC,CAEA,IAAgE,CAC9D,MAAO,CAAE,MAAO,KAAK,MAAM,KAAM,MAAO,KAAKH,GAAS,MAAO,CAC/D,CAGA,GAAW,EAAa,EAAgC,CACtD,IAAM8F,EAAU,KAAK,EAAEjE,EAAKC,CAAM,EAClC,OAAO,KAAK9B,GAAS,KAAM,GAAUC,EAAM,IAAI,EAAI,GAAG6F,EAAQ,GAAG,KAAK,EAAE,cAAc,IAAMA,CAC9F,CAGA,GAAK,EAAa,EAA8B,CAC9C,KAAK,OACHjE,IAAQ,OAAS,KAAKX,GAAW,iBAAkBY,CAAM,EAAI,KAAK,EAAE,aAAaD,IAAOC,CAAM,EAChG,KAAK,SAAS,KAAK,MAAM,CAC3B,CACF,EAEaiE,EAAyC,CACpD,SAAUnH,EACV,QAASgB,EACT,SAAUV,CACZ,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={tag:`astl-word-search`,version:1,display:`block`,graded:!0,attributes:[{name:`size`,type:`integer`,visibility:`private`,min:5,max:20},{name:`right`,type:`boolean`,visibility:`private`},{name:`down`,type:`boolean`,visibility:`private`},{name:`down-right`,type:`boolean`,visibility:`private`},{name:`left`,type:`boolean`,visibility:`private`},{name:`up`,type:`boolean`,visibility:`private`},{name:`up-left`,type:`boolean`,visibility:`private`},{name:`down-left`,type:`boolean`,visibility:`private`},{name:`up-right`,type:`boolean`,visibility:`private`},{name:`grid`,type:`string`,visibility:`derived`}],children:[{tag:`astl-prompt`,visibility:`public`,content:`inline`,min:0,max:1,attributes:[]},{tag:`astl-search-word`,visibility:`public`,content:`inline`,min:1,max:20,attributes:[{name:`id`,type:`id`,visibility:`public`,required:!0},{name:`word`,type:`string`,visibility:`private`},{name:`clue`,type:`boolean`,visibility:`derived`}]}],scoring:{default:`per-word`,modes:{"per-word":`proportional`,all:`all-correct`}},variants:null,slotKinds:[`text`],issues:[`WORD_SEARCH_WORD_EMPTY`,`WORD_SEARCH_WORD_LETTERS`,`WORD_SEARCH_WORD_LENGTH`,`WORD_SEARCH_WORD_DUPLICATE`,`WORD_SEARCH_WORD_INSIDE`,`WORD_SEARCH_CLUE_EMPTY`,`WORD_SEARCH_LINK`,`WORD_SEARCH_NO_FIT`,`WORD_SEARCH_PROMPT_EMPTY`],messages:`astl.word-search`,a11y:{pattern:`grid with one tab stop: Enter or Space on the first and the last letter (or a drag, or two taps), Escape cancels; a list of buttons, clues as toggle buttons`,keys:[`Tab`,`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`,`Enter`,`Space`,`Escape`]},cssParts:[`word-search`,`prompt`,`grid`,`cell`,`line`,`words`,`word`,`status`,`verdict`,`solution`]},t={"ui.hint":`Drag across each word you find, or tap its first and last letter.`,"ui.hintClues":`For a clue, press the clue first.`,"ui.instructions":`Arrow keys move. Press Enter on the first letter of a word, then on its last. Escape cancels.`,"ui.grid":`Grid of letters, {size} by {size}`,"ui.cell":`{letter}, row {row}, column {column}{state, select, first {, first letter} marked {, marked} other {}}`,"ui.words":`Words to find`,"ui.found":`found`,"ui.notFound":`not found yet`,"ui.marked":`word marked`,"ui.notMarked":`no word marked yet`,"ui.solution":`Correct answer: {clue, select, yes {{word}, } other {}}row {fromRow}, column {fromColumn} to row {toRow}, column {toColumn}`,"ui.status.first":`First letter “{letter}”, row {row}, column {column}. Now the last one.`,"ui.status.cancel":`Cancelled.`,"ui.status.notStraight":`Not a straight line: mark a row, a column or a diagonal.`,"ui.status.found":`Found “{word}”, {count} of {total}.`,"ui.status.again":`“{word}” is found already.`,"ui.status.none":`“{letters}” is not on the list.`,"ui.status.find":`Find “{word}” in the letters.`,"ui.status.clue":`Clue “{clue}” chosen: now mark its word.`,"ui.status.saved":`Word marked for “{clue}”, {count} of {total}.`,"ui.status.released":`“{word}” released, {count} of {total}.`,"ui.listHelp":`Press a clue, then mark its word. Press a marked entry to release it.`},n={"ui.hint":`Przeciągnij po każdym znalezionym słowie albo stuknij jego pierwszą i ostatnią literę.`,"ui.hintClues":`Przy wskazówce najpierw ją naciśnij.`,"ui.instructions":`Strzałki przesuwają. Naciśnij Enter na pierwszej literze słowa, a potem na ostatniej. Escape anuluje.`,"ui.grid":`Siatka liter {size} na {size}`,"ui.cell":`{letter}, wiersz {row}, kolumna {column}{state, select, first {, pierwsza litera} marked {, zaznaczona} other {}}`,"ui.words":`Słowa do znalezienia`,"ui.found":`znalezione`,"ui.notFound":`jeszcze nieznalezione`,"ui.marked":`słowo zaznaczone`,"ui.notMarked":`słowo jeszcze niezaznaczone`,"ui.solution":`Poprawna odpowiedź: {clue, select, yes {{word}, } other {}}od wiersza {fromRow}, kolumny {fromColumn} do wiersza {toRow}, kolumny {toColumn}`,"ui.status.first":`Pierwsza litera „{letter}”, wiersz {row}, kolumna {column}. Teraz ostatnia.`,"ui.status.cancel":`Anulowano.`,"ui.status.notStraight":`To nie jest prosta linia: zaznacz wiersz, kolumnę albo przekątną.`,"ui.status.found":`Znaleziono „{word}”, {count} z {total}.`,"ui.status.again":`„{word}” jest już znalezione.`,"ui.status.none":`„{letters}” nie ma na liście.`,"ui.status.find":`Znajdź „{word}” w literach.`,"ui.status.clue":`Wybrano wskazówkę „{clue}”: teraz zaznacz jej słowo.`,"ui.status.saved":`Zaznaczono słowo do „{clue}”, {count} z {total}.`,"ui.status.released":`Odznaczono „{word}”, {count} z {total}.`,"ui.listHelp":`Naciśnij wskazówkę, a potem zaznacz jej słowo. Naciśnij zaznaczoną pozycję, żeby ją odznaczyć.`};function r(e,t){return`r${e[0]+1}c${e[1]+1}-r${t[0]+1}c${t[1]+1}`}var i=/^r([1-9]\d?)c([1-9]\d?)-r([1-9]\d?)c([1-9]\d?)$/;function a(e){let t=i.exec(e);if(t===null)return null;let[n,r,a,o]=t.slice(1).map(e=>Number(e)-1);return[[n,r],[a,o]]}function o(e,t,n){let r=t[0]-e[0],i=t[1]-e[1],a=Math.max(Math.abs(r),Math.abs(i));return![...e,...t].every(e=>e>=0&&e<n)||a===0||r!==0&&i!==0&&Math.abs(r)!==Math.abs(i)?null:Array.from({length:a+1},(t,n)=>[e[0]+r/a*n,e[1]+i/a*n])}export{t as a,n as i,o as n,e as o,a as r,r as t};
|
|
2
|
+
//# sourceMappingURL=word-search-manifest-Fg1a59Z1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"word-search-manifest-Fg1a59Z1.js","names":["wordSearchManifest","en_default","pl_default","formatSpan","from","to","SPAN","parseSpan","m","span","r1","c1","r2","c2","n","lineCells","dr","dc","steps","size","i"],"sources":["../../../../components/src/word-search/manifest.ts","../../../../components/src/word-search/messages/ui/en.json","../../../../components/src/word-search/messages/ui/pl.json","../../../../components/src/word-search/span.ts"],"sourcesContent":["import type { ComponentManifest } from '@astl/core';\n\n/**\n * Word search: the student finds hidden words in a grid of letters by marking each word's first and last letter.\n * Each word grades one `text` slot whose answer is that span (`r2c3-r2c5`, rows and columns from 1); the reversed\n * span counts too. The compiler generates the grid from the source alone, so the view holds the letters but never\n * where the words are.\n */\nexport const wordSearchManifest: ComponentManifest = {\n tag: 'astl-word-search',\n version: 1,\n display: 'block',\n graded: true,\n attributes: [\n /** Rows and columns of the grid; absent = automatic (room for the longest word and twice the letters). */\n { name: 'size', type: 'integer', visibility: 'private', min: 5, max: 20 },\n /**\n * The directions words may run in, one boolean each. None written = `right`, `down` and `down-right`; written\n * ones replace that default.\n */\n { name: 'right', type: 'boolean', visibility: 'private' },\n { name: 'down', type: 'boolean', visibility: 'private' },\n { name: 'down-right', type: 'boolean', visibility: 'private' },\n { name: 'left', type: 'boolean', visibility: 'private' },\n { name: 'up', type: 'boolean', visibility: 'private' },\n { name: 'up-left', type: 'boolean', visibility: 'private' },\n { name: 'down-left', type: 'boolean', visibility: 'private' },\n { name: 'up-right', type: 'boolean', visibility: 'private' },\n /** The letters, row by row, rows separated by a space. */\n { name: 'grid', 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 to find, in the list's order. Its content is what the list shows: the word itself, or a clue when the\n * private `word` holds the hidden word (then the view marks the entry `clue`). 2 to 20 letters, letters only; the\n * view shows a listed word in capitals, as the grid writes it.\n */\n {\n tag: 'astl-search-word',\n visibility: 'public',\n content: 'inline',\n min: 1,\n max: 20,\n attributes: [\n { name: 'id', type: 'id', visibility: 'public', required: true },\n { name: 'word', type: 'string', visibility: 'private' },\n { name: 'clue', type: 'boolean', visibility: 'derived' },\n ],\n },\n ],\n scoring: { default: 'per-word', modes: { 'per-word': 'proportional', all: 'all-correct' } },\n variants: null,\n slotKinds: ['text'],\n issues: [\n 'WORD_SEARCH_WORD_EMPTY',\n 'WORD_SEARCH_WORD_LETTERS',\n 'WORD_SEARCH_WORD_LENGTH',\n 'WORD_SEARCH_WORD_DUPLICATE',\n 'WORD_SEARCH_WORD_INSIDE',\n 'WORD_SEARCH_CLUE_EMPTY',\n 'WORD_SEARCH_LINK',\n 'WORD_SEARCH_NO_FIT',\n 'WORD_SEARCH_PROMPT_EMPTY',\n ],\n messages: 'astl.word-search',\n a11y: {\n pattern:\n 'grid with one tab stop: Enter or Space on the first and the last letter (or a drag, or two taps), Escape cancels; a list of buttons, clues as toggle buttons',\n keys: [\n 'Tab',\n 'ArrowUp',\n 'ArrowDown',\n 'ArrowLeft',\n 'ArrowRight',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n 'Enter',\n 'Space',\n 'Escape',\n ],\n },\n cssParts: [\n 'word-search',\n 'prompt',\n 'grid',\n 'cell',\n 'line',\n 'words',\n 'word',\n 'status',\n 'verdict',\n 'solution',\n ],\n};\n","{\n \"ui.hint\": \"Drag across each word you find, or tap its first and last letter.\",\n \"ui.hintClues\": \"For a clue, press the clue first.\",\n \"ui.instructions\": \"Arrow keys move. Press Enter on the first letter of a word, then on its last. Escape cancels.\",\n \"ui.grid\": \"Grid of letters, {size} by {size}\",\n \"ui.cell\": \"{letter}, row {row}, column {column}{state, select, first {, first letter} marked {, marked} other {}}\",\n \"ui.words\": \"Words to find\",\n \"ui.found\": \"found\",\n \"ui.notFound\": \"not found yet\",\n \"ui.marked\": \"word marked\",\n \"ui.notMarked\": \"no word marked yet\",\n \"ui.solution\": \"Correct answer: {clue, select, yes {{word}, } other {}}row {fromRow}, column {fromColumn} to row {toRow}, column {toColumn}\",\n \"ui.status.first\": \"First letter “{letter}”, row {row}, column {column}. Now the last one.\",\n \"ui.status.cancel\": \"Cancelled.\",\n \"ui.status.notStraight\": \"Not a straight line: mark a row, a column or a diagonal.\",\n \"ui.status.found\": \"Found “{word}”, {count} of {total}.\",\n \"ui.status.again\": \"“{word}” is found already.\",\n \"ui.status.none\": \"“{letters}” is not on the list.\",\n \"ui.status.find\": \"Find “{word}” in the letters.\",\n \"ui.status.clue\": \"Clue “{clue}” chosen: now mark its word.\",\n \"ui.status.saved\": \"Word marked for “{clue}”, {count} of {total}.\",\n \"ui.status.released\": \"“{word}” released, {count} of {total}.\",\n \"ui.listHelp\": \"Press a clue, then mark its word. Press a marked entry to release it.\"\n}\n","{\n \"ui.hint\": \"Przeciągnij po każdym znalezionym słowie albo stuknij jego pierwszą i ostatnią literę.\",\n \"ui.hintClues\": \"Przy wskazówce najpierw ją naciśnij.\",\n \"ui.instructions\": \"Strzałki przesuwają. Naciśnij Enter na pierwszej literze słowa, a potem na ostatniej. Escape anuluje.\",\n \"ui.grid\": \"Siatka liter {size} na {size}\",\n \"ui.cell\": \"{letter}, wiersz {row}, kolumna {column}{state, select, first {, pierwsza litera} marked {, zaznaczona} other {}}\",\n \"ui.words\": \"Słowa do znalezienia\",\n \"ui.found\": \"znalezione\",\n \"ui.notFound\": \"jeszcze nieznalezione\",\n \"ui.marked\": \"słowo zaznaczone\",\n \"ui.notMarked\": \"słowo jeszcze niezaznaczone\",\n \"ui.solution\": \"Poprawna odpowiedź: {clue, select, yes {{word}, } other {}}od wiersza {fromRow}, kolumny {fromColumn} do wiersza {toRow}, kolumny {toColumn}\",\n \"ui.status.first\": \"Pierwsza litera „{letter}”, wiersz {row}, kolumna {column}. Teraz ostatnia.\",\n \"ui.status.cancel\": \"Anulowano.\",\n \"ui.status.notStraight\": \"To nie jest prosta linia: zaznacz wiersz, kolumnę albo przekątną.\",\n \"ui.status.found\": \"Znaleziono „{word}”, {count} z {total}.\",\n \"ui.status.again\": \"„{word}” jest już znalezione.\",\n \"ui.status.none\": \"„{letters}” nie ma na liście.\",\n \"ui.status.find\": \"Znajdź „{word}” w literach.\",\n \"ui.status.clue\": \"Wybrano wskazówkę „{clue}”: teraz zaznacz jej słowo.\",\n \"ui.status.saved\": \"Zaznaczono słowo do „{clue}”, {count} z {total}.\",\n \"ui.status.released\": \"Odznaczono „{word}”, {count} z {total}.\",\n \"ui.listHelp\": \"Naciśnij wskazówkę, a potem zaznacz jej słowo. Naciśnij zaznaczoną pozycję, żeby ją odznaczyć.\"\n}\n","/**\n * Cells, straight lines and the answer format of `<astl-word-search>`: one module for the definition (keys) and the\n * element (answers), so both write a span the same way. A span is its first and last cell, rows and columns counted\n * from 1: `r2c3-r2c5`.\n */\n\n/** A cell of the grid: row and column, counted from 0. */\nexport type Cell = readonly [row: number, column: number];\n\n/** The answer of a line from `from` to `to`. */\nexport function formatSpan(from: Cell, to: Cell): string {\n return `r${from[0] + 1}c${from[1] + 1}-r${to[0] + 1}c${to[1] + 1}`;\n}\n\nconst SPAN = /^r([1-9]\\d?)c([1-9]\\d?)-r([1-9]\\d?)c([1-9]\\d?)$/;\n\n/** The first and last cell of a span written as `formatSpan` writes it; null for anything else. */\nexport function parseSpan(span: string): readonly [Cell, Cell] | null {\n const m = SPAN.exec(span);\n if (m === null) return null;\n const [r1, c1, r2, c2] = m.slice(1).map((n) => Number(n) - 1) as [number, number, number, number];\n return [\n [r1, c1],\n [r2, c2],\n ];\n}\n\n/**\n * The cells from `from` to `to` in a `size` x `size` grid when they make a row, a column or a 45 degree diagonal of\n * at least two cells, in either direction; null for any other pair.\n */\nexport function lineCells(from: Cell, to: Cell, size: number): Cell[] | null {\n const dr = to[0] - from[0];\n const dc = to[1] - from[1];\n const steps = Math.max(Math.abs(dr), Math.abs(dc));\n const inside = [...from, ...to].every((n) => n >= 0 && n < size);\n if (!inside || steps === 0 || (dr !== 0 && dc !== 0 && Math.abs(dr) !== Math.abs(dc))) return null;\n return Array.from(\n { length: steps + 1 },\n (_, i): Cell => [from[0] + (dr / steps) * i, from[1] + (dc / steps) * i],\n );\n}\n"],"mappings":"AAQA,IAAaA,EAAwC,CACnD,IAAK,mBACL,QAAS,EACT,QAAS,QACT,OAAQ,GACR,WAAY,CAEV,CAAE,KAAM,OAAQ,KAAM,UAAW,WAAY,UAAW,IAAK,EAAG,IAAK,EAAG,EAKxE,CAAE,KAAM,QAAS,KAAM,UAAW,WAAY,SAAU,EACxD,CAAE,KAAM,OAAQ,KAAM,UAAW,WAAY,SAAU,EACvD,CAAE,KAAM,aAAc,KAAM,UAAW,WAAY,SAAU,EAC7D,CAAE,KAAM,OAAQ,KAAM,UAAW,WAAY,SAAU,EACvD,CAAE,KAAM,KAAM,KAAM,UAAW,WAAY,SAAU,EACrD,CAAE,KAAM,UAAW,KAAM,UAAW,WAAY,SAAU,EAC1D,CAAE,KAAM,YAAa,KAAM,UAAW,WAAY,SAAU,EAC5D,CAAE,KAAM,WAAY,KAAM,UAAW,WAAY,SAAU,EAE3D,CAAE,KAAM,OAAQ,KAAM,SAAU,WAAY,SAAU,CACxD,EACA,SAAU,CAER,CAAE,IAAK,cAAe,WAAY,SAAU,QAAS,SAAU,IAAK,EAAG,IAAK,EAAG,WAAY,CAAC,CAAE,EAM9F,CACE,IAAK,mBACL,WAAY,SACZ,QAAS,SACT,IAAK,EACL,IAAK,GACL,WAAY,CACV,CAAE,KAAM,KAAM,KAAM,KAAM,WAAY,SAAU,SAAU,EAAK,EAC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IAAU,GAAMF,IAAO,GAAKC,IAAO,GAAK,KAAK,IAAID,CAAE,IAAM,KAAK,IAAIC,CAAE,EAAW,KACvF,MAAM,KACX,CAAE,OAAQC,EAAQ,CAAE,GACnB,EAAG,IAAY,CAACd,EAAK,GAAMY,EAAKE,EAASE,EAAGhB,EAAK,GAAMa,EAAKC,EAASE,CAAC,CACzE,CACF,C"}
|
package/dist/editor.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@astl/astrolabe/editor`: `<astl-editor>` with every built-in component, editor descriptor, preview element
|
|
3
|
+
* and look. Only the main entry of `@astl/editor-tiptap`, never its `/tiptap` entry: importing this module
|
|
4
|
+
* never loads TipTap, which `<astl-editor>` imports on demand when it creates its own surface. Hosts that build
|
|
5
|
+
* their own TipTap editor install `@astl/editor-tiptap` and take `astrolabeExtensions` and
|
|
6
|
+
* `createTiptapAdapter` from its `/tiptap` entry.
|
|
7
|
+
*/
|
|
8
|
+
import { builtInDefinitions } from '@astl/components/definitions';
|
|
9
|
+
import { builtInEditors } from '@astl/components/editors';
|
|
10
|
+
import { builtInElements } from '@astl/components/elements';
|
|
11
|
+
import { createAuthoring, createTextareaAdapter, DEFAULT_FONTS, DEFAULT_STYLES, loadStyleElements, STYLE_OPEN, UploadRefused } from '@astl/editor';
|
|
12
|
+
import { type DefineEditorOptions } from '@astl/editor-tiptap';
|
|
13
|
+
import { builtInStyleTemplates, tokensCss } from '@astl/tokens';
|
|
14
|
+
export * from '@astl/core';
|
|
15
|
+
export type { AstlStyleForm, AstlStyleRules, Authoring, AuthoringOptions, DescribeOptions, EditorFont, EditorStylePreset, Outline, OutlineBlock, OutlineComponent, OutlinePage, PickPicture, PreviewOptions, PreviewResult, StyleOpen, TextareaAdapter, UploadAsset, UploadedAsset, } from '@astl/editor';
|
|
16
|
+
export type { DefineEditorOptions } from '@astl/editor-tiptap';
|
|
17
|
+
export { AstlEditor } from '@astl/editor-tiptap';
|
|
18
|
+
export { builtInDefinitions, builtInEditors, builtInElements, builtInStyleTemplates, createAuthoring, createTextareaAdapter, DEFAULT_FONTS, DEFAULT_STYLES, loadStyleElements, STYLE_OPEN, tokensCss, UploadRefused, };
|
|
19
|
+
/**
|
|
20
|
+
* The toolbar's default featured inserts: none, every component and starter is under "Elements" and "Templates".
|
|
21
|
+
* `featured` replaces it.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_FEATURED: readonly string[];
|
|
24
|
+
/**
|
|
25
|
+
* Defines `<astl-editor>` with `components: builtInDefinitions`, `styleTemplates: builtInStyleTemplates`, the light
|
|
26
|
+
* theme's `groundColors` (what an author sees while writing),
|
|
27
|
+
* the built-ins' `menuMessages` and `featured: DEFAULT_FEATURED`, and as `editors` and `elements` the built-in entries of the `components` tags (so a
|
|
28
|
+
* subset of components brings its own editors and elements). An option replaces its default (extend with
|
|
29
|
+
* `[...builtInDefinitions, mine]`); a second call adds.
|
|
30
|
+
*/
|
|
31
|
+
export declare function defineEditor(options?: Partial<DefineEditorOptions>): void;
|
|
32
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,mBAAmB,EAAoC,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAU,SAAS,EAAE,MAAM,cAAc,CAAC;AAExE,cAAc,YAAY,CAAC;AAC3B,YAAY,EACV,aAAa,EACb,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,eAAe,EACf,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMjD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,aAAa,GACd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAAO,CAAC;AAMtD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,OAAO,CAAC,mBAAmB,CAAM,GAAG,IAAI,CAc7E"}
|
package/dist/editor.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@astl/astrolabe/editor`: `<astl-editor>` with every built-in component, editor descriptor, preview element
|
|
3
|
+
* and look. Only the main entry of `@astl/editor-tiptap`, never its `/tiptap` entry: importing this module
|
|
4
|
+
* never loads TipTap, which `<astl-editor>` imports on demand when it creates its own surface. Hosts that build
|
|
5
|
+
* their own TipTap editor install `@astl/editor-tiptap` and take `astrolabeExtensions` and
|
|
6
|
+
* `createTiptapAdapter` from its `/tiptap` entry.
|
|
7
|
+
*/
|
|
8
|
+
import { builtInDefinitions } from '@astl/components/definitions';
|
|
9
|
+
import { builtInEditors } from '@astl/components/editors';
|
|
10
|
+
import { builtInElements } from '@astl/components/elements';
|
|
11
|
+
import { createAuthoring, createTextareaAdapter, DEFAULT_FONTS, DEFAULT_STYLES, loadStyleElements, STYLE_OPEN, UploadRefused, } from '@astl/editor';
|
|
12
|
+
import { defineEditor as defineBaseEditor } from '@astl/editor-tiptap';
|
|
13
|
+
import { builtInStyleTemplates, tokens, tokensCss } from '@astl/tokens';
|
|
14
|
+
export * from '@astl/core';
|
|
15
|
+
export { AstlEditor } from '@astl/editor-tiptap';
|
|
16
|
+
// `tokensCss`: the --astl-* tokens for the page around the editor, with the same themes.
|
|
17
|
+
// `createAuthoring`: the kit's logic without the element (validate, outline, preview), Node-safe.
|
|
18
|
+
// `UploadRefused`: what a host's upload or picture library rejects with to tell the author why.
|
|
19
|
+
// `DEFAULT_FONTS` and `DEFAULT_STYLES`: the `fonts` and `styles` defaults, to extend. `loadStyleElements`: for a host
|
|
20
|
+
// that places `<astl-style-form>` or `<astl-style-rules>` itself. `STYLE_OPEN`: the event of a request for them.
|
|
21
|
+
export { builtInDefinitions, builtInEditors, builtInElements, builtInStyleTemplates, createAuthoring, createTextareaAdapter, DEFAULT_FONTS, DEFAULT_STYLES, loadStyleElements, STYLE_OPEN, tokensCss, UploadRefused, };
|
|
22
|
+
/**
|
|
23
|
+
* The toolbar's default featured inserts: none, every component and starter is under "Elements" and "Templates".
|
|
24
|
+
* `featured` replaces it.
|
|
25
|
+
*/
|
|
26
|
+
export const DEFAULT_FEATURED = [];
|
|
27
|
+
/** The built-ins' insert menu descriptions, imported when a menu first opens. */
|
|
28
|
+
const loadMenuMessages = async () => (await import('@astl/components/menu-messages')).builtInMenuMessages;
|
|
29
|
+
/**
|
|
30
|
+
* Defines `<astl-editor>` with `components: builtInDefinitions`, `styleTemplates: builtInStyleTemplates`, the light
|
|
31
|
+
* theme's `groundColors` (what an author sees while writing),
|
|
32
|
+
* the built-ins' `menuMessages` and `featured: DEFAULT_FEATURED`, and as `editors` and `elements` the built-in entries of the `components` tags (so a
|
|
33
|
+
* subset of components brings its own editors and elements). An option replaces its default (extend with
|
|
34
|
+
* `[...builtInDefinitions, mine]`); a second call adds.
|
|
35
|
+
*/
|
|
36
|
+
export function defineEditor(options = {}) {
|
|
37
|
+
const components = options.components ?? builtInDefinitions;
|
|
38
|
+
const tags = new Set(components.map((definition) => definition.manifest.tag));
|
|
39
|
+
const { surface, ink } = tokens.themes.light;
|
|
40
|
+
defineBaseEditor({
|
|
41
|
+
styleTemplates: builtInStyleTemplates,
|
|
42
|
+
groundColors: { surface, ink },
|
|
43
|
+
featured: DEFAULT_FEATURED,
|
|
44
|
+
menuMessages: loadMenuMessages,
|
|
45
|
+
...options,
|
|
46
|
+
components,
|
|
47
|
+
editors: options.editors ?? builtInEditors.filter((editor) => tags.has(editor.manifest.tag)),
|
|
48
|
+
elements: options.elements ?? builtInElements.filter((element) => tags.has(element.tag)),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAA4B,YAAY,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExE,cAAc,YAAY,CAAC;AAsB3B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,yFAAyF;AACzF,kGAAkG;AAClG,gGAAgG;AAChG,sHAAsH;AACtH,iHAAiH;AACjH,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,qBAAqB,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1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@astl/astrolabe/engine`: the engine with the built-in components and looks, and the in-browser source
|
|
3
|
+
* compiler of HTML with answers. It imports no DOM code, so servers use it too; only the compiler it creates reads
|
|
4
|
+
* the page (`location`), when it compiles.
|
|
5
|
+
*/
|
|
6
|
+
import { builtInDefinitions } from '@astl/components/definitions';
|
|
7
|
+
import { builtInManifests } from '@astl/components/manifests';
|
|
8
|
+
import type { Engine, EngineOptions, SourceCompiler } from '@astl/core';
|
|
9
|
+
import { builtInStyleTemplates } from '@astl/tokens';
|
|
10
|
+
export * from '@astl/core';
|
|
11
|
+
export * from '@astl/core/declarations';
|
|
12
|
+
export * from '@astl/engine';
|
|
13
|
+
export { builtInDefinitions, builtInManifests, builtInStyleTemplates };
|
|
14
|
+
/**
|
|
15
|
+
* Public on purpose: in HTML with answers the answers are in the page, so the secret protects nothing. Being fixed,
|
|
16
|
+
* it keeps ids (and progress saved with `persist`) stable across reloads. Never use it on a server.
|
|
17
|
+
*/
|
|
18
|
+
export declare const IN_BROWSER_SECRET = "astrolabe-in-browser-key";
|
|
19
|
+
/**
|
|
20
|
+
* An engine with `components: builtInDefinitions`, `styleTemplates: builtInStyleTemplates` and the light theme's
|
|
21
|
+
* `groundColors`: what an author sees while writing, and the theme whose colours are the author's own in the player.
|
|
22
|
+
* An option replaces its default (extend with `[...builtInDefinitions, mine]`). There is no default secret: `compile`
|
|
23
|
+
* needs one.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createEngine(options?: Partial<EngineOptions>): Engine;
|
|
26
|
+
/**
|
|
27
|
+
* Compiles light-DOM sources for `<astl-player>` (`definePlayer({ compileSource })`), with the page path as salt,
|
|
28
|
+
* and grades them with `localChecker`. Default engine: `createEngine({ secret: IN_BROWSER_SECRET })`. An invalid
|
|
29
|
+
* source throws an Error listing its errors in the asking player's UI locale, one per line; the player shows it to
|
|
30
|
+
* the author under its notice.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createSourceCompiler(engine?: Engine): SourceCompiler;
|
|
33
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAU,MAAM,cAAc,CAAC;AAE7D,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,MAAM,CAQzE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,GAAE,MAAoD,GAC3D,cAAc,CAYhB"}
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@astl/astrolabe/engine`: the engine with the built-in components and looks, and the in-browser source
|
|
3
|
+
* compiler of HTML with answers. It imports no DOM code, so servers use it too; only the compiler it creates reads
|
|
4
|
+
* the page (`location`), when it compiles.
|
|
5
|
+
*/
|
|
6
|
+
import { builtInDefinitions } from '@astl/components/definitions';
|
|
7
|
+
import { builtInManifests } from '@astl/components/manifests';
|
|
8
|
+
import { createEngine as createBaseEngine, localChecker } from '@astl/engine';
|
|
9
|
+
import { builtInStyleTemplates, tokens } from '@astl/tokens';
|
|
10
|
+
export * from '@astl/core';
|
|
11
|
+
export * from '@astl/core/declarations';
|
|
12
|
+
export * from '@astl/engine';
|
|
13
|
+
export { builtInDefinitions, builtInManifests, builtInStyleTemplates };
|
|
14
|
+
/**
|
|
15
|
+
* Public on purpose: in HTML with answers the answers are in the page, so the secret protects nothing. Being fixed,
|
|
16
|
+
* it keeps ids (and progress saved with `persist`) stable across reloads. Never use it on a server.
|
|
17
|
+
*/
|
|
18
|
+
export const IN_BROWSER_SECRET = 'astrolabe-in-browser-key';
|
|
19
|
+
/**
|
|
20
|
+
* An engine with `components: builtInDefinitions`, `styleTemplates: builtInStyleTemplates` and the light theme's
|
|
21
|
+
* `groundColors`: what an author sees while writing, and the theme whose colours are the author's own in the player.
|
|
22
|
+
* An option replaces its default (extend with `[...builtInDefinitions, mine]`). There is no default secret: `compile`
|
|
23
|
+
* needs one.
|
|
24
|
+
*/
|
|
25
|
+
export function createEngine(options = {}) {
|
|
26
|
+
const { surface, ink } = tokens.themes.light;
|
|
27
|
+
return createBaseEngine({
|
|
28
|
+
components: builtInDefinitions,
|
|
29
|
+
styleTemplates: builtInStyleTemplates,
|
|
30
|
+
groundColors: { surface, ink },
|
|
31
|
+
...options,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Compiles light-DOM sources for `<astl-player>` (`definePlayer({ compileSource })`), with the page path as salt,
|
|
36
|
+
* and grades them with `localChecker`. Default engine: `createEngine({ secret: IN_BROWSER_SECRET })`. An invalid
|
|
37
|
+
* source throws an Error listing its errors in the asking player's UI locale, one per line; the player shows it to
|
|
38
|
+
* the author under its notice.
|
|
39
|
+
*/
|
|
40
|
+
export function createSourceCompiler(engine = createEngine({ secret: IN_BROWSER_SECRET })) {
|
|
41
|
+
return async (source, context) => {
|
|
42
|
+
const result = await engine.compile(source, { salt: location.pathname });
|
|
43
|
+
if (!result.ok) {
|
|
44
|
+
const errors = result.issues.filter((issue) => issue.severity === 'error');
|
|
45
|
+
const message = errors.map((issue) => engine.describe(issue, context.locale)).join('\n');
|
|
46
|
+
// Also in the console, where authors look first when a page misbehaves.
|
|
47
|
+
console.error(message);
|
|
48
|
+
throw new Error(message);
|
|
49
|
+
}
|
|
50
|
+
return { view: result.view, checker: localChecker(engine, result.key) };
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=engine.js.map
|