@simai-studio/mail 0.0.0-stage → 1.0.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.
Files changed (191) hide show
  1. package/LICENSE.md +188 -0
  2. package/README.md +79 -2
  3. package/dist/package-receipt.json +1176 -0
  4. package/dist/set.json +97 -0
  5. package/dist/smart/mail-canvas/component.json +562 -0
  6. package/dist/smart/mail-canvas/component.json.gz +0 -0
  7. package/dist/smart/mail-canvas/css/mail-canvas.css +85 -0
  8. package/dist/smart/mail-canvas/css/mail-canvas.css.gz +0 -0
  9. package/dist/smart/mail-canvas/css/mail-canvas.min.css +2 -0
  10. package/dist/smart/mail-canvas/css/mail-canvas.min.css.gz +0 -0
  11. package/dist/smart/mail-canvas/examples.json +731 -0
  12. package/dist/smart/mail-canvas/examples.json.gz +0 -0
  13. package/dist/smart/mail-canvas/js/mail-canvas.js +1039 -0
  14. package/dist/smart/mail-canvas/js/mail-canvas.js.gz +0 -0
  15. package/dist/smart/mail-canvas/js/mail-canvas.min.js +22 -0
  16. package/dist/smart/mail-canvas/js/mail-canvas.min.js.gz +0 -0
  17. package/dist/smart/mail-canvas/lang/en.json +25 -0
  18. package/dist/smart/mail-canvas/lang/en.json.gz +0 -0
  19. package/dist/smart/mail-canvas/lang/ru.json +25 -0
  20. package/dist/smart/mail-canvas/lang/ru.json.gz +0 -0
  21. package/dist/smart/mail-canvas/probe.json +465 -0
  22. package/dist/smart/mail-canvas/probe.json.gz +0 -0
  23. package/dist/smart/mail-canvas/smart.manifest.json +550 -0
  24. package/dist/smart/mail-canvas/smart.manifest.json.gz +0 -0
  25. package/dist/smart/mail-canvas/static/default/notes.html +43 -0
  26. package/dist/smart/mail-canvas/static/default/notes.html.gz +0 -0
  27. package/dist/smart/mail-canvas/static/default/phone.html +43 -0
  28. package/dist/smart/mail-canvas/static/default/phone.html.gz +0 -0
  29. package/dist/smart/mail-canvas/static/default/reference.html +48 -0
  30. package/dist/smart/mail-canvas/static/default/reference.html.gz +0 -0
  31. package/dist/smart/mail-canvas/static/sheets.json +132 -0
  32. package/dist/smart/mail-canvas/static/sheets.json.gz +0 -0
  33. package/dist/smart/mail-canvas/studio.fixture.json +63 -0
  34. package/dist/smart/mail-canvas/studio.fixture.json.gz +0 -0
  35. package/dist/smart/mail-canvas/studio.scenario.json +39 -0
  36. package/dist/smart/mail-canvas/studio.scenario.json.gz +0 -0
  37. package/dist/smart/mail-canvas/template/default.css +73 -0
  38. package/dist/smart/mail-canvas/template/default.css.gz +0 -0
  39. package/dist/smart/mail-canvas/template/default.js +38 -0
  40. package/dist/smart/mail-canvas/template/default.js.gz +0 -0
  41. package/dist/smart/mail-inspector/component.json +768 -0
  42. package/dist/smart/mail-inspector/component.json.gz +0 -0
  43. package/dist/smart/mail-inspector/css/mail-inspector.css +194 -0
  44. package/dist/smart/mail-inspector/css/mail-inspector.css.gz +0 -0
  45. package/dist/smart/mail-inspector/css/mail-inspector.min.css +2 -0
  46. package/dist/smart/mail-inspector/css/mail-inspector.min.css.gz +0 -0
  47. package/dist/smart/mail-inspector/examples.json +1301 -0
  48. package/dist/smart/mail-inspector/examples.json.gz +0 -0
  49. package/dist/smart/mail-inspector/js/mail-inspector.js +1619 -0
  50. package/dist/smart/mail-inspector/js/mail-inspector.js.gz +0 -0
  51. package/dist/smart/mail-inspector/js/mail-inspector.min.js +103 -0
  52. package/dist/smart/mail-inspector/js/mail-inspector.min.js.gz +0 -0
  53. package/dist/smart/mail-inspector/lang/en.json +29 -0
  54. package/dist/smart/mail-inspector/lang/en.json.gz +0 -0
  55. package/dist/smart/mail-inspector/lang/ru.json +29 -0
  56. package/dist/smart/mail-inspector/lang/ru.json.gz +0 -0
  57. package/dist/smart/mail-inspector/probe.json +648 -0
  58. package/dist/smart/mail-inspector/probe.json.gz +0 -0
  59. package/dist/smart/mail-inspector/smart.manifest.json +920 -0
  60. package/dist/smart/mail-inspector/smart.manifest.json.gz +0 -0
  61. package/dist/smart/mail-inspector/static/default/item.html +189 -0
  62. package/dist/smart/mail-inspector/static/default/item.html.gz +0 -0
  63. package/dist/smart/mail-inspector/static/default/letter.html +247 -0
  64. package/dist/smart/mail-inspector/static/default/letter.html.gz +0 -0
  65. package/dist/smart/mail-inspector/static/default/reference.html +545 -0
  66. package/dist/smart/mail-inspector/static/default/reference.html.gz +0 -0
  67. package/dist/smart/mail-inspector/static/sheets.json +226 -0
  68. package/dist/smart/mail-inspector/static/sheets.json.gz +0 -0
  69. package/dist/smart/mail-inspector/studio.fixture.json +232 -0
  70. package/dist/smart/mail-inspector/studio.fixture.json.gz +0 -0
  71. package/dist/smart/mail-inspector/studio.scenario.json +43 -0
  72. package/dist/smart/mail-inspector/studio.scenario.json.gz +0 -0
  73. package/dist/smart/mail-inspector/template/default.css +190 -0
  74. package/dist/smart/mail-inspector/template/default.css.gz +0 -0
  75. package/dist/smart/mail-inspector/template/default.js +249 -0
  76. package/dist/smart/mail-inspector/template/default.js.gz +0 -0
  77. package/dist/smart/mail-letters/component.json +455 -0
  78. package/dist/smart/mail-letters/component.json.gz +0 -0
  79. package/dist/smart/mail-letters/css/mail-letters.css +72 -0
  80. package/dist/smart/mail-letters/css/mail-letters.css.gz +0 -0
  81. package/dist/smart/mail-letters/css/mail-letters.min.css +2 -0
  82. package/dist/smart/mail-letters/css/mail-letters.min.css.gz +0 -0
  83. package/dist/smart/mail-letters/examples.json +477 -0
  84. package/dist/smart/mail-letters/examples.json.gz +0 -0
  85. package/dist/smart/mail-letters/js/mail-letters.js +1772 -0
  86. package/dist/smart/mail-letters/js/mail-letters.js.gz +0 -0
  87. package/dist/smart/mail-letters/js/mail-letters.min.js +35 -0
  88. package/dist/smart/mail-letters/js/mail-letters.min.js.gz +0 -0
  89. package/dist/smart/mail-letters/lang/en.json +29 -0
  90. package/dist/smart/mail-letters/lang/en.json.gz +0 -0
  91. package/dist/smart/mail-letters/lang/ru.json +31 -0
  92. package/dist/smart/mail-letters/lang/ru.json.gz +0 -0
  93. package/dist/smart/mail-letters/probe.json +290 -0
  94. package/dist/smart/mail-letters/probe.json.gz +0 -0
  95. package/dist/smart/mail-letters/smart.manifest.json +476 -0
  96. package/dist/smart/mail-letters/smart.manifest.json.gz +0 -0
  97. package/dist/smart/mail-letters/static/default/by-title.html +177 -0
  98. package/dist/smart/mail-letters/static/default/by-title.html.gz +0 -0
  99. package/dist/smart/mail-letters/static/default/empty.html +88 -0
  100. package/dist/smart/mail-letters/static/default/empty.html.gz +0 -0
  101. package/dist/smart/mail-letters/static/default/nothing-found.html +88 -0
  102. package/dist/smart/mail-letters/static/default/nothing-found.html.gz +0 -0
  103. package/dist/smart/mail-letters/static/default/reference.html +168 -0
  104. package/dist/smart/mail-letters/static/default/reference.html.gz +0 -0
  105. package/dist/smart/mail-letters/static/sheets.json +245 -0
  106. package/dist/smart/mail-letters/static/sheets.json.gz +0 -0
  107. package/dist/smart/mail-letters/studio.fixture.json +41 -0
  108. package/dist/smart/mail-letters/studio.fixture.json.gz +0 -0
  109. package/dist/smart/mail-letters/studio.scenario.json +41 -0
  110. package/dist/smart/mail-letters/studio.scenario.json.gz +0 -0
  111. package/dist/smart/mail-letters/template/default.css +79 -0
  112. package/dist/smart/mail-letters/template/default.css.gz +0 -0
  113. package/dist/smart/mail-letters/template/default.js +61 -0
  114. package/dist/smart/mail-letters/template/default.js.gz +0 -0
  115. package/dist/smart/mail-library/component.json +512 -0
  116. package/dist/smart/mail-library/component.json.gz +0 -0
  117. package/dist/smart/mail-library/css/mail-library.css +149 -0
  118. package/dist/smart/mail-library/css/mail-library.css.gz +0 -0
  119. package/dist/smart/mail-library/css/mail-library.min.css +2 -0
  120. package/dist/smart/mail-library/css/mail-library.min.css.gz +0 -0
  121. package/dist/smart/mail-library/examples.json +616 -0
  122. package/dist/smart/mail-library/examples.json.gz +0 -0
  123. package/dist/smart/mail-library/js/mail-library.js +559 -0
  124. package/dist/smart/mail-library/js/mail-library.js.gz +0 -0
  125. package/dist/smart/mail-library/js/mail-library.min.js +52 -0
  126. package/dist/smart/mail-library/js/mail-library.min.js.gz +0 -0
  127. package/dist/smart/mail-library/lang/en.json +21 -0
  128. package/dist/smart/mail-library/lang/en.json.gz +0 -0
  129. package/dist/smart/mail-library/lang/ru.json +21 -0
  130. package/dist/smart/mail-library/lang/ru.json.gz +0 -0
  131. package/dist/smart/mail-library/probe.json +275 -0
  132. package/dist/smart/mail-library/probe.json.gz +0 -0
  133. package/dist/smart/mail-library/smart.manifest.json +512 -0
  134. package/dist/smart/mail-library/smart.manifest.json.gz +0 -0
  135. package/dist/smart/mail-library/static/default/category.html +85 -0
  136. package/dist/smart/mail-library/static/default/category.html.gz +0 -0
  137. package/dist/smart/mail-library/static/default/nothing-found.html +81 -0
  138. package/dist/smart/mail-library/static/default/nothing-found.html.gz +0 -0
  139. package/dist/smart/mail-library/static/default/one-group.html +67 -0
  140. package/dist/smart/mail-library/static/default/one-group.html.gz +0 -0
  141. package/dist/smart/mail-library/static/default/reference.html +135 -0
  142. package/dist/smart/mail-library/static/default/reference.html.gz +0 -0
  143. package/dist/smart/mail-library/static/sheets.json +180 -0
  144. package/dist/smart/mail-library/static/sheets.json.gz +0 -0
  145. package/dist/smart/mail-library/studio.fixture.json +75 -0
  146. package/dist/smart/mail-library/studio.fixture.json.gz +0 -0
  147. package/dist/smart/mail-library/studio.scenario.json +41 -0
  148. package/dist/smart/mail-library/studio.scenario.json.gz +0 -0
  149. package/dist/smart/mail-library/template/default.css +133 -0
  150. package/dist/smart/mail-library/template/default.css.gz +0 -0
  151. package/dist/smart/mail-library/template/default.js +83 -0
  152. package/dist/smart/mail-library/template/default.js.gz +0 -0
  153. package/dist/smart/mail-structure/component.json +497 -0
  154. package/dist/smart/mail-structure/component.json.gz +0 -0
  155. package/dist/smart/mail-structure/css/mail-structure.css +106 -0
  156. package/dist/smart/mail-structure/css/mail-structure.css.gz +0 -0
  157. package/dist/smart/mail-structure/css/mail-structure.min.css +2 -0
  158. package/dist/smart/mail-structure/css/mail-structure.min.css.gz +0 -0
  159. package/dist/smart/mail-structure/examples.json +286 -0
  160. package/dist/smart/mail-structure/examples.json.gz +0 -0
  161. package/dist/smart/mail-structure/js/mail-structure.js +767 -0
  162. package/dist/smart/mail-structure/js/mail-structure.js.gz +0 -0
  163. package/dist/smart/mail-structure/js/mail-structure.min.js +48 -0
  164. package/dist/smart/mail-structure/js/mail-structure.min.js.gz +0 -0
  165. package/dist/smart/mail-structure/lang/en.json +22 -0
  166. package/dist/smart/mail-structure/lang/en.json.gz +0 -0
  167. package/dist/smart/mail-structure/lang/ru.json +22 -0
  168. package/dist/smart/mail-structure/lang/ru.json.gz +0 -0
  169. package/dist/smart/mail-structure/probe.json +112 -0
  170. package/dist/smart/mail-structure/probe.json.gz +0 -0
  171. package/dist/smart/mail-structure/smart.manifest.json +495 -0
  172. package/dist/smart/mail-structure/smart.manifest.json.gz +0 -0
  173. package/dist/smart/mail-structure/static/default/empty.html +76 -0
  174. package/dist/smart/mail-structure/static/default/empty.html.gz +0 -0
  175. package/dist/smart/mail-structure/static/default/reference.html +98 -0
  176. package/dist/smart/mail-structure/static/default/reference.html.gz +0 -0
  177. package/dist/smart/mail-structure/static/default/settings.html +98 -0
  178. package/dist/smart/mail-structure/static/default/settings.html.gz +0 -0
  179. package/dist/smart/mail-structure/static/sheets.json +142 -0
  180. package/dist/smart/mail-structure/static/sheets.json.gz +0 -0
  181. package/dist/smart/mail-structure/studio.fixture.json +45 -0
  182. package/dist/smart/mail-structure/studio.fixture.json.gz +0 -0
  183. package/dist/smart/mail-structure/studio.scenario.json +42 -0
  184. package/dist/smart/mail-structure/studio.scenario.json.gz +0 -0
  185. package/dist/smart/mail-structure/template/default.css +100 -0
  186. package/dist/smart/mail-structure/template/default.css.gz +0 -0
  187. package/dist/smart/mail-structure/template/default.js +80 -0
  188. package/dist/smart/mail-structure/template/default.js.gz +0 -0
  189. package/dist/smart/rule.js +161 -0
  190. package/dist/smart/rule.js.gz +0 -0
  191. package/package.json +29 -4
