@astl/editor-tiptap 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 +111 -0
- package/LICENSE +202 -0
- package/README.md +49 -0
- package/dist/adapter.d.ts +13 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +421 -0
- package/dist/adapter.js.map +1 -0
- package/dist/blocks.d.ts +96 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +460 -0
- package/dist/blocks.js.map +1 -0
- package/dist/define.d.ts +64 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +20 -0
- package/dist/define.js.map +1 -0
- package/dist/element.d.ts +91 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +779 -0
- package/dist/element.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts.d.ts +52 -0
- package/dist/layouts.d.ts.map +1 -0
- package/dist/layouts.js +198 -0
- package/dist/layouts.js.map +1 -0
- package/dist/nodes.d.ts +150 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +2426 -0
- package/dist/nodes.js.map +1 -0
- package/dist/source-view.d.ts +26 -0
- package/dist/source-view.d.ts.map +1 -0
- package/dist/source-view.js +114 -0
- package/dist/source-view.js.map +1 -0
- package/dist/source.d.ts +8 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +24 -0
- package/dist/source.js.map +1 -0
- package/dist/style.d.ts +16 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.js +568 -0
- package/dist/style.js.map +1 -0
- package/dist/styles.d.ts +5 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +921 -0
- package/dist/styles.js.map +1 -0
- package/dist/surface.d.ts +24 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +90 -0
- package/dist/surface.js.map +1 -0
- package/dist/tiptap.d.ts +10 -0
- package/dist/tiptap.d.ts.map +1 -0
- package/dist/tiptap.js +9 -0
- package/dist/tiptap.js.map +1 -0
- package/package.json +63 -4
- package/src/adapter.ts +421 -0
- package/src/blocks.ts +577 -0
- package/src/define.ts +84 -0
- package/src/element.ts +988 -0
- package/src/index.ts +10 -0
- package/src/layouts.ts +220 -0
- package/src/nodes.ts +2690 -0
- package/src/source-view.ts +138 -0
- package/src/source.ts +27 -0
- package/src/style.ts +638 -0
- package/src/styles.ts +931 -0
- package/src/surface.ts +110 -0
- package/src/tiptap.ts +9 -0
package/dist/styles.js
ADDED
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The built-in surface's stylesheet. Only `surface.ts` imports it, so it loads with TipTap, never in the first load of
|
|
3
|
+
* `<astl-editor>` (whose own shadow styles are in `element.ts`).
|
|
4
|
+
*/
|
|
5
|
+
import { css, unsafeCSS } from 'lit';
|
|
6
|
+
/** Class of the element the built-in surface mounts TipTap in, a light-DOM child of `<astl-editor>`. */
|
|
7
|
+
export const SURFACE_CLASS = 'astl-surface';
|
|
8
|
+
/**
|
|
9
|
+
* The surface's own stylesheet, adopted by the document (or shadow root) that holds `<astl-editor>`, since the surface
|
|
10
|
+
* lives in the light DOM. Generic: it styles atoms, blocks and pages, never a component type. A host themes it with the
|
|
11
|
+
* `--astl-editor-*` custom properties (reference/editor.md, "Theming the surface"), each with today's token as its
|
|
12
|
+
* fallback.
|
|
13
|
+
*/
|
|
14
|
+
const baseSurfaceStyles = css `
|
|
15
|
+
.astl-surface {
|
|
16
|
+
display: block;
|
|
17
|
+
min-inline-size: 0;
|
|
18
|
+
}
|
|
19
|
+
.astl-surface .tiptap {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
min-block-size: 16rem;
|
|
22
|
+
padding: var(--astl-editor-sheet-padding, var(--astl-space-4));
|
|
23
|
+
border: var(--astl-outline-width) solid var(--astl-editor-sheet-border, var(--astl-outline));
|
|
24
|
+
border-radius: var(--astl-editor-sheet-radius, var(--astl-radius-l));
|
|
25
|
+
background: var(--astl-surface);
|
|
26
|
+
color: var(--astl-ink);
|
|
27
|
+
font-family: var(--astl-font-body);
|
|
28
|
+
font-size: var(--astl-size-content);
|
|
29
|
+
line-height: var(--astl-line-height-content);
|
|
30
|
+
}
|
|
31
|
+
/* A host with a focus cue of its own (the frame with the cursor) may set the sheet's ring to a quieter one. */
|
|
32
|
+
.astl-surface .tiptap:focus-visible {
|
|
33
|
+
outline: var(--astl-editor-sheet-focus-ring, var(--astl-focus-width) solid var(--astl-focus));
|
|
34
|
+
outline-offset: var(--astl-focus-offset);
|
|
35
|
+
}
|
|
36
|
+
.astl-surface .astl-vh {
|
|
37
|
+
position: absolute;
|
|
38
|
+
inline-size: 1px;
|
|
39
|
+
block-size: 1px;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
clip-path: inset(50%);
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* What ProseMirror needs; TipTap would inject the same as a <style> element, which strict CSP blocks. */
|
|
46
|
+
.astl-surface .ProseMirror {
|
|
47
|
+
position: relative;
|
|
48
|
+
overflow-wrap: break-word;
|
|
49
|
+
white-space: pre-wrap;
|
|
50
|
+
white-space: break-spaces;
|
|
51
|
+
font-variant-ligatures: none;
|
|
52
|
+
font-feature-settings: 'liga' 0;
|
|
53
|
+
}
|
|
54
|
+
.astl-surface .ProseMirror [contenteditable='false'] {
|
|
55
|
+
white-space: normal;
|
|
56
|
+
}
|
|
57
|
+
.astl-surface .ProseMirror [contenteditable='false'] [contenteditable='true'] {
|
|
58
|
+
white-space: pre-wrap;
|
|
59
|
+
}
|
|
60
|
+
.astl-surface img.ProseMirror-separator {
|
|
61
|
+
display: inline !important;
|
|
62
|
+
border: none !important;
|
|
63
|
+
margin: 0 !important;
|
|
64
|
+
inline-size: 0 !important;
|
|
65
|
+
block-size: 0 !important;
|
|
66
|
+
}
|
|
67
|
+
.astl-surface .ProseMirror-gapcursor {
|
|
68
|
+
display: none;
|
|
69
|
+
position: absolute;
|
|
70
|
+
margin: 0;
|
|
71
|
+
pointer-events: none;
|
|
72
|
+
}
|
|
73
|
+
.astl-surface .ProseMirror-gapcursor::after {
|
|
74
|
+
content: '';
|
|
75
|
+
display: block;
|
|
76
|
+
position: absolute;
|
|
77
|
+
inset-block-start: -2px;
|
|
78
|
+
inline-size: 20px;
|
|
79
|
+
border-block-start: var(--astl-outline-width) solid var(--astl-ink);
|
|
80
|
+
animation: astl-gapcursor-blink 1.1s steps(2, start) infinite;
|
|
81
|
+
}
|
|
82
|
+
.astl-surface .ProseMirror-focused .ProseMirror-gapcursor {
|
|
83
|
+
display: block;
|
|
84
|
+
}
|
|
85
|
+
.astl-surface .ProseMirror-hideselection *::selection {
|
|
86
|
+
background: transparent;
|
|
87
|
+
}
|
|
88
|
+
.astl-surface .ProseMirror-hideselection * {
|
|
89
|
+
caret-color: transparent;
|
|
90
|
+
}
|
|
91
|
+
@keyframes astl-gapcursor-blink {
|
|
92
|
+
to {
|
|
93
|
+
visibility: hidden;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
@media (prefers-reduced-motion: reduce) {
|
|
97
|
+
.astl-surface .ProseMirror-gapcursor::after {
|
|
98
|
+
animation: none;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Rich text. */
|
|
103
|
+
.astl-surface :is(p, ul, ol, blockquote, h2, h3, h4) {
|
|
104
|
+
margin-block: 0 var(--astl-space-3);
|
|
105
|
+
}
|
|
106
|
+
.astl-surface :is(h2, h3, h4) {
|
|
107
|
+
font-family: var(--astl-font-display);
|
|
108
|
+
line-height: 1.25;
|
|
109
|
+
}
|
|
110
|
+
.astl-surface blockquote {
|
|
111
|
+
margin-inline: 0;
|
|
112
|
+
padding-inline-start: var(--astl-space-3);
|
|
113
|
+
border-inline-start: var(--astl-space-1) solid var(--astl-line);
|
|
114
|
+
}
|
|
115
|
+
.astl-surface code {
|
|
116
|
+
font-family: var(--astl-font-mono);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* A page: a head at the top with its number of all and its buttons: "Add title" (a page has no title until it gets
|
|
120
|
+
one), from the second page on one that joins it to the page before, and one that deletes it. A title shows under
|
|
121
|
+
the head, in its field with "Remove title". The number takes the room, so the buttons sit at the end of its line,
|
|
122
|
+
and wrap under it when it does not fit: on a phone, on every page alike. */
|
|
123
|
+
.astl-surface .astl-page {
|
|
124
|
+
padding-block-end: var(--astl-space-2);
|
|
125
|
+
}
|
|
126
|
+
.astl-surface .astl-page + .astl-page {
|
|
127
|
+
margin-block-start: var(--astl-space-5);
|
|
128
|
+
padding-block-start: var(--astl-space-4);
|
|
129
|
+
border-block-start: var(--astl-outline-width) solid var(--astl-line);
|
|
130
|
+
}
|
|
131
|
+
.astl-surface .astl-page-head {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-wrap: wrap;
|
|
134
|
+
align-items: center;
|
|
135
|
+
gap: var(--astl-space-2);
|
|
136
|
+
margin-block: 0 var(--astl-space-3);
|
|
137
|
+
}
|
|
138
|
+
.astl-surface .astl-page-number {
|
|
139
|
+
flex: 1 1 auto;
|
|
140
|
+
color: var(--astl-ink-muted);
|
|
141
|
+
font-family: var(--astl-editor-page-number-font-family, var(--astl-font-body));
|
|
142
|
+
font-size: var(--astl-editor-page-number-size, var(--astl-editor-kicker-size, var(--astl-size-small)));
|
|
143
|
+
letter-spacing: var(--astl-editor-page-number-letter-spacing, normal);
|
|
144
|
+
text-transform: var(--astl-editor-page-number-text-transform, none);
|
|
145
|
+
}
|
|
146
|
+
.astl-surface .astl-page-field {
|
|
147
|
+
flex: 1 0 100%;
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: var(--astl-space-2);
|
|
151
|
+
min-inline-size: 0;
|
|
152
|
+
}
|
|
153
|
+
.astl-surface .astl-page-field[hidden] {
|
|
154
|
+
display: none;
|
|
155
|
+
}
|
|
156
|
+
.astl-surface .astl-page-label {
|
|
157
|
+
box-sizing: border-box;
|
|
158
|
+
flex: 1 1 auto;
|
|
159
|
+
min-inline-size: 0;
|
|
160
|
+
min-block-size: var(--astl-target-min);
|
|
161
|
+
margin: 0;
|
|
162
|
+
padding-inline: var(--astl-space-2);
|
|
163
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
164
|
+
border-radius: var(--astl-radius-s);
|
|
165
|
+
background: var(--astl-surface);
|
|
166
|
+
color: var(--astl-ink);
|
|
167
|
+
font: inherit;
|
|
168
|
+
font-family: var(--astl-editor-page-title-font-family, var(--astl-font-display));
|
|
169
|
+
font-size: var(--astl-editor-page-title-size, 1.3em);
|
|
170
|
+
font-weight: var(--astl-editor-page-title-weight, 700);
|
|
171
|
+
}
|
|
172
|
+
.astl-surface .astl-page-label:focus-visible,
|
|
173
|
+
.astl-surface
|
|
174
|
+
:is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title):focus-visible {
|
|
175
|
+
outline: var(--astl-focus-width) solid var(--astl-focus);
|
|
176
|
+
outline-offset: var(--astl-focus-offset);
|
|
177
|
+
}
|
|
178
|
+
.astl-surface :is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title) {
|
|
179
|
+
min-block-size: var(--astl-target-min);
|
|
180
|
+
min-inline-size: var(--astl-target-min);
|
|
181
|
+
padding-inline: var(--astl-space-3);
|
|
182
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
183
|
+
border-radius: var(--astl-radius-s);
|
|
184
|
+
background: var(--astl-surface);
|
|
185
|
+
color: var(--astl-ink);
|
|
186
|
+
font: inherit;
|
|
187
|
+
font-size: var(--astl-size-small);
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
}
|
|
190
|
+
.astl-surface :is(.astl-page-join, .astl-page-delete, .astl-page-add-title, .astl-page-remove-title)[hidden] {
|
|
191
|
+
display: none;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* A component in text (a gap): a chip with an icon, its answer and a badge counting the other answers, a long word
|
|
195
|
+
broken inside it rather than past the column. Without an answer it says so, dashed and with a warning icon: never
|
|
196
|
+
by colour alone. */
|
|
197
|
+
.astl-surface .astl-chip {
|
|
198
|
+
box-sizing: border-box;
|
|
199
|
+
display: inline-flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
gap: 0.25em;
|
|
202
|
+
max-inline-size: 100%;
|
|
203
|
+
min-block-size: var(--astl-editor-chip-height, auto);
|
|
204
|
+
padding-inline: 0.35em;
|
|
205
|
+
border: var(--astl-outline-width) solid var(--astl-editor-chip-border, var(--astl-accent));
|
|
206
|
+
border-radius: var(--astl-radius-s);
|
|
207
|
+
background: var(--astl-editor-chip-background, var(--astl-accent-soft));
|
|
208
|
+
color: var(--astl-editor-chip-ink, var(--astl-ink));
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
line-height: 1.3;
|
|
211
|
+
vertical-align: baseline;
|
|
212
|
+
overflow-wrap: anywhere;
|
|
213
|
+
cursor: pointer;
|
|
214
|
+
}
|
|
215
|
+
.astl-surface .astl-chip-icon {
|
|
216
|
+
flex: none;
|
|
217
|
+
inline-size: 0.9em;
|
|
218
|
+
block-size: 0.9em;
|
|
219
|
+
fill: none;
|
|
220
|
+
stroke: currentColor;
|
|
221
|
+
stroke-width: 2.2;
|
|
222
|
+
stroke-linecap: round;
|
|
223
|
+
stroke-linejoin: round;
|
|
224
|
+
}
|
|
225
|
+
.astl-surface .astl-chip-answer {
|
|
226
|
+
min-inline-size: 0;
|
|
227
|
+
}
|
|
228
|
+
.astl-surface .astl-chip-more {
|
|
229
|
+
flex: none;
|
|
230
|
+
padding-inline: 0.35em;
|
|
231
|
+
border-radius: var(--astl-radius-pill);
|
|
232
|
+
background: var(--astl-surface);
|
|
233
|
+
color: var(--astl-ink-muted);
|
|
234
|
+
font-size: var(--astl-size-small);
|
|
235
|
+
font-weight: 600;
|
|
236
|
+
}
|
|
237
|
+
.astl-surface .astl-chip[data-empty] {
|
|
238
|
+
border-style: dashed;
|
|
239
|
+
border-color: var(--astl-danger);
|
|
240
|
+
background: var(--astl-danger-soft);
|
|
241
|
+
font-style: italic;
|
|
242
|
+
font-weight: 400;
|
|
243
|
+
}
|
|
244
|
+
.astl-surface .astl-chip[data-empty] .astl-chip-icon {
|
|
245
|
+
color: var(--astl-danger);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/* The page is one flowing text; a block component on it is framed, with a label tab at the frame's top start (its
|
|
249
|
+
type's icon, its label, a summary). The tab sits on the frame's top border, covering it. The frame with the cursor
|
|
250
|
+
is the accent, its tab filled; one with an error or a warning is dashed in that colour and says its issues under
|
|
251
|
+
the tab, inside the frame. A host draws two states with the hooks: the rest (border width, tab background, ink and
|
|
252
|
+
border) and the cursor's (border width; the tab stays the accent). */
|
|
253
|
+
.astl-surface .astl-frame-tab {
|
|
254
|
+
--frame: var(--astl-line);
|
|
255
|
+
--frame-width: var(--astl-editor-frame-border-width, var(--astl-outline-width));
|
|
256
|
+
position: relative;
|
|
257
|
+
z-index: 1;
|
|
258
|
+
box-sizing: border-box;
|
|
259
|
+
display: flex;
|
|
260
|
+
flex-wrap: wrap;
|
|
261
|
+
align-items: center;
|
|
262
|
+
gap: 0 var(--astl-space-1);
|
|
263
|
+
inline-size: fit-content;
|
|
264
|
+
max-inline-size: 100%;
|
|
265
|
+
margin-block: var(--astl-space-4) calc(-1 * var(--frame-width));
|
|
266
|
+
padding-block: var(--astl-space-1);
|
|
267
|
+
padding-inline: var(--astl-space-2) var(--astl-space-3);
|
|
268
|
+
border: var(--frame-width) var(--frame-line, solid) var(--astl-editor-frame-tab-border, var(--frame));
|
|
269
|
+
border-block-end: 0;
|
|
270
|
+
border-start-start-radius: var(--astl-radius-s);
|
|
271
|
+
border-start-end-radius: var(--astl-radius-s);
|
|
272
|
+
background: var(--astl-editor-frame-tab-background, var(--astl-surface));
|
|
273
|
+
color: var(--astl-editor-frame-tab-ink, var(--astl-ink-muted));
|
|
274
|
+
font-family: var(--astl-font-body);
|
|
275
|
+
font-size: var(--astl-editor-kicker-size, var(--astl-size-small));
|
|
276
|
+
font-style: normal;
|
|
277
|
+
font-weight: 400;
|
|
278
|
+
line-height: 1.3;
|
|
279
|
+
user-select: none;
|
|
280
|
+
}
|
|
281
|
+
.astl-surface .astl-page-head + .astl-frame-head > .astl-frame-tab,
|
|
282
|
+
.astl-surface .ProseMirror > .astl-frame-head:first-child > .astl-frame-tab,
|
|
283
|
+
.astl-surface .astl-page > div > .astl-frame-head:first-child > .astl-frame-tab {
|
|
284
|
+
margin-block-start: 0;
|
|
285
|
+
}
|
|
286
|
+
.astl-surface .astl-frame-type {
|
|
287
|
+
color: var(--astl-editor-frame-tab-ink, var(--astl-ink));
|
|
288
|
+
font-weight: 700;
|
|
289
|
+
}
|
|
290
|
+
.astl-surface .astl-frame-meta::before {
|
|
291
|
+
content: '\\00b7' / '';
|
|
292
|
+
margin-inline-end: var(--astl-space-1);
|
|
293
|
+
}
|
|
294
|
+
.astl-surface :is(.astl-frame, .astl-frame-notes) {
|
|
295
|
+
--frame: var(--astl-line);
|
|
296
|
+
--frame-line: solid;
|
|
297
|
+
--frame-width: var(--astl-editor-frame-border-width, var(--astl-outline-width));
|
|
298
|
+
box-sizing: border-box;
|
|
299
|
+
margin-block: 0;
|
|
300
|
+
padding: var(--frame-pad, var(--astl-editor-frame-padding, var(--astl-space-3)));
|
|
301
|
+
border: var(--frame-width) var(--frame-line) var(--frame);
|
|
302
|
+
border-radius: var(--astl-editor-frame-radius, var(--astl-radius-m));
|
|
303
|
+
border-start-start-radius: 0;
|
|
304
|
+
}
|
|
305
|
+
.astl-surface .astl-frame {
|
|
306
|
+
margin-block-end: var(--astl-space-3);
|
|
307
|
+
}
|
|
308
|
+
.astl-surface .astl-frame-notes {
|
|
309
|
+
display: grid;
|
|
310
|
+
gap: var(--astl-space-1);
|
|
311
|
+
padding-block-end: 0;
|
|
312
|
+
border-block-end: 0;
|
|
313
|
+
border-end-start-radius: 0;
|
|
314
|
+
border-end-end-radius: 0;
|
|
315
|
+
font-family: var(--astl-font-body);
|
|
316
|
+
font-size: var(--astl-size-ui);
|
|
317
|
+
font-style: normal;
|
|
318
|
+
font-weight: 600;
|
|
319
|
+
line-height: 1.4;
|
|
320
|
+
}
|
|
321
|
+
.astl-surface .astl-frame-notes + .astl-frame {
|
|
322
|
+
border-block-start: 0;
|
|
323
|
+
border-start-end-radius: 0;
|
|
324
|
+
}
|
|
325
|
+
/* The frame with the cursor, its notes and its tab. A wider border takes from the padding, so the frame keeps its size
|
|
326
|
+
when the cursor moves in and the text under it does not jump. */
|
|
327
|
+
.astl-surface .astl-frame-current {
|
|
328
|
+
--frame: var(--astl-accent);
|
|
329
|
+
--frame-width: var(
|
|
330
|
+
--astl-editor-frame-current-border-width,
|
|
331
|
+
var(--astl-editor-frame-border-width, var(--astl-outline-width))
|
|
332
|
+
);
|
|
333
|
+
--frame-pad: max(
|
|
334
|
+
0px,
|
|
335
|
+
calc(
|
|
336
|
+
var(--astl-editor-frame-padding, var(--astl-space-3)) +
|
|
337
|
+
var(--astl-editor-frame-border-width, var(--astl-outline-width)) - var(--frame-width)
|
|
338
|
+
)
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
.astl-surface .astl-frame.astl-frame-current {
|
|
342
|
+
box-shadow: inset 0 0 0 var(--astl-editor-frame-current-ring, 0px) var(--astl-accent);
|
|
343
|
+
}
|
|
344
|
+
.astl-surface .astl-frame-tab.astl-frame-current {
|
|
345
|
+
border-color: var(--frame);
|
|
346
|
+
background: var(--astl-accent);
|
|
347
|
+
color: var(--astl-on-accent);
|
|
348
|
+
}
|
|
349
|
+
.astl-surface .astl-frame-tab.astl-frame-current .astl-frame-type {
|
|
350
|
+
color: inherit;
|
|
351
|
+
}
|
|
352
|
+
.astl-surface :is(.astl-frame, .astl-frame-notes, .astl-frame-tab).astl-frame-error {
|
|
353
|
+
--frame: var(--astl-danger);
|
|
354
|
+
--frame-line: dashed;
|
|
355
|
+
}
|
|
356
|
+
.astl-surface :is(.astl-frame, .astl-frame-notes, .astl-frame-tab).astl-frame-warning {
|
|
357
|
+
--frame: var(--astl-warning);
|
|
358
|
+
--frame-line: dashed;
|
|
359
|
+
}
|
|
360
|
+
/* A tab with issues keeps its dashed issue colour, whatever border a host gives the others. */
|
|
361
|
+
.astl-surface .astl-frame-tab:is(.astl-frame-error, .astl-frame-warning) {
|
|
362
|
+
border-color: var(--frame);
|
|
363
|
+
}
|
|
364
|
+
.astl-surface .astl-frame-note {
|
|
365
|
+
display: flex;
|
|
366
|
+
align-items: flex-start;
|
|
367
|
+
gap: var(--astl-space-2);
|
|
368
|
+
padding-block: var(--astl-space-2);
|
|
369
|
+
padding-inline: var(--astl-space-3);
|
|
370
|
+
border-radius: var(--astl-radius-s);
|
|
371
|
+
background: var(--astl-danger-soft);
|
|
372
|
+
color: var(--astl-ink);
|
|
373
|
+
}
|
|
374
|
+
.astl-surface .astl-frame-note .astl-icon {
|
|
375
|
+
color: var(--astl-danger);
|
|
376
|
+
}
|
|
377
|
+
.astl-surface .astl-frame-note[data-severity='warning'] {
|
|
378
|
+
background: var(--astl-warning-soft);
|
|
379
|
+
}
|
|
380
|
+
.astl-surface .astl-frame-note[data-severity='warning'] .astl-icon {
|
|
381
|
+
color: var(--astl-warning);
|
|
382
|
+
}
|
|
383
|
+
.astl-surface .astl-flag,
|
|
384
|
+
.astl-surface .astl-block-add button {
|
|
385
|
+
box-sizing: border-box;
|
|
386
|
+
display: inline-flex;
|
|
387
|
+
align-items: center;
|
|
388
|
+
justify-content: center;
|
|
389
|
+
gap: var(--astl-space-2);
|
|
390
|
+
min-block-size: var(--astl-target-min);
|
|
391
|
+
min-inline-size: var(--astl-target-min);
|
|
392
|
+
margin: 0;
|
|
393
|
+
padding: 0;
|
|
394
|
+
border: var(--astl-outline-width) solid transparent;
|
|
395
|
+
border-radius: var(--astl-radius-m);
|
|
396
|
+
background: transparent;
|
|
397
|
+
color: var(--astl-ink);
|
|
398
|
+
font: inherit;
|
|
399
|
+
cursor: pointer;
|
|
400
|
+
}
|
|
401
|
+
.astl-surface .astl-block-add button:hover {
|
|
402
|
+
border-color: var(--astl-line);
|
|
403
|
+
background: var(--astl-accent-soft);
|
|
404
|
+
}
|
|
405
|
+
.astl-surface .astl-block-add :focus-visible,
|
|
406
|
+
.astl-surface .astl-flag:focus-visible {
|
|
407
|
+
outline: var(--astl-focus-width) solid var(--astl-focus);
|
|
408
|
+
outline-offset: var(--astl-focus-offset);
|
|
409
|
+
}
|
|
410
|
+
.astl-surface .astl-icon {
|
|
411
|
+
flex: none;
|
|
412
|
+
inline-size: 1.25rem;
|
|
413
|
+
block-size: 1.25rem;
|
|
414
|
+
fill: none;
|
|
415
|
+
stroke: currentColor;
|
|
416
|
+
stroke-width: 1.8;
|
|
417
|
+
stroke-linecap: round;
|
|
418
|
+
stroke-linejoin: round;
|
|
419
|
+
}
|
|
420
|
+
.astl-surface .astl-frame-tab .astl-icon {
|
|
421
|
+
inline-size: 1rem;
|
|
422
|
+
block-size: 1rem;
|
|
423
|
+
}
|
|
424
|
+
.astl-surface .astl-icon circle {
|
|
425
|
+
fill: currentColor;
|
|
426
|
+
stroke: none;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/* A block component (a closed question) in its frame: one line per rich child, its picture below. */
|
|
430
|
+
.astl-surface .astl-block {
|
|
431
|
+
position: relative;
|
|
432
|
+
min-inline-size: 0;
|
|
433
|
+
}
|
|
434
|
+
.astl-surface .astl-block > .astl-picture-handle {
|
|
435
|
+
display: none;
|
|
436
|
+
}
|
|
437
|
+
.astl-surface .astl-block:is(.astl-frame-current, .ProseMirror-selectednode) > .astl-picture-handle {
|
|
438
|
+
--half: var(--frame-pad, var(--astl-editor-frame-padding, var(--astl-space-3)));
|
|
439
|
+
display: block;
|
|
440
|
+
inset-block-start: 50%;
|
|
441
|
+
inset-inline: auto calc(-1 * var(--half));
|
|
442
|
+
inline-size: calc(2 * var(--half));
|
|
443
|
+
margin-block-start: calc(var(--astl-target-min) / -2);
|
|
444
|
+
translate: none;
|
|
445
|
+
cursor: ew-resize;
|
|
446
|
+
}
|
|
447
|
+
.astl-surface
|
|
448
|
+
.astl-block[data-astl-position='end']:is(.astl-frame-current, .ProseMirror-selectednode)
|
|
449
|
+
> .astl-picture-handle {
|
|
450
|
+
inset-inline: calc(-1 * var(--half)) auto;
|
|
451
|
+
}
|
|
452
|
+
.astl-surface .astl-frame-head {
|
|
453
|
+
display: flex;
|
|
454
|
+
flex-wrap: wrap-reverse;
|
|
455
|
+
align-items: flex-start;
|
|
456
|
+
gap: var(--astl-space-2);
|
|
457
|
+
}
|
|
458
|
+
.astl-surface .astl-frame-line {
|
|
459
|
+
position: relative;
|
|
460
|
+
z-index: 1;
|
|
461
|
+
box-sizing: border-box;
|
|
462
|
+
visibility: hidden;
|
|
463
|
+
min-block-size: var(--astl-target-min);
|
|
464
|
+
margin-block: 0 var(--astl-space-1);
|
|
465
|
+
margin-inline-start: auto;
|
|
466
|
+
padding-block: var(--astl-space-1);
|
|
467
|
+
padding-inline: var(--astl-space-2);
|
|
468
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
469
|
+
border-radius: var(--astl-radius-s);
|
|
470
|
+
background: var(--astl-surface);
|
|
471
|
+
color: var(--astl-ink);
|
|
472
|
+
font: inherit;
|
|
473
|
+
font-family: var(--astl-font-body);
|
|
474
|
+
font-size: var(--astl-editor-kicker-size, var(--astl-size-small));
|
|
475
|
+
font-style: normal;
|
|
476
|
+
font-weight: 400;
|
|
477
|
+
line-height: 1.3;
|
|
478
|
+
}
|
|
479
|
+
.astl-surface .astl-frame-head-current > .astl-frame-line {
|
|
480
|
+
visibility: visible;
|
|
481
|
+
}
|
|
482
|
+
.astl-surface button.astl-frame-line {
|
|
483
|
+
cursor: pointer;
|
|
484
|
+
}
|
|
485
|
+
.astl-surface button.astl-frame-line:hover {
|
|
486
|
+
background: var(--astl-accent-soft);
|
|
487
|
+
}
|
|
488
|
+
.astl-surface .astl-frame-line:focus-visible {
|
|
489
|
+
outline: var(--astl-focus-width) solid var(--astl-focus);
|
|
490
|
+
outline-offset: var(--astl-focus-offset);
|
|
491
|
+
}
|
|
492
|
+
.astl-surface .astl-block.astl-atom {
|
|
493
|
+
cursor: pointer;
|
|
494
|
+
}
|
|
495
|
+
.astl-surface .astl-atom-summary {
|
|
496
|
+
color: var(--astl-ink);
|
|
497
|
+
}
|
|
498
|
+
/* Help for students: a labelled box in its interaction or at its place on the page, never wider than either. */
|
|
499
|
+
.astl-surface .astl-help-box {
|
|
500
|
+
box-sizing: border-box;
|
|
501
|
+
max-inline-size: 100%;
|
|
502
|
+
margin-block: var(--astl-space-2);
|
|
503
|
+
padding-block: var(--astl-space-1) var(--astl-space-2);
|
|
504
|
+
padding-inline: var(--astl-space-3);
|
|
505
|
+
border: var(--astl-outline-width) dashed var(--astl-outline);
|
|
506
|
+
border-radius: var(--astl-radius-s);
|
|
507
|
+
background: var(--astl-surface-raised);
|
|
508
|
+
}
|
|
509
|
+
.astl-surface .astl-help-head {
|
|
510
|
+
display: flex;
|
|
511
|
+
flex-wrap: wrap;
|
|
512
|
+
align-items: center;
|
|
513
|
+
gap: var(--astl-space-2);
|
|
514
|
+
color: var(--astl-ink-muted);
|
|
515
|
+
font-family: var(--astl-font-body);
|
|
516
|
+
font-size: var(--astl-size-small);
|
|
517
|
+
font-style: normal;
|
|
518
|
+
font-weight: 600;
|
|
519
|
+
}
|
|
520
|
+
.astl-surface .astl-help-head select {
|
|
521
|
+
box-sizing: border-box;
|
|
522
|
+
min-block-size: var(--astl-target-min);
|
|
523
|
+
padding-inline: var(--astl-space-2);
|
|
524
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
525
|
+
border-radius: var(--astl-radius-s);
|
|
526
|
+
background: var(--astl-surface);
|
|
527
|
+
color: var(--astl-ink);
|
|
528
|
+
font: inherit;
|
|
529
|
+
font-weight: 400;
|
|
530
|
+
cursor: pointer;
|
|
531
|
+
}
|
|
532
|
+
.astl-surface .astl-help-head select:focus-visible {
|
|
533
|
+
outline: var(--astl-focus-width) solid var(--astl-focus);
|
|
534
|
+
outline-offset: var(--astl-focus-offset);
|
|
535
|
+
}
|
|
536
|
+
.astl-surface .astl-help-content > :first-child {
|
|
537
|
+
margin-block-start: var(--astl-space-1);
|
|
538
|
+
}
|
|
539
|
+
.astl-surface .astl-help-content > :last-child {
|
|
540
|
+
margin-block-end: 0;
|
|
541
|
+
}
|
|
542
|
+
.astl-surface .astl-child {
|
|
543
|
+
padding-block: var(--astl-space-1);
|
|
544
|
+
padding-inline-start: var(--astl-space-5);
|
|
545
|
+
}
|
|
546
|
+
.astl-surface .astl-child::before {
|
|
547
|
+
content: '\\2022';
|
|
548
|
+
display: inline-block;
|
|
549
|
+
inline-size: var(--astl-space-5);
|
|
550
|
+
margin-inline-start: calc(-1 * var(--astl-space-5));
|
|
551
|
+
color: var(--astl-ink-muted);
|
|
552
|
+
}
|
|
553
|
+
/* A child the type allows once (a prompt) reads as the block's heading. */
|
|
554
|
+
.astl-surface .astl-child.astl-single {
|
|
555
|
+
padding-inline-start: 0;
|
|
556
|
+
font-weight: 600;
|
|
557
|
+
}
|
|
558
|
+
.astl-surface .astl-child.astl-single::before {
|
|
559
|
+
content: none;
|
|
560
|
+
}
|
|
561
|
+
/* A child with a flag (an option): its marker, a round toggle, before its text; set, filled with a check and the
|
|
562
|
+
line tinted. */
|
|
563
|
+
.astl-surface .astl-child.astl-flaggable {
|
|
564
|
+
display: flex;
|
|
565
|
+
align-items: center;
|
|
566
|
+
gap: var(--astl-space-2);
|
|
567
|
+
padding-inline: 0 var(--astl-space-2);
|
|
568
|
+
border-radius: var(--astl-radius-m);
|
|
569
|
+
background: var(--astl-editor-option-background, transparent);
|
|
570
|
+
box-shadow: inset 0 0 0 var(--astl-outline-width) var(--astl-editor-option-border, transparent);
|
|
571
|
+
}
|
|
572
|
+
.astl-surface .astl-flaggable + .astl-flaggable {
|
|
573
|
+
margin-block-start: var(--astl-editor-option-gap, 0px);
|
|
574
|
+
}
|
|
575
|
+
.astl-surface .astl-child.astl-flaggable::before {
|
|
576
|
+
content: none;
|
|
577
|
+
}
|
|
578
|
+
.astl-surface .astl-child-text {
|
|
579
|
+
flex: 1 1 auto;
|
|
580
|
+
min-inline-size: 0;
|
|
581
|
+
}
|
|
582
|
+
.astl-surface .astl-flag {
|
|
583
|
+
flex: none;
|
|
584
|
+
border-radius: var(--astl-radius-pill);
|
|
585
|
+
}
|
|
586
|
+
.astl-surface .astl-flag .astl-icon {
|
|
587
|
+
box-sizing: border-box;
|
|
588
|
+
inline-size: 1.5rem;
|
|
589
|
+
block-size: 1.5rem;
|
|
590
|
+
padding: 0.2rem;
|
|
591
|
+
border: calc(2 * var(--astl-outline-width)) solid var(--astl-outline);
|
|
592
|
+
border-radius: var(--astl-radius-pill);
|
|
593
|
+
stroke: transparent;
|
|
594
|
+
stroke-width: 2.6;
|
|
595
|
+
}
|
|
596
|
+
.astl-surface .astl-flag[aria-pressed='true'] .astl-icon {
|
|
597
|
+
border-color: var(--astl-editor-flag, var(--astl-success));
|
|
598
|
+
background: var(--astl-editor-flag, var(--astl-success));
|
|
599
|
+
stroke: var(--astl-on-success);
|
|
600
|
+
}
|
|
601
|
+
.astl-surface .astl-child[data-flagged] {
|
|
602
|
+
background: var(--astl-success-soft);
|
|
603
|
+
}
|
|
604
|
+
.astl-surface .astl-block-add {
|
|
605
|
+
padding-block-start: var(--astl-space-1);
|
|
606
|
+
}
|
|
607
|
+
.astl-surface .astl-block-add button {
|
|
608
|
+
padding-inline: var(--astl-space-2) var(--astl-space-3);
|
|
609
|
+
color: var(--astl-accent);
|
|
610
|
+
font-weight: 600;
|
|
611
|
+
}
|
|
612
|
+
.astl-surface .astl-block-add button:disabled {
|
|
613
|
+
color: var(--astl-ink-muted);
|
|
614
|
+
cursor: not-allowed;
|
|
615
|
+
}
|
|
616
|
+
.astl-surface div.astl-chip {
|
|
617
|
+
display: block;
|
|
618
|
+
inline-size: fit-content;
|
|
619
|
+
margin-block: var(--astl-space-1);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/* An inline child of a rich block (a word to select): underlined; filled while its flag is set (a correct word). */
|
|
623
|
+
.astl-surface .astl-mark {
|
|
624
|
+
border-block-end: var(--astl-outline-width) dashed var(--astl-ink-muted);
|
|
625
|
+
}
|
|
626
|
+
.astl-surface .astl-mark[data-flagged] {
|
|
627
|
+
border-block-end: var(--astl-outline-width) solid var(--astl-accent);
|
|
628
|
+
background: var(--astl-accent-soft);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/* The selected atom or block gets the focus ring. */
|
|
632
|
+
.astl-surface .ProseMirror-selectednode {
|
|
633
|
+
outline: var(--astl-focus-width) solid var(--astl-focus);
|
|
634
|
+
outline-offset: var(--astl-focus-offset);
|
|
635
|
+
}
|
|
636
|
+
@media (forced-colors: active) {
|
|
637
|
+
.astl-surface .astl-frame-current {
|
|
638
|
+
--frame: Highlight;
|
|
639
|
+
}
|
|
640
|
+
.astl-surface .astl-frame-tab.astl-frame-current {
|
|
641
|
+
background: Highlight;
|
|
642
|
+
color: HighlightText;
|
|
643
|
+
forced-color-adjust: none;
|
|
644
|
+
}
|
|
645
|
+
.astl-surface .astl-flag[aria-pressed='true'] .astl-icon {
|
|
646
|
+
border-color: CanvasText;
|
|
647
|
+
background: CanvasText;
|
|
648
|
+
stroke: Canvas;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.astl-surface .astl-picture {
|
|
653
|
+
display: inline-flex;
|
|
654
|
+
flex-direction: column;
|
|
655
|
+
gap: var(--astl-space-1);
|
|
656
|
+
max-inline-size: 100%;
|
|
657
|
+
vertical-align: middle;
|
|
658
|
+
cursor: pointer;
|
|
659
|
+
}
|
|
660
|
+
.astl-surface .astl-picture img {
|
|
661
|
+
max-inline-size: 100%;
|
|
662
|
+
block-size: auto;
|
|
663
|
+
}
|
|
664
|
+
.astl-surface .astl-picture-alt {
|
|
665
|
+
color: var(--astl-ink-muted);
|
|
666
|
+
font-size: var(--astl-size-small);
|
|
667
|
+
line-height: 1.3;
|
|
668
|
+
overflow-wrap: anywhere;
|
|
669
|
+
}
|
|
670
|
+
.astl-surface .astl-picture-edit,
|
|
671
|
+
.astl-surface .astl-picture-place,
|
|
672
|
+
.astl-surface .astl-picture-handle {
|
|
673
|
+
display: none;
|
|
674
|
+
}
|
|
675
|
+
.astl-surface .astl-picture.ProseMirror-selectednode :is(.astl-picture-edit, .astl-picture-place),
|
|
676
|
+
.astl-surface .astl-figure .astl-picture-edit,
|
|
677
|
+
.astl-surface .astl-figure-current .astl-picture-place,
|
|
678
|
+
.astl-surface .astl-figure.ProseMirror-selectednode .astl-picture-place {
|
|
679
|
+
display: inline-flex;
|
|
680
|
+
align-items: center;
|
|
681
|
+
}
|
|
682
|
+
.astl-surface .astl-picture.ProseMirror-selectednode > .astl-picture-handle,
|
|
683
|
+
.astl-surface .astl-figure-current .astl-picture-handle,
|
|
684
|
+
.astl-surface .astl-figure.ProseMirror-selectednode .astl-picture-handle {
|
|
685
|
+
display: block;
|
|
686
|
+
}
|
|
687
|
+
.astl-surface .astl-picture {
|
|
688
|
+
position: relative;
|
|
689
|
+
}
|
|
690
|
+
.astl-surface .astl-picture-tools {
|
|
691
|
+
display: flex;
|
|
692
|
+
flex-wrap: wrap;
|
|
693
|
+
gap: var(--astl-space-1);
|
|
694
|
+
}
|
|
695
|
+
.astl-surface .astl-picture-alt {
|
|
696
|
+
display: block;
|
|
697
|
+
}
|
|
698
|
+
.astl-surface .astl-picture[style*='width'] img,
|
|
699
|
+
.astl-surface .astl-figure[style*='width'] .astl-picture img {
|
|
700
|
+
inline-size: 100%;
|
|
701
|
+
}
|
|
702
|
+
.astl-surface .astl-picture[data-astl-position='center'],
|
|
703
|
+
.astl-surface .astl-picture[data-astl-position='full'] {
|
|
704
|
+
inline-size: fit-content;
|
|
705
|
+
}
|
|
706
|
+
.astl-surface .astl-picture[style*='display'] img {
|
|
707
|
+
display: block;
|
|
708
|
+
}
|
|
709
|
+
.astl-surface .astl-figure > .astl-picture {
|
|
710
|
+
inline-size: auto;
|
|
711
|
+
}
|
|
712
|
+
.astl-surface .astl-picture-handle {
|
|
713
|
+
position: absolute;
|
|
714
|
+
z-index: 1;
|
|
715
|
+
inset-block-start: 0;
|
|
716
|
+
inset-inline-end: 0;
|
|
717
|
+
inline-size: var(--astl-target-min);
|
|
718
|
+
block-size: var(--astl-target-min);
|
|
719
|
+
translate: 25% -25%;
|
|
720
|
+
cursor: nesw-resize;
|
|
721
|
+
touch-action: none;
|
|
722
|
+
}
|
|
723
|
+
.astl-surface .astl-picture-handle::after {
|
|
724
|
+
content: '';
|
|
725
|
+
position: absolute;
|
|
726
|
+
inset: 0;
|
|
727
|
+
margin: auto;
|
|
728
|
+
inline-size: var(--astl-space-3);
|
|
729
|
+
block-size: var(--astl-space-3);
|
|
730
|
+
border: var(--astl-focus-width) solid var(--astl-surface);
|
|
731
|
+
border-radius: 50%;
|
|
732
|
+
background: var(--astl-accent);
|
|
733
|
+
box-shadow: 0 0 0 var(--astl-outline-width) var(--astl-accent);
|
|
734
|
+
}
|
|
735
|
+
.astl-surface .astl-picture[data-astl-position='end'] > .astl-picture-handle {
|
|
736
|
+
inset-inline: 0 auto;
|
|
737
|
+
translate: -25% -25%;
|
|
738
|
+
cursor: nwse-resize;
|
|
739
|
+
}
|
|
740
|
+
.astl-surface .astl-picture-place {
|
|
741
|
+
align-self: flex-start;
|
|
742
|
+
color: var(--astl-ink-muted);
|
|
743
|
+
font-size: var(--astl-size-small);
|
|
744
|
+
}
|
|
745
|
+
.astl-surface button.astl-picture-place {
|
|
746
|
+
min-block-size: var(--astl-target-min);
|
|
747
|
+
min-inline-size: var(--astl-target-min);
|
|
748
|
+
padding-inline: var(--astl-space-2);
|
|
749
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
750
|
+
border-radius: var(--astl-radius-s);
|
|
751
|
+
background: var(--astl-surface);
|
|
752
|
+
color: var(--astl-ink);
|
|
753
|
+
font: inherit;
|
|
754
|
+
font-size: var(--astl-size-small);
|
|
755
|
+
cursor: pointer;
|
|
756
|
+
}
|
|
757
|
+
.astl-surface .astl-picture-edit {
|
|
758
|
+
align-self: flex-start;
|
|
759
|
+
min-block-size: var(--astl-target-min);
|
|
760
|
+
min-inline-size: var(--astl-target-min);
|
|
761
|
+
padding-inline: var(--astl-space-2);
|
|
762
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
763
|
+
border-radius: var(--astl-radius-s);
|
|
764
|
+
background: var(--astl-surface);
|
|
765
|
+
color: var(--astl-ink);
|
|
766
|
+
font: inherit;
|
|
767
|
+
font-size: var(--astl-size-small);
|
|
768
|
+
cursor: pointer;
|
|
769
|
+
}
|
|
770
|
+
.astl-surface .astl-figure {
|
|
771
|
+
margin-block: 0 var(--astl-space-3);
|
|
772
|
+
margin-inline: 0;
|
|
773
|
+
}
|
|
774
|
+
.astl-surface .astl-figure .astl-picture {
|
|
775
|
+
display: flex;
|
|
776
|
+
}
|
|
777
|
+
.astl-surface .astl-figure figcaption {
|
|
778
|
+
margin-block: var(--astl-space-1);
|
|
779
|
+
padding-inline-start: var(--astl-space-2);
|
|
780
|
+
border-inline-start: var(--astl-outline-width) solid var(--astl-line);
|
|
781
|
+
font-size: var(--astl-size-small);
|
|
782
|
+
}
|
|
783
|
+
`;
|
|
784
|
+
// A block with picture fields shows its picture with the zones and pins numbered on it, in the palette colour of their
|
|
785
|
+
// number, as the inspector's picture field draws them; a flag's zones solid, the others dashed. The picture never
|
|
786
|
+
// mirrors (coordinates count from its left edge).
|
|
787
|
+
const zoneStyles = css `
|
|
788
|
+
.astl-surface .astl-zones {
|
|
789
|
+
display: flex;
|
|
790
|
+
flex-direction: column;
|
|
791
|
+
gap: var(--astl-space-1);
|
|
792
|
+
margin-block-start: var(--astl-space-2);
|
|
793
|
+
max-inline-size: 32rem;
|
|
794
|
+
user-select: none;
|
|
795
|
+
}
|
|
796
|
+
.astl-surface .astl-zones-frame {
|
|
797
|
+
position: relative;
|
|
798
|
+
direction: ltr;
|
|
799
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
800
|
+
background: var(--astl-canvas);
|
|
801
|
+
}
|
|
802
|
+
.astl-surface .astl-zones-frame img,
|
|
803
|
+
.astl-surface .astl-zones-frame svg {
|
|
804
|
+
position: absolute;
|
|
805
|
+
inset: 0;
|
|
806
|
+
inline-size: 100%;
|
|
807
|
+
block-size: 100%;
|
|
808
|
+
}
|
|
809
|
+
.astl-surface .astl-zones-frame svg {
|
|
810
|
+
overflow: visible;
|
|
811
|
+
}
|
|
812
|
+
.astl-surface .astl-zone {
|
|
813
|
+
fill: var(--soft);
|
|
814
|
+
fill-opacity: 0.4;
|
|
815
|
+
stroke: var(--line);
|
|
816
|
+
stroke-width: 2;
|
|
817
|
+
vector-effect: non-scaling-stroke;
|
|
818
|
+
}
|
|
819
|
+
.astl-surface .astl-zone-dashed {
|
|
820
|
+
fill-opacity: 0.15;
|
|
821
|
+
stroke-dasharray: 6 4;
|
|
822
|
+
}
|
|
823
|
+
.astl-surface .astl-zone-badge {
|
|
824
|
+
position: absolute;
|
|
825
|
+
inset-inline-start: var(--x);
|
|
826
|
+
inset-block-start: var(--y);
|
|
827
|
+
translate: -50% -50%;
|
|
828
|
+
display: inline-flex;
|
|
829
|
+
align-items: center;
|
|
830
|
+
justify-content: center;
|
|
831
|
+
box-sizing: border-box;
|
|
832
|
+
min-inline-size: 1.5rem;
|
|
833
|
+
block-size: 1.5rem;
|
|
834
|
+
padding-inline: var(--astl-space-1);
|
|
835
|
+
border: var(--astl-outline-width) solid var(--line);
|
|
836
|
+
border-radius: 999px;
|
|
837
|
+
background: var(--astl-surface);
|
|
838
|
+
color: var(--astl-ink);
|
|
839
|
+
font-size: var(--astl-size-small);
|
|
840
|
+
font-weight: 700;
|
|
841
|
+
}
|
|
842
|
+
.astl-surface .astl-zone-pin {
|
|
843
|
+
border-width: calc(2 * var(--astl-outline-width));
|
|
844
|
+
}
|
|
845
|
+
@media (forced-colors: active) {
|
|
846
|
+
.astl-surface .astl-zone {
|
|
847
|
+
fill: none;
|
|
848
|
+
stroke: CanvasText;
|
|
849
|
+
}
|
|
850
|
+
.astl-surface .astl-zone-badge {
|
|
851
|
+
border-color: CanvasText;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
`;
|
|
855
|
+
/** The palette slot of a zone's number: `c1` to `c8`. */
|
|
856
|
+
const zonePalette = unsafeCSS(Array.from({ length: 8 }, (_, i) => `.astl-surface .astl-zones .c${i + 1}{--line:var(--astl-palette-${i + 1});--soft:var(--astl-palette-${i + 1}-soft)}`).join(''));
|
|
857
|
+
// Authors' styles and layouts, as the player draws them: floats stay in their page, no style makes the surface scroll
|
|
858
|
+
// sideways, and columns wrap by themselves. A column's edge is the surface's own: the student sees none.
|
|
859
|
+
const layoutStyles = css `
|
|
860
|
+
.astl-surface .ProseMirror,
|
|
861
|
+
.astl-surface .astl-page > div {
|
|
862
|
+
display: flow-root;
|
|
863
|
+
}
|
|
864
|
+
.astl-surface .ProseMirror [style] {
|
|
865
|
+
box-sizing: border-box;
|
|
866
|
+
max-inline-size: 100%;
|
|
867
|
+
}
|
|
868
|
+
.astl-surface {
|
|
869
|
+
container-type: inline-size;
|
|
870
|
+
}
|
|
871
|
+
/* Under the player's 30rem: a page beside a host's card is about 28rem wide and must show the place the author chose. */
|
|
872
|
+
@container (max-inline-size: 24rem) {
|
|
873
|
+
.astl-surface .ProseMirror [style*='float'] {
|
|
874
|
+
float: none !important;
|
|
875
|
+
inline-size: auto !important;
|
|
876
|
+
}
|
|
877
|
+
.astl-surface .ProseMirror [style*='margin']:not([style*='auto']) {
|
|
878
|
+
margin-inline: 0 !important;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
.astl-surface astl-columns {
|
|
882
|
+
display: flex;
|
|
883
|
+
flex-wrap: wrap;
|
|
884
|
+
clear: both;
|
|
885
|
+
gap: var(--astl-space-4);
|
|
886
|
+
margin-block-end: var(--astl-space-4);
|
|
887
|
+
}
|
|
888
|
+
.astl-surface astl-columns > astl-column {
|
|
889
|
+
box-sizing: border-box;
|
|
890
|
+
flex: 1 1 0;
|
|
891
|
+
min-inline-size: min(10rem, 100%);
|
|
892
|
+
padding: var(--astl-space-2);
|
|
893
|
+
border: var(--astl-outline-width) dashed var(--astl-line);
|
|
894
|
+
border-radius: var(--astl-radius-s);
|
|
895
|
+
}
|
|
896
|
+
.astl-surface astl-columns > astl-column:has(.astl-frame) {
|
|
897
|
+
min-inline-size: min(var(--astl-editor-column-with-component, 20rem), 100%);
|
|
898
|
+
}
|
|
899
|
+
/* The layout with the cursor: its columns' edges solid, in the accent colour, as wide as before, so nothing on the page
|
|
900
|
+
moves when the cursor comes in. A host's line to the layout meets the last column's edge. */
|
|
901
|
+
.astl-surface astl-columns.astl-layout-current > astl-column {
|
|
902
|
+
border-style: solid;
|
|
903
|
+
border-color: var(--astl-accent);
|
|
904
|
+
}
|
|
905
|
+
@media (forced-colors: active) {
|
|
906
|
+
.astl-surface astl-columns.astl-layout-current > astl-column {
|
|
907
|
+
border-color: Highlight;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
`;
|
|
911
|
+
const surfaceStyles = css `${baseSurfaceStyles}${zoneStyles}${zonePalette}${layoutStyles}`;
|
|
912
|
+
/** Adopts the surface stylesheet into the document or shadow root holding `node`, once. */
|
|
913
|
+
export function adoptSurfaceStyles(node) {
|
|
914
|
+
const root = node.getRootNode();
|
|
915
|
+
const sheet = surfaceStyles.styleSheet;
|
|
916
|
+
if (sheet === undefined || root.adoptedStyleSheets === undefined)
|
|
917
|
+
return;
|
|
918
|
+
if (!root.adoptedStyleSheets.includes(sheet))
|
|
919
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
920
|
+
}
|
|
921
|
+
//# sourceMappingURL=styles.js.map
|