@simai-studio/mail 0.0.0-stage → 1.0.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.
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,1301 @@
1
+ {
2
+ "examples": [
3
+ {
4
+ "name": "reference",
5
+ "title": "Блок: разделы и все виды полей",
6
+ "attributes": {
7
+ "heading": "Кнопка",
8
+ "heading-icon": "smart_button",
9
+ "form-key": "b7"
10
+ },
11
+ "settings": {
12
+ "head-actions": [
13
+ "duplicate",
14
+ "delete"
15
+ ],
16
+ "levels": [
17
+ {
18
+ "text": "Кнопка"
19
+ }
20
+ ],
21
+ "sections": [
22
+ {
23
+ "key": "button:content",
24
+ "title": "Содержимое",
25
+ "fields": [
26
+ {
27
+ "kind": "text",
28
+ "path": "/text",
29
+ "label": "Текст",
30
+ "value": "Подробнее",
31
+ "required": true
32
+ },
33
+ {
34
+ "kind": "link",
35
+ "path": "/url",
36
+ "label": "Ссылка",
37
+ "value": "https://simai.ru",
38
+ "placeholder": "https://"
39
+ },
40
+ {
41
+ "kind": "number",
42
+ "path": "/discount",
43
+ "label": "Скидка",
44
+ "value": "10"
45
+ },
46
+ {
47
+ "kind": "multiline",
48
+ "path": "/note",
49
+ "label": "Примечание",
50
+ "value": "",
51
+ "hint": "Как в бренде: Спасибо, что вы с нами"
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ "key": "button:look",
57
+ "title": "Оформление",
58
+ "fields": [
59
+ {
60
+ "kind": "select",
61
+ "path": "/tone",
62
+ "label": "Тон",
63
+ "value": "accent",
64
+ "options": [
65
+ {
66
+ "value": "",
67
+ "text": "— нет —"
68
+ },
69
+ {
70
+ "value": "accent",
71
+ "text": "Акцент"
72
+ },
73
+ {
74
+ "value": "muted",
75
+ "text": "Спокойный"
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "kind": "switch",
81
+ "path": "/wide",
82
+ "label": "Во всю ширину",
83
+ "value": false
84
+ }
85
+ ]
86
+ },
87
+ {
88
+ "key": "button:image",
89
+ "title": "Изображение",
90
+ "fields": [
91
+ {
92
+ "kind": "image",
93
+ "path": "/image",
94
+ "label": "Изображение",
95
+ "value": {
96
+ "value": "a1",
97
+ "label": "cover.png",
98
+ "mime": "image/png",
99
+ "size": 2048,
100
+ "href": "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
101
+ },
102
+ "accept": ".png,.jpg,.jpeg,image/png,image/jpeg",
103
+ "choices": [
104
+ {
105
+ "value": "a2",
106
+ "text": "logo.png"
107
+ }
108
+ ],
109
+ "chooseLabel": "Выбрать из изображений письма"
110
+ },
111
+ {
112
+ "kind": "image",
113
+ "path": "/logo",
114
+ "label": "Логотип",
115
+ "value": {
116
+ "value": "a1",
117
+ "label": "cover.png",
118
+ "mime": "image/png",
119
+ "size": 2048,
120
+ "href": "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
121
+ },
122
+ "required": true,
123
+ "accept": ".png,.jpg,.jpeg,image/png,image/jpeg"
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "key": "button:price",
129
+ "title": "Цена",
130
+ "fields": [
131
+ {
132
+ "kind": "group",
133
+ "path": "/price",
134
+ "label": "Цена",
135
+ "rows": [
136
+ [
137
+ {
138
+ "kind": "number",
139
+ "path": "/price/current",
140
+ "label": "Цена",
141
+ "value": "990",
142
+ "inputmode": "decimal"
143
+ },
144
+ {
145
+ "kind": "number",
146
+ "path": "/price/old",
147
+ "label": "Прежняя цена",
148
+ "value": "",
149
+ "inputmode": "decimal"
150
+ }
151
+ ],
152
+ [
153
+ {
154
+ "kind": "text",
155
+ "path": "/price/currency",
156
+ "label": "Валюта",
157
+ "value": "₽"
158
+ },
159
+ {
160
+ "kind": "text",
161
+ "path": "/price/unit",
162
+ "label": "Единица",
163
+ "value": ""
164
+ }
165
+ ],
166
+ [
167
+ {
168
+ "kind": "text",
169
+ "path": "/price/note",
170
+ "label": "Пояснение к цене",
171
+ "value": ""
172
+ }
173
+ ]
174
+ ]
175
+ }
176
+ ]
177
+ },
178
+ {
179
+ "key": "button:items",
180
+ "title": "Элементы",
181
+ "fields": [
182
+ {
183
+ "kind": "items",
184
+ "path": "/items",
185
+ "label": "Элементы",
186
+ "min": 1,
187
+ "max": 4,
188
+ "open": null,
189
+ "items": [
190
+ {
191
+ "label": "Базовый",
192
+ "fields": [
193
+ {
194
+ "kind": "text",
195
+ "path": "/items/0/title",
196
+ "label": "Заголовок",
197
+ "value": "Базовый"
198
+ }
199
+ ]
200
+ },
201
+ {
202
+ "label": "Расширенный",
203
+ "fields": [
204
+ {
205
+ "kind": "text",
206
+ "path": "/items/1/title",
207
+ "label": "Заголовок",
208
+ "value": "Расширенный"
209
+ }
210
+ ]
211
+ },
212
+ {
213
+ "label": "Команда",
214
+ "fields": [
215
+ {
216
+ "kind": "text",
217
+ "path": "/items/2/title",
218
+ "label": "Заголовок",
219
+ "value": "Команда"
220
+ }
221
+ ],
222
+ "problem": true
223
+ }
224
+ ]
225
+ }
226
+ ]
227
+ }
228
+ ]
229
+ },
230
+ "first-paint": {
231
+ "max-bytes": 40000,
232
+ "why": "the whole form is the first paint: five sections, sixteen fields with their labels, two image wells and three list rows; the ⋯ menu is printed closed"
233
+ },
234
+ "studio": {
235
+ "id": "inspector-reference",
236
+ "title": "Mail inspector reference",
237
+ "summary": "Deterministic reference fixture for sf-mail-inspector: a block with every kind of field.",
238
+ "props": {
239
+ "heading": "Кнопка",
240
+ "heading-icon": "smart_button",
241
+ "form-key": "b7",
242
+ "head-actions": [
243
+ "duplicate",
244
+ "delete"
245
+ ],
246
+ "levels": [
247
+ {
248
+ "text": "Кнопка"
249
+ }
250
+ ],
251
+ "sections": [
252
+ {
253
+ "key": "button:content",
254
+ "title": "Содержимое",
255
+ "fields": [
256
+ {
257
+ "kind": "text",
258
+ "path": "/text",
259
+ "label": "Текст",
260
+ "value": "Подробнее",
261
+ "required": true
262
+ },
263
+ {
264
+ "kind": "link",
265
+ "path": "/url",
266
+ "label": "Ссылка",
267
+ "value": "https://simai.ru",
268
+ "placeholder": "https://"
269
+ },
270
+ {
271
+ "kind": "number",
272
+ "path": "/discount",
273
+ "label": "Скидка",
274
+ "value": "10"
275
+ },
276
+ {
277
+ "kind": "multiline",
278
+ "path": "/note",
279
+ "label": "Примечание",
280
+ "value": "",
281
+ "hint": "Как в бренде: Спасибо, что вы с нами"
282
+ }
283
+ ]
284
+ },
285
+ {
286
+ "key": "button:look",
287
+ "title": "Оформление",
288
+ "fields": [
289
+ {
290
+ "kind": "select",
291
+ "path": "/tone",
292
+ "label": "Тон",
293
+ "value": "accent",
294
+ "options": [
295
+ {
296
+ "value": "",
297
+ "text": "— нет —"
298
+ },
299
+ {
300
+ "value": "accent",
301
+ "text": "Акцент"
302
+ },
303
+ {
304
+ "value": "muted",
305
+ "text": "Спокойный"
306
+ }
307
+ ]
308
+ },
309
+ {
310
+ "kind": "switch",
311
+ "path": "/wide",
312
+ "label": "Во всю ширину",
313
+ "value": false
314
+ }
315
+ ]
316
+ },
317
+ {
318
+ "key": "button:image",
319
+ "title": "Изображение",
320
+ "fields": [
321
+ {
322
+ "kind": "image",
323
+ "path": "/image",
324
+ "label": "Изображение",
325
+ "value": {
326
+ "value": "a1",
327
+ "label": "cover.png",
328
+ "mime": "image/png",
329
+ "size": 2048,
330
+ "href": "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
331
+ },
332
+ "accept": ".png,.jpg,.jpeg,image/png,image/jpeg",
333
+ "choices": [
334
+ {
335
+ "value": "a2",
336
+ "text": "logo.png"
337
+ }
338
+ ],
339
+ "chooseLabel": "Выбрать из изображений письма"
340
+ },
341
+ {
342
+ "kind": "image",
343
+ "path": "/logo",
344
+ "label": "Логотип",
345
+ "value": {
346
+ "value": "a1",
347
+ "label": "cover.png",
348
+ "mime": "image/png",
349
+ "size": 2048,
350
+ "href": "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
351
+ },
352
+ "required": true,
353
+ "accept": ".png,.jpg,.jpeg,image/png,image/jpeg"
354
+ }
355
+ ]
356
+ },
357
+ {
358
+ "key": "button:price",
359
+ "title": "Цена",
360
+ "fields": [
361
+ {
362
+ "kind": "group",
363
+ "path": "/price",
364
+ "label": "Цена",
365
+ "rows": [
366
+ [
367
+ {
368
+ "kind": "number",
369
+ "path": "/price/current",
370
+ "label": "Цена",
371
+ "value": "990",
372
+ "inputmode": "decimal"
373
+ },
374
+ {
375
+ "kind": "number",
376
+ "path": "/price/old",
377
+ "label": "Прежняя цена",
378
+ "value": "",
379
+ "inputmode": "decimal"
380
+ }
381
+ ],
382
+ [
383
+ {
384
+ "kind": "text",
385
+ "path": "/price/currency",
386
+ "label": "Валюта",
387
+ "value": "₽"
388
+ },
389
+ {
390
+ "kind": "text",
391
+ "path": "/price/unit",
392
+ "label": "Единица",
393
+ "value": ""
394
+ }
395
+ ],
396
+ [
397
+ {
398
+ "kind": "text",
399
+ "path": "/price/note",
400
+ "label": "Пояснение к цене",
401
+ "value": ""
402
+ }
403
+ ]
404
+ ]
405
+ }
406
+ ]
407
+ },
408
+ {
409
+ "key": "button:items",
410
+ "title": "Элементы",
411
+ "fields": [
412
+ {
413
+ "kind": "items",
414
+ "path": "/items",
415
+ "label": "Элементы",
416
+ "min": 1,
417
+ "max": 4,
418
+ "open": null,
419
+ "items": [
420
+ {
421
+ "label": "Базовый",
422
+ "fields": [
423
+ {
424
+ "kind": "text",
425
+ "path": "/items/0/title",
426
+ "label": "Заголовок",
427
+ "value": "Базовый"
428
+ }
429
+ ]
430
+ },
431
+ {
432
+ "label": "Расширенный",
433
+ "fields": [
434
+ {
435
+ "kind": "text",
436
+ "path": "/items/1/title",
437
+ "label": "Заголовок",
438
+ "value": "Расширенный"
439
+ }
440
+ ]
441
+ },
442
+ {
443
+ "label": "Команда",
444
+ "fields": [
445
+ {
446
+ "kind": "text",
447
+ "path": "/items/2/title",
448
+ "label": "Заголовок",
449
+ "value": "Команда"
450
+ }
451
+ ],
452
+ "problem": true
453
+ }
454
+ ]
455
+ }
456
+ ]
457
+ }
458
+ ]
459
+ },
460
+ "scenario": {
461
+ "steps": [
462
+ {
463
+ "invoke": "toggle-section",
464
+ "with": [
465
+ {
466
+ "key": "button:look"
467
+ }
468
+ ]
469
+ },
470
+ {
471
+ "invoke": "item-move",
472
+ "with": [
473
+ {
474
+ "path": "/items",
475
+ "index": 0,
476
+ "to": 1
477
+ }
478
+ ]
479
+ }
480
+ ]
481
+ }
482
+ }
483
+ },
484
+ {
485
+ "name": "letter",
486
+ "title": "Письмо: вкладки, поля на первой",
487
+ "attributes": {
488
+ "heading": "Параметры письма",
489
+ "form-key": "letter",
490
+ "tab": "content"
491
+ },
492
+ "settings": {
493
+ "tabs": [
494
+ {
495
+ "id": "content",
496
+ "label": "Основное"
497
+ },
498
+ {
499
+ "id": "brand",
500
+ "label": "Бренд",
501
+ "slot": "brand"
502
+ },
503
+ {
504
+ "id": "images",
505
+ "label": "Картинки",
506
+ "slot": "images"
507
+ },
508
+ {
509
+ "id": "versions",
510
+ "label": "Версии",
511
+ "slot": "versions"
512
+ }
513
+ ],
514
+ "sections": [
515
+ {
516
+ "key": "letter:content",
517
+ "title": "Основное",
518
+ "fields": [
519
+ {
520
+ "kind": "text",
521
+ "path": "/subject",
522
+ "label": "Тема письма",
523
+ "value": "Осенняя рассылка",
524
+ "required": true
525
+ },
526
+ {
527
+ "kind": "text",
528
+ "path": "/preheader",
529
+ "label": "Прехедер",
530
+ "value": ""
531
+ },
532
+ {
533
+ "kind": "multiline",
534
+ "path": "/reason",
535
+ "label": "Причина получения",
536
+ "value": "",
537
+ "inheritedValue": "Вы подписаны на новости",
538
+ "hint": "Как в бренде: Вы подписаны на новости"
539
+ },
540
+ {
541
+ "kind": "link",
542
+ "path": "/unsubscribe",
543
+ "label": "Ссылка отписки",
544
+ "value": "htt",
545
+ "required": true,
546
+ "placeholder": "https://",
547
+ "hint": "Адрес https:// или тег системы рассылки",
548
+ "error": "Нужен адрес https:// или тег системы рассылки"
549
+ },
550
+ {
551
+ "kind": "select",
552
+ "path": "/language",
553
+ "label": "Язык письма",
554
+ "value": "ru",
555
+ "options": [
556
+ {
557
+ "value": "ru",
558
+ "text": "Русский"
559
+ },
560
+ {
561
+ "value": "en",
562
+ "text": "English"
563
+ }
564
+ ]
565
+ }
566
+ ]
567
+ }
568
+ ]
569
+ },
570
+ "first-paint": {
571
+ "max-bytes": 18000,
572
+ "why": "the four tabs and the letter's five fields with their hints and an error: all of it is visible at once"
573
+ }
574
+ },
575
+ {
576
+ "name": "item",
577
+ "title": "Открытый элемент: путь на два уровня",
578
+ "attributes": {
579
+ "heading": "Кнопка",
580
+ "heading-icon": "smart_button",
581
+ "form-key": "b7"
582
+ },
583
+ "settings": {
584
+ "head-actions": [
585
+ "duplicate",
586
+ "delete"
587
+ ],
588
+ "levels": [
589
+ {
590
+ "text": "Кнопка"
591
+ },
592
+ {
593
+ "text": "Расширенный"
594
+ }
595
+ ],
596
+ "notice": {
597
+ "text": "Причина получения и ссылка отписки — в параметрах письма.",
598
+ "action": "Открыть параметры письма"
599
+ },
600
+ "sections": [
601
+ {
602
+ "key": "button:items",
603
+ "title": "Элементы",
604
+ "fields": [
605
+ {
606
+ "kind": "items",
607
+ "path": "/items",
608
+ "label": "Элементы",
609
+ "min": 1,
610
+ "max": 4,
611
+ "open": 1,
612
+ "items": [
613
+ {
614
+ "label": "Базовый",
615
+ "fields": [
616
+ {
617
+ "kind": "text",
618
+ "path": "/items/0/title",
619
+ "label": "Заголовок",
620
+ "value": "Базовый"
621
+ }
622
+ ]
623
+ },
624
+ {
625
+ "label": "Расширенный",
626
+ "fields": [
627
+ {
628
+ "kind": "text",
629
+ "path": "/items/1/title",
630
+ "label": "Заголовок",
631
+ "value": "Расширенный"
632
+ }
633
+ ]
634
+ },
635
+ {
636
+ "label": "Команда",
637
+ "fields": [
638
+ {
639
+ "kind": "text",
640
+ "path": "/items/2/title",
641
+ "label": "Заголовок",
642
+ "value": "Команда"
643
+ }
644
+ ],
645
+ "problem": true
646
+ }
647
+ ]
648
+ }
649
+ ]
650
+ }
651
+ ]
652
+ },
653
+ "first-paint": {
654
+ "max-bytes": 18000,
655
+ "why": "the path, the heading with its buttons, the notice, three list rows and the open item's field"
656
+ }
657
+ }
658
+ ],
659
+ "pages": [
660
+ {
661
+ "name": "conformance",
662
+ "title": "sf-mail-inspector against component.json (standard simai.smart-component 1.4 §12, gate 20): every kind of field, typed text across redraws, each event, section memory, the list verbs, the path and the tabs",
663
+ "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",
664
+ "page": {
665
+ "lang": "ru",
666
+ "body": [
667
+ "<main>",
668
+ " <sf-mail-inspector id=\"panel\" heading=\"Кнопка\" heading-icon=\"smart_button\" form-key=\"b7\"></sf-mail-inspector>",
669
+ "</main>"
670
+ ]
671
+ },
672
+ "checks": [
673
+ {
674
+ "id": "p1-draws-every-field",
675
+ "title": "every kind is drawn as its Framework element, and a hint is real text under the field",
676
+ "covers": "settings.sections, settings.heading, settings.head-actions",
677
+ "steps": [
678
+ {
679
+ "wait": 900,
680
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
681
+ },
682
+ {
683
+ "wait": 50,
684
+ "check": "(() => { const q = (s) => one.querySelector(s); return q('sf-input[data-path=\"/text\"]') && q('sf-input[data-path=\"/url\"]') && q('sf-input[data-path=\"/discount\"]') && q('sf-input-textarea[data-path=\"/note\"]') && q('sf-dropdown[data-path=\"/tone\"]') && q('sf-switch[data-path=\"/wide\"]') && q('[data-path=\"/image\"] sf-input-image') && q('[data-group=\"/price\"] .sf-mail-inspector-pair sf-input[data-path=\"/price/old\"]') && q('[data-items=\"/items\"] sf-sortable [data-item=\"2\"].has-problem') && q('sf-input-textarea[data-path=\"/note\"]').textContent.includes('Как в бренде') && q('.sf-mail-inspector-title').textContent === 'Кнопка' && one.querySelectorAll('.sf-mail-inspector-action').length === 2 && !q('sf-breadcrumbs') && one.querySelectorAll('.sf-accordion').length === 5 && native('/discount').inputMode === 'numeric' && native('/url').type === 'url' && native('/price/current').inputMode === 'decimal' && q('[data-path=\"/image\"] sf-dropdown'); })()"
685
+ }
686
+ ]
687
+ },
688
+ {
689
+ "id": "p2-draft-kept-focus-kept",
690
+ "title": "text the host did not take stays across redraws, marked, with the focus and the caret where they were",
691
+ "covers": "events.change, settings.sections",
692
+ "steps": [
693
+ {
694
+ "wait": 900,
695
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
696
+ },
697
+ {
698
+ "script": "(() => { const input = put('/url', 'x'); globalThis.input = input; input.setSelectionRange(3, 3); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
699
+ "wait": 400
700
+ },
701
+ {
702
+ "wait": 50,
703
+ "check": "native('/url') === input && document.activeElement === input && input.value === 'https://simai.rux' && input.selectionStart === 3 && input.selectionEnd === 3 && one.querySelector('sf-input[data-path=\"/url\"]').hasAttribute('invalid') && one.querySelector('sf-input[data-path=\"/url\"]').dataset.draft === 'true' && one.querySelector('sf-input[data-path=\"/url\"]').textContent.includes('Нужен адрес') && JSON.stringify(heard) === JSON.stringify([['change', {path: '/url', value: 'https://simai.rux', typed: true}]])"
704
+ },
705
+ {
706
+ "script": "(() => { document.execCommand('insertText', false, 'Q'); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
707
+ "wait": 400
708
+ },
709
+ {
710
+ "wait": 50,
711
+ "check": "document.activeElement === input && input.value === 'httQps://simai.rux' && input.selectionStart === 4"
712
+ },
713
+ {
714
+ "script": "(() => { input.blur(); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
715
+ "wait": 400
716
+ },
717
+ {
718
+ "wait": 50,
719
+ "check": "input.value === 'httQps://simai.rux' && one.querySelector('sf-input[data-path=\"/url\"]').hasAttribute('invalid')"
720
+ },
721
+ {
722
+ "script": "(() => { one.sections = withField('/url', {value: 'https://ok.ru'}); return true; })()",
723
+ "wait": 400
724
+ },
725
+ {
726
+ "wait": 50,
727
+ "check": "native('/url').value === 'https://ok.ru' && !one.querySelector('sf-input[data-path=\"/url\"]').hasAttribute('invalid') && !one.querySelector('sf-input[data-path=\"/url\"]').dataset.draft"
728
+ }
729
+ ]
730
+ },
731
+ {
732
+ "id": "p3-typing-through-a-late-answer",
733
+ "title": "a late answer of the host never overwrites the field being typed in; leaving it shows the host's value",
734
+ "covers": "events.change, settings.sections",
735
+ "steps": [
736
+ {
737
+ "wait": 900,
738
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
739
+ },
740
+ {
741
+ "script": "(() => { globalThis.input = put('/text', ' сейчас'); one.sections = withField('/text', {value: 'Подробнее сей'}); return true; })()",
742
+ "wait": 400
743
+ },
744
+ {
745
+ "wait": 50,
746
+ "check": "document.activeElement === input && input.value === 'Подробнее сейчас' && input.selectionStart === input.value.length"
747
+ },
748
+ {
749
+ "script": "(() => { input.blur(); return true; })()",
750
+ "wait": 400
751
+ },
752
+ {
753
+ "wait": 50,
754
+ "check": "native('/text').value === 'Подробнее сей'"
755
+ }
756
+ ]
757
+ },
758
+ {
759
+ "id": "p4-multiline-and-group-keep-drafts",
760
+ "title": "a text area and a field in a group keep a draft the same way",
761
+ "covers": "settings.sections",
762
+ "steps": [
763
+ {
764
+ "wait": 900,
765
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
766
+ },
767
+ {
768
+ "script": "(() => { put('/price/current', 'abc'); one.sections = withField('/price/current', {error: 'Нужно число'}); return true; })()",
769
+ "wait": 400
770
+ },
771
+ {
772
+ "wait": 50,
773
+ "check": "native('/price/current').value === '990abc' && document.activeElement === native('/price/current') && one.querySelector('[data-path=\"/price/current\"]').hasAttribute('invalid')"
774
+ },
775
+ {
776
+ "script": "(() => { globalThis.area = put('/note', 'Первая строка'); area.setSelectionRange(2, 2); one.sections = withField('/note', {error: 'Слишком длинно'}); return true; })()",
777
+ "wait": 400
778
+ },
779
+ {
780
+ "wait": 50,
781
+ "check": "native('/note') === area && area.value === 'Первая строка' && document.activeElement === area && area.selectionStart === 2 && one.querySelector('sf-input-textarea[data-path=\"/note\"]').hasAttribute('invalid')"
782
+ }
783
+ ]
784
+ },
785
+ {
786
+ "id": "p5-choices-say-change",
787
+ "title": "a choice, a switch and a typed link each say change, and the element changes nothing",
788
+ "covers": "events.change",
789
+ "steps": [
790
+ {
791
+ "wait": 900,
792
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
793
+ },
794
+ {
795
+ "script": "(() => { one.querySelector('sf-dropdown[data-path=\"/tone\"]').selectValue('muted'); const toggle = one.querySelector('sf-switch[data-path=\"/wide\"] input'); toggle.click(); return true; })()",
796
+ "wait": 300
797
+ },
798
+ {
799
+ "wait": 50,
800
+ "check": "JSON.stringify(heard) === JSON.stringify([['change', {path: '/tone', value: 'muted', typed: false}], ['change', {path: '/wide', value: true, typed: false}]])"
801
+ },
802
+ {
803
+ "script": "(() => { one.sections = base(); return true; })()",
804
+ "wait": 400
805
+ },
806
+ {
807
+ "wait": 50,
808
+ "check": "one.querySelector('sf-dropdown[data-path=\"/tone\"]').getAttribute('value') === 'accent' && one.querySelector('sf-switch[data-path=\"/wide\"]').isChecked() === false"
809
+ }
810
+ ]
811
+ },
812
+ {
813
+ "id": "p6-image",
814
+ "title": "a file says attach, a removal detach, a required image stays and says why, a refused file brings the stored image back, and a choice is a change",
815
+ "covers": "events.attach, events.detach",
816
+ "steps": [
817
+ {
818
+ "wait": 1200,
819
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
820
+ },
821
+ {
822
+ "script": "(() => { const well = one.querySelector('[data-path=\"/image\"] sf-input-image'); globalThis.file = new File(['probe'], 'new.png', {type: 'image/png'}); well.takeFile(file, 'input'); return true; })()",
823
+ "wait": 300
824
+ },
825
+ {
826
+ "wait": 50,
827
+ "check": "heard.length === 1 && heard[0][0] === 'attach' && heard[0][1].path === '/image' && heard[0][1].files[0] === file && one.querySelector('[data-path=\"/image\"] sf-input-image').value.href.startsWith('blob:')"
828
+ },
829
+ {
830
+ "script": "(() => { one.sections = withField('/image', {error: 'Файл слишком большой'}); return true; })()",
831
+ "wait": 500
832
+ },
833
+ {
834
+ "wait": 50,
835
+ "check": "one.querySelector('[data-path=\"/image\"] sf-input-image').value.value === 'a1' && one.querySelector('[data-path=\"/image\"] sf-input-image').textContent.includes('Файл слишком большой')"
836
+ },
837
+ {
838
+ "script": "(() => { heard.length = 0; one.sections = base(); return true; })()",
839
+ "wait": 400
840
+ },
841
+ {
842
+ "script": "(() => { one.querySelector('[data-path=\"/image\"] sf-input-image').removeImage(); return true; })()",
843
+ "wait": 300
844
+ },
845
+ {
846
+ "wait": 50,
847
+ "check": "JSON.stringify(heard) === JSON.stringify([['detach', {path: '/image'}]])"
848
+ },
849
+ {
850
+ "script": "(() => { heard.length = 0; one.querySelector('[data-path=\"/logo\"] sf-input-image').removeImage(); return true; })()",
851
+ "wait": 400
852
+ },
853
+ {
854
+ "wait": 50,
855
+ "check": "heard.length === 0 && one.querySelector('[data-path=\"/logo\"] sf-input-image').value.value === 'a1' && one.querySelector('[data-path=\"/logo\"] sf-input-image').textContent.includes('обязательно')"
856
+ },
857
+ {
858
+ "script": "(() => { one.querySelector('[data-choose=\"/image\"]').selectValue('a2'); return true; })()",
859
+ "wait": 300
860
+ },
861
+ {
862
+ "wait": 50,
863
+ "check": "JSON.stringify(heard) === JSON.stringify([['change', {path: '/image', value: 'a2', typed: false}]])"
864
+ }
865
+ ]
866
+ },
867
+ {
868
+ "id": "p7-head-actions",
869
+ "title": "the heading's buttons say duplicate and delete, a pinned place's says replace, and an action not offered is refused",
870
+ "covers": "events.duplicate, events.delete, events.replace, actions.duplicate, actions.replace",
871
+ "steps": [
872
+ {
873
+ "wait": 900,
874
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
875
+ },
876
+ {
877
+ "script": "(() => { one.querySelector('[data-action=\"duplicate\"]').click(); one.querySelector('[data-action=\"delete\"]').click(); globalThis.notOffered = one.replace().reason; return true; })()",
878
+ "wait": 200
879
+ },
880
+ {
881
+ "wait": 50,
882
+ "check": "names() === 'duplicate,delete' && notOffered === 'unknown'"
883
+ },
884
+ {
885
+ "script": "(() => { heard.length = 0; one.headActions = ['replace']; return true; })()",
886
+ "wait": 400
887
+ },
888
+ {
889
+ "script": "(() => { one.querySelector('[data-action=\"replace\"]').click(); return true; })()",
890
+ "wait": 200
891
+ },
892
+ {
893
+ "wait": 50,
894
+ "check": "names() === 'replace' && !one.querySelector('[data-action=\"delete\"]')"
895
+ }
896
+ ]
897
+ },
898
+ {
899
+ "id": "p8-section-memory",
900
+ "title": "a section closes, is told, stays closed under new data with the same key, and comes back from the host's list",
901
+ "covers": "events.toggle, settings.closed-sections",
902
+ "steps": [
903
+ {
904
+ "wait": 900,
905
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
906
+ },
907
+ {
908
+ "script": "(() => { one.querySelector('[data-section=\"button:look\"] .sf-accordion-trigger').click(); return true; })()",
909
+ "wait": 300
910
+ },
911
+ {
912
+ "wait": 50,
913
+ "check": "JSON.stringify(heard) === JSON.stringify([['toggle', {key: 'button:look', open: false}]]) && one.querySelector('[data-section=\"button:look\"] .sf-accordion-content').hidden && one.querySelector('[data-section=\"button:look\"] .sf-accordion-trigger').getAttribute('aria-expanded') === 'false' && JSON.stringify(one.closedSections) === JSON.stringify(['button:look'])"
914
+ },
915
+ {
916
+ "script": "(() => { one.setAttribute('form-key', 'b8'); one.sections = base(); return true; })()",
917
+ "wait": 400
918
+ },
919
+ {
920
+ "wait": 50,
921
+ "check": "one.querySelector('[data-section=\"button:look\"] .sf-accordion-content').hidden && !one.querySelector('[data-section=\"button:content\"] .sf-accordion-content').hidden"
922
+ },
923
+ {
924
+ "script": "(() => { one.closedSections = ['button:content']; return true; })()",
925
+ "wait": 300
926
+ },
927
+ {
928
+ "wait": 50,
929
+ "check": "!one.querySelector('[data-section=\"button:look\"] .sf-accordion-content').hidden && one.querySelector('[data-section=\"button:content\"] .sf-accordion-content').hidden && one.toggleSection({key: 'nope'}).reason === 'unknown'"
930
+ },
931
+ {
932
+ "script": "(() => { const data = base(); one.sections = [data[0]]; return true; })()",
933
+ "wait": 300
934
+ },
935
+ {
936
+ "wait": 50,
937
+ "check": "one.querySelectorAll('.sf-accordion').length === 0 && one.querySelector('sf-input[data-path=\"/text\"]') !== null"
938
+ }
939
+ ]
940
+ },
941
+ {
942
+ "id": "p9-list-verbs",
943
+ "title": "an item opens, adds, copies, removes and moves, each told with its list, and the focus goes to the item that changed",
944
+ "covers": "events.item-toggle, events.item-add, events.item-duplicate, events.item-delete, events.item-move",
945
+ "steps": [
946
+ {
947
+ "wait": 1200,
948
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
949
+ },
950
+ {
951
+ "script": "(() => { one.querySelector('[data-items=\"/items\"] [data-toggle=\"1\"]').click(); return true; })()",
952
+ "wait": 200
953
+ },
954
+ {
955
+ "wait": 50,
956
+ "check": "JSON.stringify(heard) === JSON.stringify([['item-toggle', {path: '/items', index: 1, open: true}]]) && !one.querySelector('[data-path=\"/items/1/title\"]')"
957
+ },
958
+ {
959
+ "script": "(() => { heard.length = 0; const data = withField('/items', {open: 1}); one.sections = data; return true; })()",
960
+ "wait": 500
961
+ },
962
+ {
963
+ "wait": 50,
964
+ "check": "one.querySelector('sf-input[data-path=\"/items/1/title\"]') && one.querySelector('[data-item=\"1\"]').classList.contains('is-open') && one.querySelector('[data-toggle=\"1\"]').getAttribute('aria-expanded') === 'true' && !one.querySelector('[data-item=\"0\"] .sf-mail-inspector-item-body').querySelector('sf-input')"
965
+ },
966
+ {
967
+ "script": "(() => { one.querySelector('[data-item-add=\"/items\"]').click(); return true; })()",
968
+ "wait": 200
969
+ },
970
+ {
971
+ "wait": 50,
972
+ "check": "JSON.stringify(heard) === JSON.stringify([['item-add', {path: '/items'}]])"
973
+ },
974
+ {
975
+ "script": "(() => { heard.length = 0; one.openItemMenu('/items', 1, one.querySelector('[data-item-menu=\"1\"]')); one.onMenuSelect({id: 'duplicate'}); return true; })()",
976
+ "wait": 300
977
+ },
978
+ {
979
+ "script": "(() => { one.onMenuSelect({id: 'remove'}); return true; })()",
980
+ "wait": 300
981
+ },
982
+ {
983
+ "script": "(() => { one.onMenuSelect({id: 'up'}); return true; })()",
984
+ "wait": 300
985
+ },
986
+ {
987
+ "script": "(() => { one.onMenuSelect({id: 'down'}); return true; })()",
988
+ "wait": 300
989
+ },
990
+ {
991
+ "wait": 50,
992
+ "check": "JSON.stringify(heard) === JSON.stringify([['item-duplicate', {path: '/items', index: 1}], ['item-delete', {path: '/items', index: 1}], ['item-move', {path: '/items', from: 1, to: 0}], ['item-move', {path: '/items', from: 1, to: 2}]])"
993
+ },
994
+ {
995
+ "script": "(() => { one.sections = base(); return true; })()",
996
+ "wait": 500
997
+ },
998
+ {
999
+ "wait": 50,
1000
+ "check": "document.activeElement === one.querySelector('[data-toggle=\"2\"]')"
1001
+ }
1002
+ ]
1003
+ },
1004
+ {
1005
+ "id": "p10-item-moves-are-free",
1006
+ "title": "any item moves anywhere: first to last, by drag and by keys, and the ends only refuse going beyond them",
1007
+ "covers": "actions.item-move, events.item-move",
1008
+ "steps": [
1009
+ {
1010
+ "wait": 1200,
1011
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
1012
+ },
1013
+ {
1014
+ "script": "(() => { globalThis.answers = [one.itemMove({path: '/items', index: 0, to: 2}).outcome, one.itemMove({path: '/items', index: 2, to: 0}).outcome, one.itemMove({path: '/items', index: 0, by: -1}).reason, one.itemMove({path: '/items', index: 2, by: 1}).reason, one.itemMove({path: '/nope', index: 0, by: 1}).reason]; return true; })()",
1015
+ "wait": 200
1016
+ },
1017
+ {
1018
+ "wait": 50,
1019
+ "check": "answers.join(',') === 'applied,applied,unchanged,unchanged,unknown' && JSON.stringify(heard) === JSON.stringify([['item-move', {path: '/items', from: 0, to: 2}], ['item-move', {path: '/items', from: 2, to: 0}]])"
1020
+ },
1021
+ {
1022
+ "script": "(() => { heard.length = 0; const list = one.querySelector('[data-items=\"/items\"] sf-sortable'); list.dispatchEvent(new CustomEvent('sf-sortable-move', {bubbles: true, detail: {item: 'item-2', from: list.getAttribute('group'), to: list.getAttribute('group'), index: 0}})); return true; })()",
1023
+ "wait": 200
1024
+ },
1025
+ {
1026
+ "wait": 50,
1027
+ "check": "JSON.stringify(heard) === JSON.stringify([['item-move', {path: '/items', from: 2, to: 0}]])"
1028
+ },
1029
+ {
1030
+ "script": "(() => { heard.length = 0; const toggle = one.querySelector('[data-toggle=\"1\"]'); toggle.focus(); toggle.dispatchEvent(new KeyboardEvent('keydown', {key: 'ArrowUp', altKey: true, bubbles: true, cancelable: true})); return true; })()",
1031
+ "wait": 300
1032
+ },
1033
+ {
1034
+ "wait": 50,
1035
+ "check": "JSON.stringify(heard) === JSON.stringify([['item-move', {path: '/items', from: 1, to: 0}]]) && one.querySelector('.sf-mail-inspector-said[role=\"status\"]').textContent.includes('позиция 1 из 3')"
1036
+ }
1037
+ ]
1038
+ },
1039
+ {
1040
+ "id": "p11-list-bounds",
1041
+ "title": "at max nothing is added or copied, at min nothing is removed, and the buttons say so",
1042
+ "covers": "actions.item-add, actions.item-duplicate, actions.item-delete",
1043
+ "steps": [
1044
+ {
1045
+ "wait": 1200,
1046
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
1047
+ },
1048
+ {
1049
+ "script": "(() => { one.sections = withField('/items', {max: 3, min: 3}); return true; })()",
1050
+ "wait": 400
1051
+ },
1052
+ {
1053
+ "wait": 50,
1054
+ "check": "one.itemAdd({path: '/items'}).reason === 'full' && one.itemDuplicate({path: '/items', index: 0}).reason === 'full' && one.itemDelete({path: '/items', index: 0}).reason === 'least' && one.querySelector('[data-item-add=\"/items\"]').hasAttribute('disabled') && heard.length === 0 && one.menuEntries(fieldOf(one.sections, '/items'), 0).filter((entry) => entry.disabled).map((entry) => entry.id).join(',') === 'up,duplicate,remove'"
1055
+ }
1056
+ ]
1057
+ },
1058
+ {
1059
+ "id": "p12-level-and-escape",
1060
+ "title": "the path is drawn from two levels; a press and Escape ask for a level, and Escape takes the focus from a closing item to its row",
1061
+ "covers": "events.level, settings.levels, actions.level-up",
1062
+ "steps": [
1063
+ {
1064
+ "wait": 1200,
1065
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
1066
+ },
1067
+ {
1068
+ "script": "(() => { one.levels = [{text: 'Кнопка'}, {text: 'Расширенный'}]; one.sections = withField('/items', {open: 1}); return true; })()",
1069
+ "wait": 600
1070
+ },
1071
+ {
1072
+ "script": "(() => { const crumbs = one.querySelector('sf-breadcrumbs'); globalThis.crumbs = crumbs; crumbs.querySelector('a').click(); return true; })()",
1073
+ "wait": 200
1074
+ },
1075
+ {
1076
+ "wait": 50,
1077
+ "check": "crumbs && JSON.stringify(heard) === JSON.stringify([['level', {index: 0}]]) && location.hash === ''"
1078
+ },
1079
+ {
1080
+ "script": "(() => { heard.length = 0; globalThis.input = native('/items/1/title'); input.focus(); globalThis.escape = new KeyboardEvent('keydown', {key: 'Escape', bubbles: true, cancelable: true}); input.dispatchEvent(escape); return true; })()",
1081
+ "wait": 200
1082
+ },
1083
+ {
1084
+ "script": "(() => { one.levels = [{text: 'Кнопка'}]; one.sections = base(); return true; })()",
1085
+ "wait": 500
1086
+ },
1087
+ {
1088
+ "wait": 50,
1089
+ "check": "JSON.stringify(heard) === JSON.stringify([['level', {index: 0}]]) && escape.defaultPrevented && document.activeElement === one.querySelector('[data-toggle=\"1\"]') && !one.querySelector('sf-breadcrumbs')"
1090
+ },
1091
+ {
1092
+ "script": "(() => { heard.length = 0; native('/text').dispatchEvent(new KeyboardEvent('keydown', {key: 'Escape', bubbles: true, cancelable: true})); return true; })()",
1093
+ "wait": 200
1094
+ },
1095
+ {
1096
+ "wait": 50,
1097
+ "check": "JSON.stringify(heard) === JSON.stringify([['level', {index: -1}]])"
1098
+ },
1099
+ {
1100
+ "script": "(() => { heard.length = 0; one.levels = []; return true; })()",
1101
+ "wait": 300
1102
+ },
1103
+ {
1104
+ "script": "(() => { globalThis.free = new KeyboardEvent('keydown', {key: 'Escape', bubbles: true, cancelable: true}); native('/text').dispatchEvent(free); globalThis.atTop = one.levelUp().reason; return true; })()",
1105
+ "wait": 200
1106
+ },
1107
+ {
1108
+ "wait": 50,
1109
+ "check": "heard.length === 0 && !free.defaultPrevented && atTop === 'top'"
1110
+ }
1111
+ ]
1112
+ },
1113
+ {
1114
+ "id": "p13-tabs-and-host-panels",
1115
+ "title": "tabs show the form and the host's panels from slots; a press says tab, the host's tab moves it, and a draft in the form survives",
1116
+ "covers": "events.tab, settings.tabs, settings.tab",
1117
+ "steps": [
1118
+ {
1119
+ "wait": 1200,
1120
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
1121
+ },
1122
+ {
1123
+ "script": "(() => { const brand = document.createElement('div'); brand.id = 'brand-panel'; brand.textContent = 'Панель бренда'; one.setSlot('brand', brand); one.tabs = [{id: 'content', label: 'Основное'}, {id: 'brand', label: 'Бренд', slot: 'brand'}, {id: 'images', label: 'Картинки', slot: 'images'}, {id: 'versions', label: 'Версии', slot: 'versions'}]; one.setAttribute('tab', 'content'); return true; })()",
1124
+ "wait": 800
1125
+ },
1126
+ {
1127
+ "wait": 50,
1128
+ "check": "one.querySelector('sf-tabs [data-tab=\"content\"] sf-input[data-path=\"/text\"]') && one.querySelector('sf-tabs [data-tab=\"brand\"] #brand-panel') && one.querySelectorAll('sf-tabs [role=\"tab\"]').length === 4 && one.querySelector('sf-tabs [data-tab=\"content\"]').closest('[role=\"tabpanel\"]').hidden === false && one.querySelector('sf-tabs [data-tab=\"brand\"]').closest('[role=\"tabpanel\"]').hidden === true"
1129
+ },
1130
+ {
1131
+ "script": "(() => { heard.length = 0; globalThis.input = put('/url', 'x'); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
1132
+ "wait": 400
1133
+ },
1134
+ {
1135
+ "wait": 50,
1136
+ "check": "native('/url') === input && document.activeElement === input && input.value === 'https://simai.rux'"
1137
+ },
1138
+ {
1139
+ "script": "(() => { heard.length = 0; [...one.querySelectorAll('sf-tabs [role=\"tab\"]')][1].click(); return true; })()",
1140
+ "wait": 400
1141
+ },
1142
+ {
1143
+ "wait": 50,
1144
+ "check": "JSON.stringify(heard) === JSON.stringify([['tab', {id: 'brand'}]]) && one.querySelector('sf-tabs [data-tab=\"brand\"]').closest('[role=\"tabpanel\"]').hidden === false"
1145
+ },
1146
+ {
1147
+ "script": "(() => { heard.length = 0; one.setAttribute('tab', 'content'); return true; })()",
1148
+ "wait": 500
1149
+ },
1150
+ {
1151
+ "wait": 50,
1152
+ "check": "heard.length === 0 && one.querySelector('sf-tabs [data-tab=\"content\"]').closest('[role=\"tabpanel\"]').hidden === false && native('/url').value === 'https://simai.rux'"
1153
+ },
1154
+ {
1155
+ "script": "(() => { const next = document.createElement('div'); next.id = 'brand-next'; one.setSlot('brand', next); return true; })()",
1156
+ "wait": 400
1157
+ },
1158
+ {
1159
+ "wait": 50,
1160
+ "check": "one.querySelector('sf-tabs [data-tab=\"brand\"] #brand-next') && !one.querySelector('#brand-panel')"
1161
+ }
1162
+ ]
1163
+ },
1164
+ {
1165
+ "id": "p15-real-keys",
1166
+ "title": "with real key presses: typing through redraws loses nothing, Enter and Space open an item, Alt+arrows move it, Shift+F10 opens its menu, Escape goes up",
1167
+ "covers": "keyboard.item, keyboard.host",
1168
+ "steps": [
1169
+ {
1170
+ "wait": 1200,
1171
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
1172
+ },
1173
+ {
1174
+ "script": "(() => { globalThis.input = native('/text'); input.focus(); input.setSelectionRange(9, 9); globalThis.redraws = setInterval(() => { one.sections = withField('/text', {error: 'Не подходит'}); }, 5); return true; })()",
1175
+ "wait": 50
1176
+ },
1177
+ {
1178
+ "user": "keyboard:a",
1179
+ "wait": 30
1180
+ },
1181
+ {
1182
+ "user": "keyboard:b",
1183
+ "wait": 30
1184
+ },
1185
+ {
1186
+ "user": "keyboard:c",
1187
+ "wait": 30
1188
+ },
1189
+ {
1190
+ "user": "keyboard:ArrowLeft",
1191
+ "wait": 30
1192
+ },
1193
+ {
1194
+ "user": "keyboard:d",
1195
+ "wait": 200
1196
+ },
1197
+ {
1198
+ "script": "(() => { clearInterval(redraws); return true; })()",
1199
+ "wait": 300
1200
+ },
1201
+ {
1202
+ "wait": 50,
1203
+ "check": "input === native('/text') && document.activeElement === input && input.value === 'Подробнееabdc' && input.selectionStart === 12 && heard.at(-1)[1].value === 'Подробнееabdc'"
1204
+ },
1205
+ {
1206
+ "script": "(() => { heard.length = 0; one.sections = base(); one.querySelector('[data-toggle=\"0\"]').focus(); return true; })()",
1207
+ "wait": 300
1208
+ },
1209
+ {
1210
+ "user": "keyboard:Enter",
1211
+ "wait": 200
1212
+ },
1213
+ {
1214
+ "user": "keyboard:Space",
1215
+ "wait": 200
1216
+ },
1217
+ {
1218
+ "wait": 50,
1219
+ "check": "JSON.stringify(heard) === JSON.stringify([['item-toggle', {path: '/items', index: 0, open: true}], ['item-toggle', {path: '/items', index: 0, open: true}]])"
1220
+ },
1221
+ {
1222
+ "script": "(() => { heard.length = 0; return true; })()",
1223
+ "wait": 50
1224
+ },
1225
+ {
1226
+ "user": "keyboard:Alt+ArrowDown",
1227
+ "wait": 200
1228
+ },
1229
+ {
1230
+ "wait": 50,
1231
+ "check": "JSON.stringify(heard) === JSON.stringify([['item-move', {path: '/items', from: 0, to: 1}]])"
1232
+ },
1233
+ {
1234
+ "script": "(() => { heard.length = 0; one.sections = base(); return true; })()",
1235
+ "wait": 400
1236
+ },
1237
+ {
1238
+ "wait": 50,
1239
+ "check": "document.activeElement === one.querySelector('[data-toggle=\"1\"]')"
1240
+ },
1241
+ {
1242
+ "user": "keyboard:Shift+F10",
1243
+ "wait": 700
1244
+ },
1245
+ {
1246
+ "wait": 50,
1247
+ "check": "document.querySelector('sf-menu-context.sf-mail-inspector-menu [role=\"menu\"], sf-menu-context.sf-mail-inspector-menu[open]') !== null && one.menuFor.index === 1"
1248
+ },
1249
+ {
1250
+ "user": "keyboard:Escape",
1251
+ "wait": 300
1252
+ },
1253
+ {
1254
+ "wait": 50,
1255
+ "check": "heard.length === 0"
1256
+ },
1257
+ {
1258
+ "user": "keyboard:Escape",
1259
+ "wait": 200
1260
+ },
1261
+ {
1262
+ "wait": 50,
1263
+ "check": "JSON.stringify(heard) === JSON.stringify([['level', {index: -1}]])"
1264
+ }
1265
+ ]
1266
+ },
1267
+ {
1268
+ "id": "p14-form-key-and-notice",
1269
+ "title": "a new form-key draws the form anew and drops what was typed; the notice's button says so",
1270
+ "covers": "settings.form-key, settings.notice, events.notice-action",
1271
+ "steps": [
1272
+ {
1273
+ "wait": 900,
1274
+ "script": "(() => {\n const one = document.querySelector('#panel');\n globalThis.one = one;\n globalThis.base = () => JSON.parse(JSON.stringify([{\"key\": \"button:content\", \"title\": \"Содержимое\", \"fields\": [{\"kind\": \"text\", \"path\": \"/text\", \"label\": \"Текст\", \"value\": \"Подробнее\", \"required\": true}, {\"kind\": \"link\", \"path\": \"/url\", \"label\": \"Ссылка\", \"value\": \"https://simai.ru\", \"placeholder\": \"https://\"}, {\"kind\": \"number\", \"path\": \"/discount\", \"label\": \"Скидка\", \"value\": \"10\"}, {\"kind\": \"multiline\", \"path\": \"/note\", \"label\": \"Примечание\", \"value\": \"\", \"hint\": \"Как в бренде: Спасибо, что вы с нами\"}]}, {\"key\": \"button:look\", \"title\": \"Оформление\", \"fields\": [{\"kind\": \"select\", \"path\": \"/tone\", \"label\": \"Тон\", \"value\": \"accent\", \"options\": [{\"value\": \"\", \"text\": \"— нет —\"}, {\"value\": \"accent\", \"text\": \"Акцент\"}, {\"value\": \"muted\", \"text\": \"Спокойный\"}]}, {\"kind\": \"switch\", \"path\": \"/wide\", \"label\": \"Во всю ширину\", \"value\": false}]}, {\"key\": \"button:image\", \"title\": \"Изображение\", \"fields\": [{\"kind\": \"image\", \"path\": \"/image\", \"label\": \"Изображение\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\", \"choices\": [{\"value\": \"a2\", \"text\": \"logo.png\"}], \"chooseLabel\": \"Выбрать из изображений письма\"}, {\"kind\": \"image\", \"path\": \"/logo\", \"label\": \"Логотип\", \"value\": {\"value\": \"a1\", \"label\": \"cover.png\", \"mime\": \"image/png\", \"size\": 2048, \"href\": \"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"}, \"required\": true, \"accept\": \".png,.jpg,.jpeg,image/png,image/jpeg\"}]}, {\"key\": \"button:price\", \"title\": \"Цена\", \"fields\": [{\"kind\": \"group\", \"path\": \"/price\", \"label\": \"Цена\", \"rows\": [[{\"kind\": \"number\", \"path\": \"/price/current\", \"label\": \"Цена\", \"value\": \"990\", \"inputmode\": \"decimal\"}, {\"kind\": \"number\", \"path\": \"/price/old\", \"label\": \"Прежняя цена\", \"value\": \"\", \"inputmode\": \"decimal\"}], [{\"kind\": \"text\", \"path\": \"/price/currency\", \"label\": \"Валюта\", \"value\": \"₽\"}, {\"kind\": \"text\", \"path\": \"/price/unit\", \"label\": \"Единица\", \"value\": \"\"}], [{\"kind\": \"text\", \"path\": \"/price/note\", \"label\": \"Пояснение к цене\", \"value\": \"\"}]]}]}, {\"key\": \"button:items\", \"title\": \"Элементы\", \"fields\": [{\"kind\": \"items\", \"path\": \"/items\", \"label\": \"Элементы\", \"min\": 1, \"max\": 4, \"open\": null, \"items\": [{\"label\": \"Базовый\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/0/title\", \"label\": \"Заголовок\", \"value\": \"Базовый\"}]}, {\"label\": \"Расширенный\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/1/title\", \"label\": \"Заголовок\", \"value\": \"Расширенный\"}]}, {\"label\": \"Команда\", \"fields\": [{\"kind\": \"text\", \"path\": \"/items/2/title\", \"label\": \"Заголовок\", \"value\": \"Команда\"}], \"problem\": true}]}]}]));\n globalThis.heard = [];\n for (const name of ['change','attach','detach','toggle','level','tab','notice-action','duplicate','delete','replace','item-toggle','item-add','item-move','item-duplicate','item-delete']) one.addEventListener(name === 'change' ? name : 'sf-mail-inspector-' + name, (event) => globalThis.heard.push([name, event.detail]));\n globalThis.fieldOf = (sections, path) => { for (const section of sections) { const walk = (fields) => { for (const field of fields) { if (field.path === path) return field; if (field.rows) for (const row of field.rows) { const got = walk(row); if (got) return got; } for (const item of field.items ?? []) { const got = walk(item.fields); if (got) return got; } } return null; }; const got = walk(section.fields); if (got) return got; } return null; };\n globalThis.withField = (path, change) => { const data = base(); Object.assign(fieldOf(data, path), change); return data; };\n globalThis.native = (path) => one.querySelector('[data-path=\"' + path + '\"] input, [data-path=\"' + path + '\"] textarea');\n globalThis.put = (path, text) => { const input = native(path); input.focus(); input.setSelectionRange(input.value.length, input.value.length); document.execCommand('insertText', false, text); return input; };\n globalThis.names = () => heard.map(([name]) => name).join(',');\n globalThis.detailOf = (name) => (heard.find(([one]) => one === name) ?? [])[1];\n one.headActions = ['duplicate', 'delete'];\n one.levels = [{text: 'Кнопка'}];\n one.sections = base();\n return true;\n})()"
1275
+ },
1276
+ {
1277
+ "script": "(() => { put('/url', 'x'); one.sections = withField('/url', {error: 'Нужен адрес https://'}); return true; })()",
1278
+ "wait": 400
1279
+ },
1280
+ {
1281
+ "script": "(() => { native('/url').blur(); one.setAttribute('form-key', 'b8'); one.sections = withField('/url', {error: 'Другая ошибка'}); one.notice = {text: 'Причина получения и ссылка отписки — в параметрах письма.', action: 'Открыть параметры письма'}; return true; })()",
1282
+ "wait": 500
1283
+ },
1284
+ {
1285
+ "wait": 50,
1286
+ "check": "native('/url').value === 'https://simai.ru' && !one.querySelector('sf-input[data-path=\"/url\"]').dataset.draft && one.querySelector('.sf-mail-inspector-notice-text').textContent.includes('Причина')"
1287
+ },
1288
+ {
1289
+ "script": "(() => { heard.length = 0; one.querySelector('[data-notice-action]').click(); return true; })()",
1290
+ "wait": 200
1291
+ },
1292
+ {
1293
+ "wait": 50,
1294
+ "check": "names() === 'notice-action'"
1295
+ }
1296
+ ]
1297
+ }
1298
+ ]
1299
+ }
1300
+ ]
1301
+ }