@@ -0,0 +1,731 @@
1
+ {
2
+ "examples": [
3
+ {
4
+ "name": "reference",
5
+ "title": "Письмо на ширине 600, выбран текст",
6
+ "attributes": {
7
+ "box-attribute": "data-block-box",
8
+ "paper": ".email",
9
+ "selected": "b2",
10
+ "width": "600"
11
+ },
12
+ "settings": {
13
+ "html": "<!doctype html><html lang=\"ru\"><head><meta charset=\"utf-8\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\"email\"><div data-block=\"b1\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\"b2\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\"b3\"><div data-block-box><a href=\"https://example.com/\">Подробнее</a></div></div></div></body></html>",
14
+ "widths": [
15
+ {
16
+ "value": "600",
17
+ "label": "Компьютер 600",
18
+ "icon": "desktop_windows",
19
+ "frame": 680
20
+ },
21
+ {
22
+ "value": "375",
23
+ "label": "Телефон 375",
24
+ "icon": "smartphone"
25
+ },
26
+ {
27
+ "value": "320",
28
+ "label": "Узкий 320",
29
+ "icon": "phone_iphone"
30
+ }
31
+ ],
32
+ "items": [
33
+ {
34
+ "id": "b1",
35
+ "label": "Заголовок"
36
+ },
37
+ {
38
+ "id": "b2",
39
+ "label": "Текст"
40
+ },
41
+ {
42
+ "id": "b3",
43
+ "label": "Кнопка"
44
+ }
45
+ ],
46
+ "actions": [
47
+ {
48
+ "id": "up",
49
+ "label": "Выше"
50
+ },
51
+ {
52
+ "id": "down",
53
+ "label": "Ниже"
54
+ },
55
+ {
56
+ "id": "remove",
57
+ "label": "Удалить"
58
+ }
59
+ ]
60
+ },
61
+ "first-paint": {
62
+ "max-bytes": 11000,
63
+ "why": "the width switch of three buttons and the overlay's tree with its toolbar for the chosen block: the keyboard's way into the letter is the first paint; the frame prints closed, its box reserved"
64
+ },
65
+ "studio": {
66
+ "id": "canvas-reference",
67
+ "title": "Mail canvas reference",
68
+ "summary": "Deterministic reference fixture for sf-mail-canvas: a letter of three blocks at 600, the text chosen.",
69
+ "props": {
70
+ "selected": "b2",
71
+ "width": "600",
72
+ "box-attribute": "data-block-box",
73
+ "paper": ".email",
74
+ "html": "<!doctype html><html lang=\"ru\"><head><meta charset=\"utf-8\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\"email\"><div data-block=\"b1\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\"b2\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\"b3\"><div data-block-box><a href=\"https://example.com/\">Подробнее</a></div></div></div></body></html>",
75
+ "widths": [
76
+ {
77
+ "value": "600",
78
+ "label": "Компьютер 600",
79
+ "icon": "desktop_windows",
80
+ "frame": 680
81
+ },
82
+ {
83
+ "value": "375",
84
+ "label": "Телефон 375",
85
+ "icon": "smartphone"
86
+ },
87
+ {
88
+ "value": "320",
89
+ "label": "Узкий 320",
90
+ "icon": "phone_iphone"
91
+ }
92
+ ],
93
+ "items": [
94
+ {
95
+ "id": "b1",
96
+ "label": "Заголовок"
97
+ },
98
+ {
99
+ "id": "b2",
100
+ "label": "Текст"
101
+ },
102
+ {
103
+ "id": "b3",
104
+ "label": "Кнопка"
105
+ }
106
+ ],
107
+ "actions": [
108
+ {
109
+ "id": "up",
110
+ "label": "Выше"
111
+ },
112
+ {
113
+ "id": "down",
114
+ "label": "Ниже"
115
+ },
116
+ {
117
+ "id": "remove",
118
+ "label": "Удалить"
119
+ }
120
+ ]
121
+ },
122
+ "scenario": {
123
+ "steps": [
124
+ {
125
+ "invoke": "set-width",
126
+ "with": [
127
+ {
128
+ "value": "375"
129
+ }
130
+ ]
131
+ },
132
+ {
133
+ "invoke": "refresh",
134
+ "with": [
135
+ {}
136
+ ]
137
+ }
138
+ ]
139
+ }
140
+ }
141
+ },
142
+ {
143
+ "name": "phone",
144
+ "title": "Письмо на ширине 375: рамка и есть бумага",
145
+ "attributes": {
146
+ "box-attribute": "data-block-box",
147
+ "paper": ".email",
148
+ "width": "375"
149
+ },
150
+ "settings": {
151
+ "html": "<!doctype html><html lang=\"ru\"><head><meta charset=\"utf-8\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\"email\"><div data-block=\"b1\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\"b2\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\"b3\"><div data-block-box><a href=\"https://example.com/\">Подробнее</a></div></div></div></body></html>",
152
+ "widths": [
153
+ {
154
+ "value": "600",
155
+ "label": "Компьютер 600",
156
+ "icon": "desktop_windows",
157
+ "frame": 680
158
+ },
159
+ {
160
+ "value": "375",
161
+ "label": "Телефон 375",
162
+ "icon": "smartphone"
163
+ },
164
+ {
165
+ "value": "320",
166
+ "label": "Узкий 320",
167
+ "icon": "phone_iphone"
168
+ }
169
+ ],
170
+ "items": [
171
+ {
172
+ "id": "b1",
173
+ "label": "Заголовок"
174
+ },
175
+ {
176
+ "id": "b2",
177
+ "label": "Текст"
178
+ },
179
+ {
180
+ "id": "b3",
181
+ "label": "Кнопка"
182
+ }
183
+ ],
184
+ "actions": [
185
+ {
186
+ "id": "up",
187
+ "label": "Выше"
188
+ },
189
+ {
190
+ "id": "down",
191
+ "label": "Ниже"
192
+ },
193
+ {
194
+ "id": "remove",
195
+ "label": "Удалить"
196
+ }
197
+ ]
198
+ }
199
+ },
200
+ {
201
+ "name": "notes",
202
+ "title": "Устаревшая и тяжёлая картинка",
203
+ "attributes": {
204
+ "box-attribute": "data-block-box",
205
+ "paper": ".email",
206
+ "stale": "",
207
+ "width": "600"
208
+ },
209
+ "settings": {
210
+ "html": "<!doctype html><html lang=\"ru\"><head><meta charset=\"utf-8\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\"email\"><div data-block=\"b1\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\"b2\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\"b3\"><div data-block-box><a href=\"https://example.com/\">Подробнее</a></div></div></div></body></html>",
211
+ "widths": [
212
+ {
213
+ "value": "600",
214
+ "label": "Компьютер 600",
215
+ "icon": "desktop_windows",
216
+ "frame": 680
217
+ },
218
+ {
219
+ "value": "375",
220
+ "label": "Телефон 375",
221
+ "icon": "smartphone"
222
+ },
223
+ {
224
+ "value": "320",
225
+ "label": "Узкий 320",
226
+ "icon": "phone_iphone"
227
+ }
228
+ ],
229
+ "items": [
230
+ {
231
+ "id": "b1",
232
+ "label": "Заголовок"
233
+ },
234
+ {
235
+ "id": "b2",
236
+ "label": "Текст"
237
+ },
238
+ {
239
+ "id": "b3",
240
+ "label": "Кнопка"
241
+ }
242
+ ],
243
+ "actions": [
244
+ {
245
+ "id": "up",
246
+ "label": "Выше"
247
+ },
248
+ {
249
+ "id": "down",
250
+ "label": "Ниже"
251
+ },
252
+ {
253
+ "id": "remove",
254
+ "label": "Удалить"
255
+ }
256
+ ],
257
+ "weight": {
258
+ "bytes": 98,
259
+ "max": 90
260
+ }
261
+ }
262
+ }
263
+ ],
264
+ "pages": [
265
+ {
266
+ "name": "conformance",
267
+ "title": "sf-mail-canvas against component.json (standard simai.smart-component 1.4 §12, gate 20): the letter runs nothing, the widths and the frame, the scroll kept, a press in the frame, the tints, the notes that keep the last picture, each event and the overlay, in the element and placed by the host",
268
+ "format": "stands/15-scenarios (A4 modal: a page, probes in steps); the runner is ui-source tests/browser/manifest-probes.browser.mjs, run for the package by scripts/run-manifest-probes.mjs",
269
+ "page": {
270
+ "lang": "ru",
271
+ "body": [
272
+ "<main>",
273
+ " <sf-mail-canvas id=\"canvas\"></sf-mail-canvas>",
274
+ " <div lang=\"en\"><sf-mail-canvas id=\"english\" overlay-target=\"english-overlay\"></sf-mail-canvas></div>",
275
+ " <sf-mail-canvas id=\"placed\" overlay-target=\"outside\"></sf-mail-canvas>",
276
+ "</main>",
277
+ "<section><sf-editor-overlay id=\"outside\" label=\"Предпросмотр\"></sf-editor-overlay></section>",
278
+ "<section><sf-editor-overlay id=\"english-overlay\" label=\"Preview\"></sf-editor-overlay></section>"
279
+ ]
280
+ },
281
+ "checks": [
282
+ {
283
+ "id": "p1-script-does-not-run",
284
+ "title": "a script, an inline handler and an image's onerror in html do not run and do not reach the page; the frame's sandbox is allow-same-origin and nothing else",
285
+ "covers": "settings.html",
286
+ "steps": [
287
+ {
288
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = \"<!doctype html><html><body><p id=\\\"shown\\\">Письмо</p><script>document.documentElement.setAttribute('data-ran','1');try{parent.pwned=1}catch(e){}try{top.document.title='pwned'}catch(e){}</script><img src=\\\"data:,\\\" onerror=\\\"document.documentElement.setAttribute('data-ran','2');parent.pwned=2\\\"><svg onload=\\\"parent.pwned=3\\\"></svg><body onload=\\\"parent.pwned=4\\\"></body></html>\"; return true; })()",
289
+ "wait": 700,
290
+ "check": "(() => { const frame = document.querySelector('#canvas iframe'); const doc = frame.contentDocument; return frame.getAttribute('sandbox') === 'allow-same-origin' && doc.querySelector('#shown').textContent === 'Письмо' && doc.querySelector('script') !== null && !doc.documentElement.hasAttribute('data-ran') && window.pwned === undefined && document.title !== 'pwned'; })()"
291
+ }
292
+ ]
293
+ },
294
+ {
295
+ "id": "p2-width-and-frame",
296
+ "title": "a width is the frame's width: 600 shows a 680 px frame whose paper casts the shadow, 375 a 375 px frame that casts it itself; a press switches and says so, once",
297
+ "covers": "settings.widths, settings.width, settings.paper, events.change, actions.set-width",
298
+ "steps": [
299
+ {
300
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = LETTER; one.setAttribute('width', '600'); return true; })()",
301
+ "wait": 700,
302
+ "check": "(() => { const frame = document.querySelector('#canvas iframe'); const paper = frameDoc().querySelector('.email'); return frame.getBoundingClientRect().width === 680 && !frame.classList.contains('shadow-raised') && getComputedStyle(paper).boxShadow !== 'none' && document.querySelector('#canvas sf-segmented').getAttribute('value') === '600'; })()"
303
+ },
304
+ {
305
+ "script": "(() => { document.querySelector('#canvas sf-segmented').select('375'); return true; })()",
306
+ "wait": 400,
307
+ "check": "(() => { const frame = document.querySelector('#canvas iframe'); return frame.getBoundingClientRect().width === 375 && frame.classList.contains('shadow-raised') && getComputedStyle(frameDoc().querySelector('.email')).boxShadow === 'none' && one.getAttribute('width') === '375' && JSON.stringify(heard.filter(([name]) => name === 'change')) === JSON.stringify([['change', {value: '375', previous: '600'}]]); })()"
308
+ },
309
+ {
310
+ "action": {
311
+ "name": "set-width",
312
+ "with": {
313
+ "value": "320"
314
+ }
315
+ },
316
+ "target": "#canvas",
317
+ "wait": 300,
318
+ "expect": {
319
+ "returns": {
320
+ "outcome": "applied"
321
+ }
322
+ },
323
+ "check": "document.querySelector('#canvas iframe').getBoundingClientRect().width === 320"
324
+ },
325
+ {
326
+ "action": {
327
+ "name": "set-width",
328
+ "with": {
329
+ "value": "320"
330
+ }
331
+ },
332
+ "target": "#canvas",
333
+ "wait": 60,
334
+ "expect": {
335
+ "returns": {
336
+ "outcome": "refused",
337
+ "reason": "unchanged"
338
+ }
339
+ }
340
+ },
341
+ {
342
+ "action": {
343
+ "name": "set-width",
344
+ "with": {
345
+ "value": "999"
346
+ }
347
+ },
348
+ "target": "#canvas",
349
+ "wait": 60,
350
+ "expect": {
351
+ "returns": {
352
+ "outcome": "refused",
353
+ "reason": "unknown"
354
+ }
355
+ }
356
+ }
357
+ ]
358
+ },
359
+ {
360
+ "id": "p3-scroll-kept",
361
+ "title": "the scroll position stays across a redraw and across a width change, and the frame is as tall as the letter",
362
+ "covers": "settings.html",
363
+ "steps": [
364
+ {
365
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = LETTER.replace('</div></body>', '<div style=\"height:2400px\" data-block=\"b4\"><div data-block-box>Длинный</div></div></div></body>'); return true; })()",
366
+ "wait": 800,
367
+ "check": "document.querySelector('#canvas iframe').getBoundingClientRect().height > 2400"
368
+ },
369
+ {
370
+ "script": "(() => { document.querySelector('#canvas .sf-mail-canvas-scroll').scrollTo({top: 300, behavior: 'instant'}); one.html = LETTER.replace('</div></body>', '<div style=\"height:2400px\" data-block=\"b4\"><div data-block-box>Длинный</div></div></div></body>').replace('Осенняя рассылка', 'Новый заголовок'); return true; })()",
371
+ "wait": 800,
372
+ "check": "document.querySelector('#canvas .sf-mail-canvas-scroll').scrollTop === 300 && frameDoc().querySelector('h1').textContent === 'Новый заголовок' && document.querySelector('#canvas iframe').getBoundingClientRect().height > 2400"
373
+ },
374
+ {
375
+ "script": "(() => { one.setWidth('375'); return true; })()",
376
+ "wait": 500,
377
+ "check": "document.querySelector('#canvas .sf-mail-canvas-scroll').scrollTop === 300"
378
+ }
379
+ ]
380
+ },
381
+ {
382
+ "id": "p4-click-chooses",
383
+ "title": "a press on a block chooses it, once; a press beside every block chooses none; a link never navigates the frame and takes no tab stop; a mark the host did not give is not a block",
384
+ "covers": "settings.items, settings.mark-attribute, events.select, actions.select",
385
+ "steps": [
386
+ {
387
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = LETTER.replace('</div></body>', '<div data-block=\"forged\"><p id=\"forged\">Чужая метка</p></div></div></body><!-- -->'); return true; })()",
388
+ "wait": 800,
389
+ "check": "frameDoc().querySelector('a').tabIndex === -1"
390
+ },
391
+ {
392
+ "script": "(() => { frameDoc().querySelector('[data-block=\"b2\"] p').click(); return true; })()",
393
+ "wait": 200,
394
+ "check": "JSON.stringify(heard.filter(([name]) => name === 'select')) === JSON.stringify([['select', {ids: ['b2'], id: 'b2'}]])"
395
+ },
396
+ {
397
+ "script": "(() => { heard.length = 0; one.setAttribute('selected', 'b2'); setTimeout(() => frameDoc().querySelector('a').click(), 100); return true; })()",
398
+ "wait": 500,
399
+ "check": "JSON.stringify(heard) === JSON.stringify([['select', {ids: ['b3'], id: 'b3'}]]) && frameDoc().querySelector('[data-block=\"b1\"]') !== null && document.querySelector('#canvas iframe').contentWindow.location.href === 'about:srcdoc'"
400
+ },
401
+ {
402
+ "script": "(() => { heard.length = 0; one.setAttribute('selected', 'b3'); setTimeout(() => frameDoc().querySelector('#forged').click(), 100); return true; })()",
403
+ "wait": 500,
404
+ "check": "JSON.stringify(heard) === JSON.stringify([['select', {ids: [], id: ''}]])"
405
+ },
406
+ {
407
+ "action": {
408
+ "name": "select",
409
+ "with": {
410
+ "id": "nope"
411
+ }
412
+ },
413
+ "target": "#canvas",
414
+ "wait": 60,
415
+ "expect": {
416
+ "returns": {
417
+ "outcome": "refused",
418
+ "reason": "unknown"
419
+ }
420
+ }
421
+ },
422
+ {
423
+ "action": {
424
+ "name": "select",
425
+ "with": {
426
+ "id": "b1"
427
+ }
428
+ },
429
+ "target": "#canvas",
430
+ "wait": 60,
431
+ "expect": {
432
+ "returns": {
433
+ "outcome": "applied"
434
+ },
435
+ "events": [
436
+ {
437
+ "name": "sf-mail-canvas-select",
438
+ "count": 1,
439
+ "detail": {
440
+ "id": "b1"
441
+ }
442
+ }
443
+ ]
444
+ }
445
+ }
446
+ ]
447
+ },
448
+ {
449
+ "id": "p5-no-tints",
450
+ "title": "hover and the chosen block take no tint, the overlay's frames mark them; choosing does not reload the letter",
451
+ "covers": "settings.selected, settings.box-attribute",
452
+ "steps": [
453
+ {
454
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.setAttribute('selected', \"b2\"); one.html = LETTER; return true; })()",
455
+ "wait": 800,
456
+ "check": "(() => { globalThis.letterDoc = frameDoc(); return getComputedStyle(frameDoc().querySelector('[data-block=\"b2\"] [data-block-box]')).backgroundColor === 'rgba(0, 0, 0, 0)'; })()"
457
+ },
458
+ {
459
+ "script": "(() => { one.setAttribute('selected', 'b1'); return true; })()",
460
+ "wait": 500,
461
+ "check": "frameDoc() === letterDoc && getComputedStyle(frameDoc().querySelector('[data-block=\"b1\"] [data-block-box]')).backgroundColor === 'rgba(0, 0, 0, 0)' && getComputedStyle(frameDoc().querySelector('[data-block=\"b2\"] [data-block-box]')).backgroundColor === 'rgba(0, 0, 0, 0)'"
462
+ },
463
+ {
464
+ "script": "(() => { one.refresh(); return true; })()",
465
+ "wait": 200,
466
+ "check": "(() => { const text = one.sheet.textContent; return text.includes('[data-block]{cursor:pointer}') && !text.includes(':hover') && !text.includes('background'); })()"
467
+ }
468
+ ]
469
+ },
470
+ {
471
+ "id": "p6-stale-keeps-the-picture",
472
+ "title": "stale says so and the last picture stays; an empty html keeps it too; a new html replaces the picture only when it has loaded",
473
+ "covers": "settings.stale, settings.html, runtime.stale-text",
474
+ "steps": [
475
+ {
476
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = LETTER; return true; })()",
477
+ "wait": 800,
478
+ "check": "document.querySelector('#canvas .sf-mail-canvas-stale').hidden === true && frameDoc().querySelector('h1').textContent === 'Осенняя рассылка'"
479
+ },
480
+ {
481
+ "script": "(() => { one.setAttribute('stale', ''); one.html = ''; return true; })()",
482
+ "wait": 500,
483
+ "check": "(() => { const note = document.querySelector('#canvas .sf-mail-canvas-stale'); return note.hidden === false && note.textContent.includes('Предпросмотр устарел') && frameDoc().querySelector('h1').textContent === 'Осенняя рассылка' && heard.filter(([name]) => name === 'draw').length === 1; })()"
484
+ },
485
+ {
486
+ "script": "(() => { one.removeAttribute('stale'); one.html = LETTER.replace('Осенняя рассылка', 'Следующая'); return new Promise((done) => queueMicrotask(() => queueMicrotask(() => { globalThis.during = frameDoc().querySelector('h1')?.textContent; globalThis.busy = one.hasAttribute('data-sf-drawing'); done(true); }))); })()",
487
+ "wait": 500,
488
+ "check": "during === 'Осенняя рассылка' && frameDoc().querySelector('h1').textContent === 'Следующая' && document.querySelector('#canvas .sf-mail-canvas-stale').hidden === true && !one.hasAttribute('data-sf-drawing')"
489
+ }
490
+ ]
491
+ },
492
+ {
493
+ "id": "p7-weight",
494
+ "title": "the weight note says the letter's size and the limit in the page's language; without weight there is none; an English part of the page says it in English",
495
+ "covers": "settings.weight, runtime.weight-text",
496
+ "steps": [
497
+ {
498
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = LETTER; document.querySelector('#english').weight = {bytes: 98, max: 90}; return true; })()",
499
+ "wait": 500,
500
+ "check": "document.querySelector('#canvas .sf-mail-canvas-weight').hidden === true && document.querySelector('#english .sf-mail-canvas-weight').textContent.includes('98 KB') && document.querySelector('#english .sf-mail-canvas-weight').getAttribute('role') === 'status'"
501
+ },
502
+ {
503
+ "script": "(() => { one.weight = {bytes: 98, max: 90}; return true; })()",
504
+ "wait": 300,
505
+ "check": "(() => { const note = document.querySelector('#canvas .sf-mail-canvas-weight'); return note.hidden === false && note.textContent.includes('98 КБ') && note.textContent.includes('90 КБ'); })()"
506
+ },
507
+ {
508
+ "script": "(() => { one.weight = {}; return true; })()",
509
+ "wait": 300,
510
+ "check": "document.querySelector('#canvas .sf-mail-canvas-weight').hidden === true"
511
+ }
512
+ ]
513
+ },
514
+ {
515
+ "id": "p8-hover-and-draw",
516
+ "title": "the pointer over another block says hover once per block and none on leaving; a new letter says draw before it is measured, so what the host adds counts in the frame's height",
517
+ "covers": "events.hover, events.draw",
518
+ "steps": [
519
+ {
520
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = LETTER; one.addEventListener('sf-mail-canvas-draw', () => { const grown = one.frameDocument.createElement('div'); grown.style.height = '900px'; one.frameDocument.body.append(grown); }); return true; })()",
521
+ "wait": 800,
522
+ "check": "heard.filter(([name]) => name === 'draw').length === 1 && document.querySelector('#canvas iframe').getBoundingClientRect().height > 900"
523
+ },
524
+ {
525
+ "script": "(() => { const doc = frameDoc(); const over = (node) => node.dispatchEvent(new doc.defaultView.MouseEvent('mouseover', {bubbles: true})); over(doc.querySelector('[data-block=\"b2\"] p')); over(doc.querySelector('[data-block=\"b2\"] [data-block-box]')); over(doc.querySelector('[data-block=\"b3\"] a')); doc.documentElement.dispatchEvent(new doc.defaultView.MouseEvent('mouseout', {bubbles: true, relatedTarget: null})); return true; })()",
526
+ "wait": 100,
527
+ "check": "JSON.stringify(heard.filter(([name]) => name === 'hover')) === JSON.stringify([['hover', {id: 'b2'}], ['hover', {id: 'b3'}], ['hover', {id: ''}]])"
528
+ }
529
+ ]
530
+ },
531
+ {
532
+ "id": "p9-overlay-present",
533
+ "title": "the overlay is over the frame: bound to it, its tree holds the items with their names, its selection line is the block's box, its keys choose",
534
+ "covers": "settings.items, settings.actions, relations.cl-editor-overlay, keyboard.tree",
535
+ "steps": [
536
+ {
537
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.setAttribute('selected', \"b2\"); one.html = LETTER; return true; })()",
538
+ "wait": 1000,
539
+ "check": "(() => { const overlay = document.querySelector('#canvas sf-editor-overlay'); const names = [...overlay.querySelectorAll('[role=\"treeitem\"]')].map((row) => row.getAttribute('aria-label') ?? row.textContent.trim()); return overlay === one.overlay && overlay.getAttribute('data-sf-overlay-mode') === 'frame' && overlay.iframe === one.frame && names.length === 3 && names[1].includes('Текст') && overlay.selectedId === 'b2' && heard.filter(([name]) => name === 'select').length === 0; })()"
540
+ },
541
+ {
542
+ "script": "(() => { const frame = one.frame; const box = frameDoc().querySelector('[data-block=\"b2\"] [data-block-box]').getBoundingClientRect(); const outer = frame.getBoundingClientRect(); const edge = (el) => { const cs = getComputedStyle(el); return {top: parseFloat(cs.borderTopWidth) + parseFloat(cs.paddingTop), left: parseFloat(cs.borderLeftWidth) + parseFloat(cs.paddingLeft), right: parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight)}; }; const lineEl = document.querySelector('#canvas sf-editor-overlay .sf-composition-overlay-frame--selected'); const line = lineEl.getBoundingClientRect(); const e = edge(lineEl); globalThis.fit = [Math.abs(line.top + e.top - (outer.top + box.top)), Math.abs(line.left + e.left - (outer.left + box.left)), Math.abs(line.width - e.left - e.right - box.width)]; return true; })()",
543
+ "wait": 100,
544
+ "check": "fit.every((gap) => gap < 8)"
545
+ },
546
+ {
547
+ "script": "(() => { heard.length = 0; document.querySelector('#canvas sf-editor-overlay [role=\"tree\"]').focus(); return true; })()",
548
+ "wait": 100
549
+ },
550
+ {
551
+ "user": "keyboard:ArrowDown",
552
+ "wait": 200,
553
+ "check": "JSON.stringify(heard) === JSON.stringify([['select', {ids: ['b3'], id: 'b3'}]])"
554
+ }
555
+ ]
556
+ },
557
+ {
558
+ "id": "p10-overlay-events",
559
+ "title": "what the overlay reports comes out as the element's own: a toolbar action, an insertion point, a move and a plain-string edit, which a host can cancel",
560
+ "covers": "events.apply, events.insert, events.move, events.edit",
561
+ "steps": [
562
+ {
563
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\", \"icon\": \"arrow_upward\"}, {\"id\": \"down\", \"label\": \"Ниже\", \"icon\": \"arrow_downward\"}, {\"id\": \"remove\", \"label\": \"Удалить\", \"icon\": \"delete\"}]; one.setAttribute('selected', \"b2\"); one.html = LETTER; one.items = [{id: 'b1', label: 'Заголовок'}, {id: 'b2', label: 'Текст', editable: true}, {id: 'b3', label: 'Кнопка'}]; return true; })()",
564
+ "wait": 1000,
565
+ "check": "document.querySelector('#canvas sf-editor-overlay button[data-action=\"remove\"]') !== null && document.querySelector('#canvas sf-editor-overlay button[data-parent]') !== null"
566
+ },
567
+ {
568
+ "script": "(() => { const overlay = one.overlay; overlay.querySelector('button[data-action=\"remove\"]').click(); overlay.querySelector('button[data-parent]').click(); overlay.dispatchEvent(new CustomEvent('sf-editor-overlay-move', {bubbles: true, detail: {ids: ['b2'], id: 'b2', parent: '', position: 2, slot: 'default', node_id: 'b2', parent_id: '', index: 2}})); return true; })()",
569
+ "wait": 200,
570
+ "check": "(() => { const said = Object.fromEntries(heard.map(([name, detail]) => [name, detail])); return JSON.stringify(said.apply) === JSON.stringify({action: 'remove', scope: 'entry', ids: ['b2']}) && said.insert.slot === 'default' && said.insert.parent === '' && Number.isInteger(said.insert.index) && JSON.stringify(said.move) === JSON.stringify({ids: ['b2'], id: 'b2', parent: '', position: 2, slot: 'default'}); })()"
571
+ },
572
+ {
573
+ "script": "(() => { heard.length = 0; const overlay = one.overlay; overlay.edit('b2'); const text = frameDoc().querySelector('[data-block=\"b2\"] [data-block-box]'); text.textContent = 'Новый текст'; overlay.finishEdit(true); return true; })()",
574
+ "wait": 200,
575
+ "check": "JSON.stringify(heard) === JSON.stringify([['edit', {id: 'b2', value: 'Новый текст', previous: 'Здравствуйте! Рассказываем, что нового.'}]])"
576
+ },
577
+ {
578
+ "script": "(() => { heard.length = 0; one.addEventListener('sf-mail-canvas-edit', (event) => event.preventDefault()); const overlay = one.overlay; overlay.edit('b2'); const text = frameDoc().querySelector('[data-block=\"b2\"] [data-block-box]'); text.textContent = 'Отменят'; overlay.finishEdit(true); return true; })()",
579
+ "wait": 200,
580
+ "check": "heard.length === 1 && frameDoc().querySelector('[data-block=\"b2\"] [data-block-box]').textContent === 'Новый текст'"
581
+ }
582
+ ]
583
+ },
584
+ {
585
+ "id": "p11-overlay-target",
586
+ "title": "with overlay-target the element places no overlay of its own: it binds the one the host placed, feeds it and says what it reports",
587
+ "covers": "settings.overlay-target, settings.accepts",
588
+ "steps": [
589
+ {
590
+ "script": "(() => { const placed = document.querySelector('#placed'); globalThis.placed = placed; globalThis.placedHeard = []; for (const name of ['sf-mail-canvas-select', 'sf-mail-canvas-apply']) placed.addEventListener(name, (event) => placedHeard.push([name.replace('sf-mail-canvas-', ''), event.detail])); placed.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; placed.actions = [{\"id\": \"up\", \"label\": \"Выше\", \"icon\": \"arrow_upward\"}, {\"id\": \"down\", \"label\": \"Ниже\", \"icon\": \"arrow_downward\"}, {\"id\": \"remove\", \"label\": \"Удалить\", \"icon\": \"delete\"}]; placed.setAttribute('selected', 'b2'); placed.setAttribute('box-attribute', 'data-block-box'); placed.setAttribute('accepts', 'library'); placed.html = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; return true; })()",
591
+ "wait": 1000,
592
+ "check": "(() => { const outside = document.querySelector('#outside'); return placed.querySelector('sf-editor-overlay') === null && placed.overlay === outside && outside.iframe === placed.frame && outside.selectedId === 'b2' && outside.getAttribute('accepts') === 'library' && outside.querySelectorAll('[role=\"treeitem\"]').length === 3; })()"
593
+ },
594
+ {
595
+ "script": "(() => { document.querySelector('#outside button[data-action=\"up\"]').click(); placed.frame.contentDocument.querySelector('[data-block=\"b1\"] h1').click(); return true; })()",
596
+ "wait": 200,
597
+ "check": "JSON.stringify(placedHeard) === JSON.stringify([['apply', {action: 'up', scope: 'entry', ids: ['b2']}], ['select', {ids: ['b1'], id: 'b1'}]])"
598
+ }
599
+ ]
600
+ },
601
+ {
602
+ "id": "p12-reveal",
603
+ "title": "reveal brings a block into view on the canvas, and says so when it already is",
604
+ "covers": "actions.reveal, actions.refresh",
605
+ "steps": [
606
+ {
607
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = LETTER.replace('</div></body>', '<div style=\"height:2400px\" data-block=\"b4\"><div data-block-box>Длинный</div></div></div></body>'); one.items = [...one.items, {id: 'b4', label: 'Длинный'}]; return true; })()",
608
+ "wait": 800,
609
+ "check": "one.reveal({id: 'b1'}).reason === 'unchanged' && one.reveal({id: 'nope'}).reason === 'unknown'"
610
+ },
611
+ {
612
+ "script": "(() => { globalThis.answer = one.reveal({id: 'b4'}).outcome; return true; })()",
613
+ "wait": 1200,
614
+ "check": "answer === 'applied' && document.querySelector('#canvas .sf-mail-canvas-scroll').scrollTop > 0"
615
+ },
616
+ {
617
+ "action": {
618
+ "name": "refresh",
619
+ "with": {}
620
+ },
621
+ "target": "#canvas",
622
+ "wait": 100,
623
+ "expect": {
624
+ "returns": {
625
+ "outcome": "applied"
626
+ }
627
+ }
628
+ }
629
+ ]
630
+ },
631
+ {
632
+ "id": "p13-names",
633
+ "title": "the frame, the layer and the switch are named in the page's language, and the frame and links take no tab stop",
634
+ "covers": "runtime.frame-label, runtime.layer-label, runtime.preview-label, runtime.widths-label",
635
+ "steps": [
636
+ {
637
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = LETTER; document.querySelector('#english').widths = one.widths; return true; })()",
638
+ "wait": 500,
639
+ "check": "(() => { const frame = document.querySelector('#canvas iframe'); return frame.title === 'Письмо в предпросмотре' && frame.tabIndex === -1 && document.querySelector('#canvas .sf-mail-canvas-layer').getAttribute('aria-label') === 'Слой редактора над письмом' && document.querySelector('#canvas .sf-mail-canvas').getAttribute('aria-label') === 'Предпросмотр' && document.querySelector('#canvas sf-segmented').getAttribute('aria-label') === 'Ширина письма' && document.querySelector('#english iframe').title === 'The email in preview' && document.querySelector('#english .sf-mail-canvas').getAttribute('aria-label') === 'Preview'; })()"
640
+ }
641
+ ]
642
+ },
643
+ {
644
+ "id": "p14-marks-are-the-hosts",
645
+ "title": "the marks are the attributes the host names, the box takes the overlay's line; a name that is no data- attribute falls back; a part with no element of its own is a rect",
646
+ "covers": "settings.mark-attribute, settings.box-attribute, settings.items",
647
+ "steps": [
648
+ {
649
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.html = \"<!doctype html><html><body style=\\\"margin:0\\\"><table><tr data-ui-mail-block=\\\"b1\\\"><td><div data-ui-mail-box><p id=\\\"inner\\\">Первый</p></div></td></tr><tr data-ui-mail-block=\\\"b2\\\"><td><div data-ui-mail-box>Второй</div></td></tr></table></body></html>\"; one.setAttribute('mark-attribute', 'data-ui-mail-block'); one.setAttribute('box-attribute', 'data-ui-mail-box'); one.items = [{id: 'b1', label: 'Первый'}, {id: 'b2', label: 'Второй'}, {id: 'part', label: 'Часть', rect: {x: 500, y: 500, width: 10, height: 10}}]; one.setAttribute('selected', 'b2'); return true; })()",
650
+ "wait": 900,
651
+ "check": "(() => { const doc = frameDoc(); const box = doc.querySelector('[data-ui-mail-block=\"b2\"] [data-ui-mail-box]'); const overlay = one.overlay; return getComputedStyle(box).backgroundColor === 'rgba(0, 0, 0, 0)' && overlay.elementIds.get(box) === 'b2' && overlay.querySelectorAll('[role=\"treeitem\"]').length === 3; })()"
652
+ },
653
+ {
654
+ "script": "(() => { heard.length = 0; frameDoc().querySelector('#inner').click(); return true; })()",
655
+ "wait": 200,
656
+ "check": "JSON.stringify(heard) === JSON.stringify([['select', {ids: ['b1'], id: 'b1'}]])"
657
+ },
658
+ {
659
+ "script": "(() => { one.setAttribute('mark-attribute', 'onclick'); return true; })()",
660
+ "wait": 200,
661
+ "check": "one.markAttributeName() === 'data-block'"
662
+ }
663
+ ]
664
+ },
665
+ {
666
+ "id": "p15-patched-not-reloaded",
667
+ "title": "the letter is patched block by block: an edit, a move and an undo fire no load and keep the blocks' elements and the scroll, and in a move the frame stays on the block in every frame; only a new head writes the frame anew",
668
+ "covers": "settings.html, events.draw",
669
+ "steps": [
670
+ {
671
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.setAttribute('selected', \"b2\"); one.html = LETTER; return true; })()",
672
+ "wait": 800,
673
+ "check": "Boolean(frameDoc().querySelector('[data-block=\"b1\"]'))"
674
+ },
675
+ {
676
+ "script": "(() => { globalThis.loads = 0; one.frame.addEventListener('load', () => { globalThis.loads += 1; }); globalThis.letterDoc = frameDoc(); globalThis.b1 = frameDoc().querySelector('[data-block=\"b1\"]'); globalThis.b2 = frameDoc().querySelector('[data-block=\"b2\"]'); globalThis.b3 = frameDoc().querySelector('[data-block=\"b3\"]'); globalThis.draws = heard.filter(([name]) => name === 'draw').length; one.html = LETTER.replace('Осенняя рассылка', 'Правка'); return true; })()",
677
+ "wait": 300,
678
+ "check": "loads === 0 && frameDoc() === letterDoc && frameDoc().querySelector('h1').textContent === 'Правка' && frameDoc().querySelector('[data-block=\"b1\"]') === b1 && !one.hasAttribute('data-sf-drawing') && heard.filter(([name]) => name === 'draw').length === draws + 1"
679
+ },
680
+ {
681
+ "script": "(() => { globalThis.moved = ((first, second) => { const doc = new DOMParser().parseFromString(LETTER, 'text/html'); const a = doc.querySelector(`[data-block=\"${first}\"]`); const b = doc.querySelector(`[data-block=\"${second}\"]`); b.after(a); return `<!doctype html>${doc.documentElement.outerHTML}`; })('b2', 'b3'); one.html = moved; return new Promise((done) => requestAnimationFrame(() => { globalThis.gliding = b2.getAnimations().length + b3.getAnimations().length; done(true); })); })()",
682
+ "wait": 400,
683
+ "check": "loads === 0 && frameDoc() === letterDoc && gliding > 0 && [...frameDoc().querySelectorAll('[data-block]')].map((element) => element.dataset.block).join(' ') === 'b1 b3 b2' && frameDoc().querySelector('[data-block=\"b2\"]') === b2 && frameDoc().querySelector('[data-block=\"b3\"]') === b3"
684
+ },
685
+ {
686
+ "script": "(() => { one.html = LETTER; return true; })()",
687
+ "wait": 400,
688
+ "check": "loads === 0 && frameDoc() === letterDoc && [...frameDoc().querySelectorAll('[data-block]')].map((element) => element.dataset.block).join(' ') === 'b1 b2 b3' && frameDoc().querySelector('h1').textContent === 'Осенняя рассылка'"
689
+ },
690
+ {
691
+ "script": "(async () => { one.scroller.scrollTop = 40; one.setAttribute('selected', 'b2'); await new Promise((done) => setTimeout(done, 150)); const overlay = one.overlay; const edge = (el) => { const cs = getComputedStyle(el); return {top: parseFloat(cs.borderTopWidth) + parseFloat(cs.paddingTop), left: parseFloat(cs.borderLeftWidth) + parseFloat(cs.paddingLeft), right: parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight)}; }; const line = overlay.querySelector('.sf-composition-overlay-frame--selected'); const inset = edge(line).top; const gaps = []; const tops = []; const before = one.scroller.scrollTop; one.html = moved; for (let frame = 0; frame < 16; frame += 1) { await new Promise((done) => requestAnimationFrame(done)); const box = frameDoc().querySelector('[data-block=\"b2\"] [data-block-box]').getBoundingClientRect(); const top = one.frame.getBoundingClientRect().top + box.top; tops.push(Math.round(top)); gaps.push(Math.abs(line.getBoundingClientRect().top + inset - top)); } globalThis.trace = {worst: Math.max(...gaps), seen: new Set(tops).size, held: one.scroller.scrollTop === before}; one.html = LETTER; return true; })()",
692
+ "wait": 400,
693
+ "check": "loads === 0 && trace.worst <= 1.5 && trace.seen >= 3 && trace.held"
694
+ },
695
+ {
696
+ "script": "(() => { one.html = LETTER.replace('</head>', '<meta name=\"x-probe\" content=\"1\"></head>'); return true; })()",
697
+ "wait": 600,
698
+ "check": "loads === 1 && frameDoc() !== letterDoc && Boolean(frameDoc().querySelector('meta[name=\"x-probe\"]'))"
699
+ },
700
+ {
701
+ "script": "(() => { const hostile = LETTER.replace('Осенняя рассылка', '<img src=x onerror=\"parent.hacked=1\"><script>parent.hacked=1<\\/script>Заголовок'); one.html = hostile; return true; })()",
702
+ "wait": 400,
703
+ "check": "globalThis.hacked === undefined && frameDoc().querySelector('h1').textContent.includes('Заголовок')"
704
+ }
705
+ ]
706
+ },
707
+ {
708
+ "id": "p16-overlay-travels",
709
+ "title": "the element's own overlay lies in the scroller: the frame stays on the block through a scroll with nothing measured, and the toolbar stands above the first block",
710
+ "covers": "template",
711
+ "steps": [
712
+ {
713
+ "script": "(() => { const one = document.querySelector('#canvas'); globalThis.one = one; globalThis.LETTER = \"<!doctype html><html lang=\\\"ru\\\"><head><meta charset=\\\"utf-8\\\"><title>Письмо</title><style>html,body{margin:0;background:transparent}.email{max-width:600px;margin:0 auto;background:#fff;color:#1a1a1a;font:16px/1.5 sans-serif}[data-block-box]{padding:8px 40px}h1{margin:0;font-size:24px}p{margin:0}</style></head><body><div class=\\\"email\\\"><div data-block=\\\"b1\\\"><div data-block-box><h1>Осенняя рассылка</h1></div></div><div data-block=\\\"b2\\\"><div data-block-box><p>Здравствуйте! Рассказываем, что нового.</p></div></div><div data-block=\\\"b3\\\"><div data-block-box><a href=\\\"https://example.com/\\\">Подробнее</a></div></div></div></body></html>\"; globalThis.frameDoc = () => one.querySelector('iframe').contentDocument; globalThis.heard = []; for (const name of ['sf-mail-canvas-select','sf-mail-canvas-hover','change','sf-mail-canvas-apply','sf-mail-canvas-insert','sf-mail-canvas-move','sf-mail-canvas-edit','sf-mail-canvas-draw']) one.addEventListener(name, (event) => globalThis.heard.push([name.replace('sf-mail-canvas-', ''), event.detail])); one.setAttribute('box-attribute', 'data-block-box'); one.setAttribute('paper', '.email'); one.widths = [{\"value\": \"600\", \"label\": \"Компьютер 600\", \"icon\": \"desktop_windows\", \"frame\": 680}, {\"value\": \"375\", \"label\": \"Телефон 375\", \"icon\": \"smartphone\"}, {\"value\": \"320\", \"label\": \"Узкий 320\", \"icon\": \"phone_iphone\"}]; one.items = [{\"id\": \"b1\", \"label\": \"Заголовок\"}, {\"id\": \"b2\", \"label\": \"Текст\"}, {\"id\": \"b3\", \"label\": \"Кнопка\"}]; one.actions = [{\"id\": \"up\", \"label\": \"Выше\"}, {\"id\": \"down\", \"label\": \"Ниже\"}, {\"id\": \"remove\", \"label\": \"Удалить\"}]; one.setAttribute('selected', \"b2\"); one.html = LETTER; return true; })()",
714
+ "wait": 800
715
+ },
716
+ {
717
+ "script": "(() => { one.scroller.scrollTop = 0; one.actions = [{id: 'up', label: 'Выше'}]; one.setAttribute('selected', 'b1'); return true; })()",
718
+ "wait": 300,
719
+ "check": "(() => { const overlay = one.overlay; const line = overlay.querySelector('.sf-composition-overlay-frame--selected').getBoundingClientRect(); const bar = overlay.querySelector('.sf-composition-overlay-toolbar').getBoundingClientRect(); return overlay.getAttribute('data-sf-overlay-place') === 'content' && one.scroller.contains(overlay) && bar.bottom <= line.top + 0.5 && bar.top >= one.scroller.getBoundingClientRect().top; })()"
720
+ },
721
+ {
722
+ "script": "(async () => { const edge = (el) => { const cs = getComputedStyle(el); return {top: parseFloat(cs.borderTopWidth) + parseFloat(cs.paddingTop), left: parseFloat(cs.borderLeftWidth) + parseFloat(cs.paddingLeft), right: parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight)}; }; const overlay = one.overlay; let runs = 0; const position = overlay.position; overlay.position = function counted() { runs += 1; return position.call(this); }; const gaps = []; one.frame.style.minHeight = '3000px'; await new Promise((done) => setTimeout(done, 100)); runs = 0; for (let top = 0; top <= 300; top += 20) { one.scroller.scrollTop = top; await new Promise((done) => requestAnimationFrame(done)); const lineEl = overlay.querySelector('.sf-composition-overlay-frame--selected'); const line = lineEl.getBoundingClientRect(); const box = frameDoc().querySelector('[data-block=\"b1\"] [data-block-box]').getBoundingClientRect(); gaps.push(Math.abs(line.top + edge(lineEl).top - (one.frame.getBoundingClientRect().top + box.top))); } overlay.position = position; globalThis.travel = {runs, worst: Math.max(...gaps), scrolled: one.scroller.scrollTop}; one.frame.style.minHeight = ''; return true; })()",
723
+ "wait": 100,
724
+ "check": "travel.scrolled > 0 && travel.runs === 0 && travel.worst <= 0.5"
725
+ }
726
+ ]
727
+ }
728
+ ]
729
+ }
730
+ ]
731
+ }