@elastic/isomer-sdk 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/LICENSE.txt +93 -0
  2. package/NOTICE.txt +1861 -0
  3. package/README.md +58 -0
  4. package/THIRD_PARTY_LICENSES.md +957 -0
  5. package/dist/author/authored_fields.d.ts +103 -0
  6. package/dist/author/authored_fields.d.ts.map +1 -0
  7. package/dist/author/authored_fields.js +183 -0
  8. package/dist/author/authored_fields.js.map +1 -0
  9. package/dist/author/index.d.ts +5 -0
  10. package/dist/author/index.d.ts.map +1 -0
  11. package/dist/author/index.js +10 -0
  12. package/dist/author/index.js.map +1 -0
  13. package/dist/author/jsx.d.ts +21 -0
  14. package/dist/author/jsx.d.ts.map +1 -0
  15. package/dist/author/jsx.js +20 -0
  16. package/dist/author/jsx.js.map +1 -0
  17. package/dist/author/jsx_shim.d.ts +116 -0
  18. package/dist/author/jsx_shim.d.ts.map +1 -0
  19. package/dist/author/jsx_shim.js +353 -0
  20. package/dist/author/jsx_shim.js.map +1 -0
  21. package/dist/author/prompt.d.ts +58 -0
  22. package/dist/author/prompt.d.ts.map +1 -0
  23. package/dist/author/prompt.js +148 -0
  24. package/dist/author/prompt.js.map +1 -0
  25. package/dist/cjs/author/authored_fields.js +189 -0
  26. package/dist/cjs/author/authored_fields.js.map +1 -0
  27. package/dist/cjs/author/index.js +20 -0
  28. package/dist/cjs/author/index.js.map +1 -0
  29. package/dist/cjs/author/jsx.js +24 -0
  30. package/dist/cjs/author/jsx.js.map +1 -0
  31. package/dist/cjs/author/jsx_shim.js +359 -0
  32. package/dist/cjs/author/jsx_shim.js.map +1 -0
  33. package/dist/cjs/author/prompt.js +153 -0
  34. package/dist/cjs/author/prompt.js.map +1 -0
  35. package/dist/cjs/composition/action_event.js +9 -0
  36. package/dist/cjs/composition/action_event.js.map +1 -0
  37. package/dist/cjs/composition/body_node_base.js +105 -0
  38. package/dist/cjs/composition/body_node_base.js.map +1 -0
  39. package/dist/cjs/composition/composition.js +9 -0
  40. package/dist/cjs/composition/composition.js.map +1 -0
  41. package/dist/cjs/composition/error.js +72 -0
  42. package/dist/cjs/composition/error.js.map +1 -0
  43. package/dist/cjs/composition/index.js +31 -0
  44. package/dist/cjs/composition/index.js.map +1 -0
  45. package/dist/cjs/composition/map_nodes.js +85 -0
  46. package/dist/cjs/composition/map_nodes.js.map +1 -0
  47. package/dist/cjs/composition/named_color.js +20 -0
  48. package/dist/cjs/composition/named_color.js.map +1 -0
  49. package/dist/cjs/composition/node.js +9 -0
  50. package/dist/cjs/composition/node.js.map +1 -0
  51. package/dist/cjs/composition/one_line.js +23 -0
  52. package/dist/cjs/composition/one_line.js.map +1 -0
  53. package/dist/cjs/composition/structured_value.js +21 -0
  54. package/dist/cjs/composition/structured_value.js.map +1 -0
  55. package/dist/cjs/composition/validation_error.js +40 -0
  56. package/dist/cjs/composition/validation_error.js.map +1 -0
  57. package/dist/cjs/define/frame.js +32 -0
  58. package/dist/cjs/define/frame.js.map +1 -0
  59. package/dist/cjs/define/index.js +25 -0
  60. package/dist/cjs/define/index.js.map +1 -0
  61. package/dist/cjs/define/markdown_content.js +12 -0
  62. package/dist/cjs/define/markdown_content.js.map +1 -0
  63. package/dist/cjs/define/primitive_module.js +107 -0
  64. package/dist/cjs/define/primitive_module.js.map +1 -0
  65. package/dist/cjs/define/slack_assets.js +9 -0
  66. package/dist/cjs/define/slack_assets.js.map +1 -0
  67. package/dist/cjs/define/slack_blocks.js +9 -0
  68. package/dist/cjs/define/slack_blocks.js.map +1 -0
  69. package/dist/cjs/define/zod_format.js +122 -0
  70. package/dist/cjs/define/zod_format.js.map +1 -0
  71. package/dist/cjs/define/zod_helpers.js +26 -0
  72. package/dist/cjs/define/zod_helpers.js.map +1 -0
  73. package/dist/cjs/entries/html.js +12 -0
  74. package/dist/cjs/entries/html.js.map +1 -0
  75. package/dist/cjs/entries/index.js +75 -0
  76. package/dist/cjs/entries/index.js.map +1 -0
  77. package/dist/cjs/entries/markdown.js +14 -0
  78. package/dist/cjs/entries/markdown.js.map +1 -0
  79. package/dist/cjs/entries/react.js +20 -0
  80. package/dist/cjs/entries/react.js.map +1 -0
  81. package/dist/cjs/entries/slack.js +26 -0
  82. package/dist/cjs/entries/slack.js.map +1 -0
  83. package/dist/cjs/entries/text.js +12 -0
  84. package/dist/cjs/entries/text.js.map +1 -0
  85. package/dist/cjs/pack/capabilities.js +34 -0
  86. package/dist/cjs/pack/capabilities.js.map +1 -0
  87. package/dist/cjs/pack/compose.js +56 -0
  88. package/dist/cjs/pack/compose.js.map +1 -0
  89. package/dist/cjs/pack/enhancements.js +65 -0
  90. package/dist/cjs/pack/enhancements.js.map +1 -0
  91. package/dist/cjs/pack/index.js +18 -0
  92. package/dist/cjs/pack/index.js.map +1 -0
  93. package/dist/cjs/pack/primitive_pack.js +85 -0
  94. package/dist/cjs/pack/primitive_pack.js.map +1 -0
  95. package/dist/cjs/package.json +3 -0
  96. package/dist/cjs/render/anchors.js +167 -0
  97. package/dist/cjs/render/anchors.js.map +1 -0
  98. package/dist/cjs/render/context_view.js +54 -0
  99. package/dist/cjs/render/context_view.js.map +1 -0
  100. package/dist/cjs/render/format_display_value.js +143 -0
  101. package/dist/cjs/render/format_display_value.js.map +1 -0
  102. package/dist/cjs/render/format_number.js +46 -0
  103. package/dist/cjs/render/format_number.js.map +1 -0
  104. package/dist/cjs/render/html/enhancements.js +30 -0
  105. package/dist/cjs/render/html/enhancements.js.map +1 -0
  106. package/dist/cjs/render/html/envelope.js +218 -0
  107. package/dist/cjs/render/html/envelope.js.map +1 -0
  108. package/dist/cjs/render/html/index.js +12 -0
  109. package/dist/cjs/render/html/index.js.map +1 -0
  110. package/dist/cjs/render/index.js +25 -0
  111. package/dist/cjs/render/index.js.map +1 -0
  112. package/dist/cjs/render/layout_check.js +133 -0
  113. package/dist/cjs/render/layout_check.js.map +1 -0
  114. package/dist/cjs/render/markdown/builder.js +189 -0
  115. package/dist/cjs/render/markdown/builder.js.map +1 -0
  116. package/dist/cjs/render/markdown/envelope.js +33 -0
  117. package/dist/cjs/render/markdown/envelope.js.map +1 -0
  118. package/dist/cjs/render/markdown/format.js +190 -0
  119. package/dist/cjs/render/markdown/format.js.map +1 -0
  120. package/dist/cjs/render/markdown/index.js +15 -0
  121. package/dist/cjs/render/markdown/index.js.map +1 -0
  122. package/dist/cjs/render/measure_dom.js +61 -0
  123. package/dist/cjs/render/measure_dom.js.map +1 -0
  124. package/dist/cjs/render/payload.js +13 -0
  125. package/dist/cjs/render/payload.js.map +1 -0
  126. package/dist/cjs/render/primitive_dispatch.js +187 -0
  127. package/dist/cjs/render/primitive_dispatch.js.map +1 -0
  128. package/dist/cjs/render/react/content.js +44 -0
  129. package/dist/cjs/render/react/content.js.map +1 -0
  130. package/dist/cjs/render/react/enhancements.js +32 -0
  131. package/dist/cjs/render/react/enhancements.js.map +1 -0
  132. package/dist/cjs/render/react/index.js +15 -0
  133. package/dist/cjs/render/react/index.js.map +1 -0
  134. package/dist/cjs/render/slack/assets.js +45 -0
  135. package/dist/cjs/render/slack/assets.js.map +1 -0
  136. package/dist/cjs/render/slack/blocks.js +80 -0
  137. package/dist/cjs/render/slack/blocks.js.map +1 -0
  138. package/dist/cjs/render/slack/envelope.js +551 -0
  139. package/dist/cjs/render/slack/envelope.js.map +1 -0
  140. package/dist/cjs/render/slack/format.js +825 -0
  141. package/dist/cjs/render/slack/format.js.map +1 -0
  142. package/dist/cjs/render/slack/index.js +31 -0
  143. package/dist/cjs/render/slack/index.js.map +1 -0
  144. package/dist/cjs/render/slack/markdown_content.js +358 -0
  145. package/dist/cjs/render/slack/markdown_content.js.map +1 -0
  146. package/dist/cjs/render/text/envelope.js +21 -0
  147. package/dist/cjs/render/text/envelope.js.map +1 -0
  148. package/dist/cjs/render/text/index.js +12 -0
  149. package/dist/cjs/render/text/index.js.map +1 -0
  150. package/dist/cjs/testing/conformance.js +296 -0
  151. package/dist/cjs/testing/conformance.js.map +1 -0
  152. package/dist/cjs/testing/index.js +16 -0
  153. package/dist/cjs/testing/index.js.map +1 -0
  154. package/dist/cjs/testing/registration.js +140 -0
  155. package/dist/cjs/testing/registration.js.map +1 -0
  156. package/dist/cjs/validate/authoring_schema.js +296 -0
  157. package/dist/cjs/validate/authoring_schema.js.map +1 -0
  158. package/dist/cjs/validate/composition_schema.js +135 -0
  159. package/dist/cjs/validate/composition_schema.js.map +1 -0
  160. package/dist/cjs/validate/index.js +52 -0
  161. package/dist/cjs/validate/index.js.map +1 -0
  162. package/dist/cjs/validate/input_budget.js +156 -0
  163. package/dist/cjs/validate/input_budget.js.map +1 -0
  164. package/dist/cjs/validate/json_schema.js +72 -0
  165. package/dist/cjs/validate/json_schema.js.map +1 -0
  166. package/dist/cjs/validate/node_issues.js +65 -0
  167. package/dist/cjs/validate/node_issues.js.map +1 -0
  168. package/dist/cjs/validate/url.js +116 -0
  169. package/dist/cjs/validate/url.js.map +1 -0
  170. package/dist/cjs/validate/validation.js +208 -0
  171. package/dist/cjs/validate/validation.js.map +1 -0
  172. package/dist/cjs/validate/value_schemas.js +53 -0
  173. package/dist/cjs/validate/value_schemas.js.map +1 -0
  174. package/dist/composition/action_event.d.ts +13 -0
  175. package/dist/composition/action_event.d.ts.map +1 -0
  176. package/dist/composition/action_event.js +8 -0
  177. package/dist/composition/action_event.js.map +1 -0
  178. package/dist/composition/body_node_base.d.ts +71 -0
  179. package/dist/composition/body_node_base.d.ts.map +1 -0
  180. package/dist/composition/body_node_base.js +97 -0
  181. package/dist/composition/body_node_base.js.map +1 -0
  182. package/dist/composition/composition.d.ts +71 -0
  183. package/dist/composition/composition.d.ts.map +1 -0
  184. package/dist/composition/composition.js +8 -0
  185. package/dist/composition/composition.js.map +1 -0
  186. package/dist/composition/error.d.ts +60 -0
  187. package/dist/composition/error.d.ts.map +1 -0
  188. package/dist/composition/error.js +68 -0
  189. package/dist/composition/error.js.map +1 -0
  190. package/dist/composition/index.d.ts +11 -0
  191. package/dist/composition/index.d.ts.map +1 -0
  192. package/dist/composition/index.js +14 -0
  193. package/dist/composition/index.js.map +1 -0
  194. package/dist/composition/map_nodes.d.ts +16 -0
  195. package/dist/composition/map_nodes.d.ts.map +1 -0
  196. package/dist/composition/map_nodes.js +81 -0
  197. package/dist/composition/map_nodes.js.map +1 -0
  198. package/dist/composition/named_color.d.ts +9 -0
  199. package/dist/composition/named_color.d.ts.map +1 -0
  200. package/dist/composition/named_color.js +17 -0
  201. package/dist/composition/named_color.js.map +1 -0
  202. package/dist/composition/node.d.ts +11 -0
  203. package/dist/composition/node.d.ts.map +1 -0
  204. package/dist/composition/node.js +8 -0
  205. package/dist/composition/node.js.map +1 -0
  206. package/dist/composition/one_line.d.ts +7 -0
  207. package/dist/composition/one_line.d.ts.map +1 -0
  208. package/dist/composition/one_line.js +17 -0
  209. package/dist/composition/one_line.js.map +1 -0
  210. package/dist/composition/structured_value.d.ts +27 -0
  211. package/dist/composition/structured_value.d.ts.map +1 -0
  212. package/dist/composition/structured_value.js +18 -0
  213. package/dist/composition/structured_value.js.map +1 -0
  214. package/dist/composition/validation_error.d.ts +33 -0
  215. package/dist/composition/validation_error.d.ts.map +1 -0
  216. package/dist/composition/validation_error.js +35 -0
  217. package/dist/composition/validation_error.js.map +1 -0
  218. package/dist/define/frame.d.ts +166 -0
  219. package/dist/define/frame.d.ts.map +1 -0
  220. package/dist/define/frame.js +28 -0
  221. package/dist/define/frame.js.map +1 -0
  222. package/dist/define/index.d.ts +8 -0
  223. package/dist/define/index.d.ts.map +1 -0
  224. package/dist/define/index.js +11 -0
  225. package/dist/define/index.js.map +1 -0
  226. package/dist/define/markdown_content.d.ts +15 -0
  227. package/dist/define/markdown_content.d.ts.map +1 -0
  228. package/dist/define/markdown_content.js +9 -0
  229. package/dist/define/markdown_content.js.map +1 -0
  230. package/dist/define/primitive_module.d.ts +421 -0
  231. package/dist/define/primitive_module.d.ts.map +1 -0
  232. package/dist/define/primitive_module.js +101 -0
  233. package/dist/define/primitive_module.js.map +1 -0
  234. package/dist/define/slack_assets.d.ts +28 -0
  235. package/dist/define/slack_assets.d.ts.map +1 -0
  236. package/dist/define/slack_assets.js +8 -0
  237. package/dist/define/slack_assets.js.map +1 -0
  238. package/dist/define/slack_blocks.d.ts +234 -0
  239. package/dist/define/slack_blocks.d.ts.map +1 -0
  240. package/dist/define/slack_blocks.js +8 -0
  241. package/dist/define/slack_blocks.js.map +1 -0
  242. package/dist/define/zod_format.d.ts +33 -0
  243. package/dist/define/zod_format.d.ts.map +1 -0
  244. package/dist/define/zod_format.js +114 -0
  245. package/dist/define/zod_format.js.map +1 -0
  246. package/dist/define/zod_helpers.d.ts +10 -0
  247. package/dist/define/zod_helpers.d.ts.map +1 -0
  248. package/dist/define/zod_helpers.js +22 -0
  249. package/dist/define/zod_helpers.js.map +1 -0
  250. package/dist/entries/html.d.ts +3 -0
  251. package/dist/entries/html.d.ts.map +1 -0
  252. package/dist/entries/html.js +8 -0
  253. package/dist/entries/html.js.map +1 -0
  254. package/dist/entries/index.d.ts +6 -0
  255. package/dist/entries/index.d.ts.map +1 -0
  256. package/dist/entries/index.js +12 -0
  257. package/dist/entries/index.js.map +1 -0
  258. package/dist/entries/markdown.d.ts +3 -0
  259. package/dist/entries/markdown.d.ts.map +1 -0
  260. package/dist/entries/markdown.js +8 -0
  261. package/dist/entries/markdown.js.map +1 -0
  262. package/dist/entries/react.d.ts +5 -0
  263. package/dist/entries/react.d.ts.map +1 -0
  264. package/dist/entries/react.js +11 -0
  265. package/dist/entries/react.js.map +1 -0
  266. package/dist/entries/slack.d.ts +2 -0
  267. package/dist/entries/slack.d.ts.map +1 -0
  268. package/dist/entries/slack.js +8 -0
  269. package/dist/entries/slack.js.map +1 -0
  270. package/dist/entries/text.d.ts +2 -0
  271. package/dist/entries/text.d.ts.map +1 -0
  272. package/dist/entries/text.js +8 -0
  273. package/dist/entries/text.js.map +1 -0
  274. package/dist/pack/capabilities.d.ts +27 -0
  275. package/dist/pack/capabilities.d.ts.map +1 -0
  276. package/dist/pack/capabilities.js +30 -0
  277. package/dist/pack/capabilities.js.map +1 -0
  278. package/dist/pack/compose.d.ts +21 -0
  279. package/dist/pack/compose.d.ts.map +1 -0
  280. package/dist/pack/compose.js +52 -0
  281. package/dist/pack/compose.js.map +1 -0
  282. package/dist/pack/enhancements.d.ts +65 -0
  283. package/dist/pack/enhancements.d.ts.map +1 -0
  284. package/dist/pack/enhancements.js +59 -0
  285. package/dist/pack/enhancements.js.map +1 -0
  286. package/dist/pack/index.d.ts +5 -0
  287. package/dist/pack/index.d.ts.map +1 -0
  288. package/dist/pack/index.js +11 -0
  289. package/dist/pack/index.js.map +1 -0
  290. package/dist/pack/primitive_pack.d.ts +155 -0
  291. package/dist/pack/primitive_pack.d.ts.map +1 -0
  292. package/dist/pack/primitive_pack.js +81 -0
  293. package/dist/pack/primitive_pack.js.map +1 -0
  294. package/dist/render/anchors.d.ts +82 -0
  295. package/dist/render/anchors.d.ts.map +1 -0
  296. package/dist/render/anchors.js +153 -0
  297. package/dist/render/anchors.js.map +1 -0
  298. package/dist/render/context_view.d.ts +10 -0
  299. package/dist/render/context_view.d.ts.map +1 -0
  300. package/dist/render/context_view.js +49 -0
  301. package/dist/render/context_view.js.map +1 -0
  302. package/dist/render/format_display_value.d.ts +20 -0
  303. package/dist/render/format_display_value.d.ts.map +1 -0
  304. package/dist/render/format_display_value.js +137 -0
  305. package/dist/render/format_display_value.js.map +1 -0
  306. package/dist/render/format_number.d.ts +9 -0
  307. package/dist/render/format_number.d.ts.map +1 -0
  308. package/dist/render/format_number.js +42 -0
  309. package/dist/render/format_number.js.map +1 -0
  310. package/dist/render/html/enhancements.d.ts +10 -0
  311. package/dist/render/html/enhancements.d.ts.map +1 -0
  312. package/dist/render/html/enhancements.js +25 -0
  313. package/dist/render/html/enhancements.js.map +1 -0
  314. package/dist/render/html/envelope.d.ts +182 -0
  315. package/dist/render/html/envelope.d.ts.map +1 -0
  316. package/dist/render/html/envelope.js +214 -0
  317. package/dist/render/html/envelope.js.map +1 -0
  318. package/dist/render/html/index.d.ts +3 -0
  319. package/dist/render/html/index.d.ts.map +1 -0
  320. package/dist/render/html/index.js +8 -0
  321. package/dist/render/html/index.js.map +1 -0
  322. package/dist/render/index.d.ts +6 -0
  323. package/dist/render/index.d.ts.map +1 -0
  324. package/dist/render/index.js +11 -0
  325. package/dist/render/index.js.map +1 -0
  326. package/dist/render/layout_check.d.ts +43 -0
  327. package/dist/render/layout_check.d.ts.map +1 -0
  328. package/dist/render/layout_check.js +129 -0
  329. package/dist/render/layout_check.js.map +1 -0
  330. package/dist/render/markdown/builder.d.ts +48 -0
  331. package/dist/render/markdown/builder.d.ts.map +1 -0
  332. package/dist/render/markdown/builder.js +183 -0
  333. package/dist/render/markdown/builder.js.map +1 -0
  334. package/dist/render/markdown/envelope.d.ts +20 -0
  335. package/dist/render/markdown/envelope.d.ts.map +1 -0
  336. package/dist/render/markdown/envelope.js +29 -0
  337. package/dist/render/markdown/envelope.js.map +1 -0
  338. package/dist/render/markdown/format.d.ts +3 -0
  339. package/dist/render/markdown/format.d.ts.map +1 -0
  340. package/dist/render/markdown/format.js +186 -0
  341. package/dist/render/markdown/format.js.map +1 -0
  342. package/dist/render/markdown/index.d.ts +3 -0
  343. package/dist/render/markdown/index.d.ts.map +1 -0
  344. package/dist/render/markdown/index.js +9 -0
  345. package/dist/render/markdown/index.js.map +1 -0
  346. package/dist/render/measure_dom.d.ts +10 -0
  347. package/dist/render/measure_dom.d.ts.map +1 -0
  348. package/dist/render/measure_dom.js +57 -0
  349. package/dist/render/measure_dom.js.map +1 -0
  350. package/dist/render/payload.d.ts +16 -0
  351. package/dist/render/payload.d.ts.map +1 -0
  352. package/dist/render/payload.js +9 -0
  353. package/dist/render/payload.js.map +1 -0
  354. package/dist/render/primitive_dispatch.d.ts +72 -0
  355. package/dist/render/primitive_dispatch.d.ts.map +1 -0
  356. package/dist/render/primitive_dispatch.js +183 -0
  357. package/dist/render/primitive_dispatch.js.map +1 -0
  358. package/dist/render/react/content.d.ts +40 -0
  359. package/dist/render/react/content.d.ts.map +1 -0
  360. package/dist/render/react/content.js +39 -0
  361. package/dist/render/react/content.js.map +1 -0
  362. package/dist/render/react/enhancements.d.ts +15 -0
  363. package/dist/render/react/enhancements.d.ts.map +1 -0
  364. package/dist/render/react/enhancements.js +28 -0
  365. package/dist/render/react/enhancements.js.map +1 -0
  366. package/dist/render/react/index.d.ts +3 -0
  367. package/dist/render/react/index.d.ts.map +1 -0
  368. package/dist/render/react/index.js +9 -0
  369. package/dist/render/react/index.js.map +1 -0
  370. package/dist/render/slack/assets.d.ts +16 -0
  371. package/dist/render/slack/assets.d.ts.map +1 -0
  372. package/dist/render/slack/assets.js +40 -0
  373. package/dist/render/slack/assets.js.map +1 -0
  374. package/dist/render/slack/blocks.d.ts +72 -0
  375. package/dist/render/slack/blocks.d.ts.map +1 -0
  376. package/dist/render/slack/blocks.js +77 -0
  377. package/dist/render/slack/blocks.js.map +1 -0
  378. package/dist/render/slack/envelope.d.ts +52 -0
  379. package/dist/render/slack/envelope.d.ts.map +1 -0
  380. package/dist/render/slack/envelope.js +547 -0
  381. package/dist/render/slack/envelope.js.map +1 -0
  382. package/dist/render/slack/format.d.ts +95 -0
  383. package/dist/render/slack/format.d.ts.map +1 -0
  384. package/dist/render/slack/format.js +807 -0
  385. package/dist/render/slack/format.js.map +1 -0
  386. package/dist/render/slack/index.d.ts +6 -0
  387. package/dist/render/slack/index.d.ts.map +1 -0
  388. package/dist/render/slack/index.js +12 -0
  389. package/dist/render/slack/index.js.map +1 -0
  390. package/dist/render/slack/markdown_content.d.ts +11 -0
  391. package/dist/render/slack/markdown_content.d.ts.map +1 -0
  392. package/dist/render/slack/markdown_content.js +354 -0
  393. package/dist/render/slack/markdown_content.js.map +1 -0
  394. package/dist/render/text/envelope.d.ts +15 -0
  395. package/dist/render/text/envelope.d.ts.map +1 -0
  396. package/dist/render/text/envelope.js +17 -0
  397. package/dist/render/text/envelope.js.map +1 -0
  398. package/dist/render/text/index.d.ts +2 -0
  399. package/dist/render/text/index.d.ts.map +1 -0
  400. package/dist/render/text/index.js +8 -0
  401. package/dist/render/text/index.js.map +1 -0
  402. package/dist/testing/conformance.d.ts +140 -0
  403. package/dist/testing/conformance.d.ts.map +1 -0
  404. package/dist/testing/conformance.js +287 -0
  405. package/dist/testing/conformance.js.map +1 -0
  406. package/dist/testing/index.d.ts +3 -0
  407. package/dist/testing/index.d.ts.map +1 -0
  408. package/dist/testing/index.js +9 -0
  409. package/dist/testing/index.js.map +1 -0
  410. package/dist/testing/registration.d.ts +32 -0
  411. package/dist/testing/registration.d.ts.map +1 -0
  412. package/dist/testing/registration.js +103 -0
  413. package/dist/testing/registration.js.map +1 -0
  414. package/dist/validate/authoring_schema.d.ts +27 -0
  415. package/dist/validate/authoring_schema.d.ts.map +1 -0
  416. package/dist/validate/authoring_schema.js +291 -0
  417. package/dist/validate/authoring_schema.js.map +1 -0
  418. package/dist/validate/composition_schema.d.ts +80 -0
  419. package/dist/validate/composition_schema.d.ts.map +1 -0
  420. package/dist/validate/composition_schema.js +127 -0
  421. package/dist/validate/composition_schema.js.map +1 -0
  422. package/dist/validate/index.d.ts +9 -0
  423. package/dist/validate/index.d.ts.map +1 -0
  424. package/dist/validate/index.js +15 -0
  425. package/dist/validate/index.js.map +1 -0
  426. package/dist/validate/input_budget.d.ts +35 -0
  427. package/dist/validate/input_budget.d.ts.map +1 -0
  428. package/dist/validate/input_budget.js +151 -0
  429. package/dist/validate/input_budget.js.map +1 -0
  430. package/dist/validate/json_schema.d.ts +32 -0
  431. package/dist/validate/json_schema.d.ts.map +1 -0
  432. package/dist/validate/json_schema.js +68 -0
  433. package/dist/validate/json_schema.js.map +1 -0
  434. package/dist/validate/node_issues.d.ts +12 -0
  435. package/dist/validate/node_issues.d.ts.map +1 -0
  436. package/dist/validate/node_issues.js +61 -0
  437. package/dist/validate/node_issues.js.map +1 -0
  438. package/dist/validate/url.d.ts +50 -0
  439. package/dist/validate/url.d.ts.map +1 -0
  440. package/dist/validate/url.js +107 -0
  441. package/dist/validate/url.js.map +1 -0
  442. package/dist/validate/validation.d.ts +105 -0
  443. package/dist/validate/validation.d.ts.map +1 -0
  444. package/dist/validate/validation.js +200 -0
  445. package/dist/validate/validation.js.map +1 -0
  446. package/dist/validate/value_schemas.d.ts +53 -0
  447. package/dist/validate/value_schemas.d.ts.map +1 -0
  448. package/dist/validate/value_schemas.js +50 -0
  449. package/dist/validate/value_schemas.js.map +1 -0
  450. package/package.json +118 -5
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ /** The composition as plain text: title uppercased, subtitle, then nodes. */
8
+ export const renderTextEnvelope = (composition, dispatcher, { heading = true } = {}) => {
9
+ const lines = [
10
+ ...(heading
11
+ ? [composition.title?.toUpperCase(), composition.subtitle]
12
+ : []),
13
+ ...composition.body.map((node) => dispatcher.renderText(node)),
14
+ ].filter(Boolean);
15
+ return lines.join('\n\n');
16
+ };
17
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../../src/render/text/envelope.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,WAA+B,EAC/B,UAAyC,EACzC,EAAE,OAAO,GAAG,IAAI,KAA0B,EAAE,EACpC,EAAE;IACV,MAAM,KAAK,GAAG;QACZ,GAAG,CAAC,OAAO;YACT,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,WAAW,CAAC,QAAQ,CAAC;YAC1D,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KAC/D,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAElB,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nimport type { Composition } from '../../composition/composition';\nimport type { PrimitiveNode } from '../../define/primitive_module';\n\n/** A pack's plain-text renderer for one node of its own type. */\nexport interface TextEnvelopeDispatcher<TNode extends PrimitiveNode> {\n /** Returns the empty string for a node with nothing to show; the envelope drops it rather than emitting a blank paragraph. */\n renderText(node: TNode): string;\n}\n\n/** Options for {@link renderTextEnvelope}. */\nexport interface TextEnvelopeOptions {\n /** Renders the composition's title and subtitle. Defaults to `true`. Pass `false` when the host already shows the title, or the body opens with its own. */\n heading?: boolean;\n}\n\n/** The composition as plain text: title uppercased, subtitle, then nodes. */\nexport const renderTextEnvelope = <TNode extends PrimitiveNode>(\n composition: Composition<TNode>,\n dispatcher: TextEnvelopeDispatcher<TNode>,\n { heading = true }: TextEnvelopeOptions = {}\n): string => {\n const lines = [\n ...(heading\n ? [composition.title?.toUpperCase(), composition.subtitle]\n : []),\n ...composition.body.map((node) => dispatcher.renderText(node)),\n ].filter(Boolean);\n\n return lines.join('\\n\\n');\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export { type TextEnvelopeDispatcher, type TextEnvelopeOptions, renderTextEnvelope, } from './envelope.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/render/text/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ export { renderTextEnvelope, } from './envelope.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/render/text/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,kBAAkB,GACnB,MAAM,YAAY,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport {\n type TextEnvelopeDispatcher,\n type TextEnvelopeOptions,\n renderTextEnvelope,\n} from './envelope';\n"]}
@@ -0,0 +1,140 @@
1
+ import type { ChildNodeWalker } from '../composition/body_node_base.js';
2
+ import type { Composition } from '../composition/composition.js';
3
+ import type { ValidationError } from '../composition/validation_error.js';
4
+ import type { AnyPrimitiveDefinition, PrimitiveNode } from '../define/primitive_module.js';
5
+ import type { HTMLRenderResult } from '../render/html/envelope.js';
6
+ import type { SlackBlock } from '../render/slack/blocks.js';
7
+ import type { ValidationResult } from '../validate/validation.js';
8
+ /**
9
+ * The foreign node {@link PrimitiveConformanceHarness.nestForeignChild}
10
+ * hands a container must render text/markdown containing this string, or the
11
+ * cross-pack nesting case cannot tell a dropped child from an empty one.
12
+ */
13
+ export declare const CONFORMANCE_FOREIGN_MARKER = "__isomer_conformance_foreign__";
14
+ /** One example node, paired with the definition that published it. */
15
+ export interface PrimitiveConformanceExample {
16
+ readonly definition: AnyPrimitiveDefinition;
17
+ /** Always `definition.type`, lifted onto the row so `it.each` titles can read it. */
18
+ readonly type: string;
19
+ /** Index into {@link AnyPrimitiveDefinition.examples}, and half of the preview hint a failure prints. */
20
+ readonly exampleIndex: number;
21
+ readonly node: PrimitiveNode;
22
+ }
23
+ /** The subset of a host's HTML render options the cases exercise. */
24
+ export interface PrimitiveConformanceHtmlOptions {
25
+ /** `'separate'` must move the stylesheet out of the markup and into `css`; the CSS cases assert against that field. */
26
+ readonly css?: 'inline' | 'separate';
27
+ /** `'readable'` must emit human-legible class names, which the CSS coverage case matches back against the emitted selectors. */
28
+ readonly names?: string;
29
+ /** Must render node anchors, as the `anchors` HTML render option does. */
30
+ readonly anchors?: boolean;
31
+ }
32
+ /** The subset of a host's SVG render result the cases assert on. */
33
+ export interface PrimitiveConformanceSvgResult {
34
+ /** Must be empty for every published example. */
35
+ readonly validationErrors: readonly ValidationError[];
36
+ readonly svg: string;
37
+ /** `total` is the rendered byte size, and must be positive. */
38
+ readonly measurement: {
39
+ readonly total: number;
40
+ };
41
+ }
42
+ /** The subset of a host's Slack render result the cases assert on. */
43
+ export interface PrimitiveConformanceSlackResult {
44
+ readonly blocks: readonly SlackBlock[];
45
+ /** Notification fallback text. Must be non-empty. */
46
+ readonly text: string;
47
+ }
48
+ /**
49
+ * Pack-owned render and validation bindings. The cases cannot import a
50
+ * vocabulary package, so the pack closes over its dispatcher, frame, and
51
+ * theme when it builds this object.
52
+ *
53
+ * Unsuffixed members take a single node; the `Composition`-suffixed ones take
54
+ * a whole {@link Composition}. Optional members gate the cases that need
55
+ * them, so a pack supplies only what its surfaces can answer.
56
+ */
57
+ export interface PrimitiveConformanceHarness {
58
+ /**
59
+ * The smallest composition that carries one node. Its `title` must be
60
+ * `'Conformance fixture'`, which the envelope cases look for as
61
+ * `CONFORMANCE FIXTURE` in text and `# Conformance fixture` in markdown.
62
+ */
63
+ wrapComposition(node: PrimitiveNode): Composition;
64
+ /** Validation errors for the node on its own. Must be empty for every published example. */
65
+ validateNode(node: PrimitiveNode): readonly ValidationError[];
66
+ /** Whole-composition validation. Must be `valid` with no `errors` for a wrapped example. */
67
+ validateComposition(composition: Composition): ValidationResult;
68
+ /** Must return something other than `undefined`; the case does not mount the element. */
69
+ renderReact(node: PrimitiveNode): unknown;
70
+ /** Drives the pack's style collection for one node. Must not throw. */
71
+ collectStyles(node: PrimitiveNode): void;
72
+ /** Must return a string with non-whitespace content. */
73
+ renderText(node: PrimitiveNode): string;
74
+ /** Must return a string with non-whitespace content. */
75
+ renderMarkdown(node: PrimitiveNode): string;
76
+ /** Must return at least one block, each an object with a string `type`. */
77
+ renderSlack(node: PrimitiveNode): readonly SlackBlock[];
78
+ /** `key` is unique per example and only has to survive into the React tree. Must not throw. Omit for a pack with no `svg` path. */
79
+ renderSvg?(node: PrimitiveNode, key: string): unknown;
80
+ /** Must be finite and greater than zero, so a frame can lay the node out unrendered. Omit for a pack with no `svg` path. */
81
+ estimateSvgHeight?(node: PrimitiveNode): number;
82
+ /**
83
+ * Set `false` for packs whose frame is fixed-size (`sizesFromNodeHeights: false`).
84
+ * Skips the positive-finite height assertion, which no fixed-frame pack can satisfy.
85
+ */
86
+ sizesFromNodeHeights?: boolean;
87
+ /**
88
+ * For a container example, returns `container` with one of its children
89
+ * replaced by a node from a pack the harness composed in only for this
90
+ * check — never one `container`'s own pack registers. That node's `text`
91
+ * and `markdown` renderers must emit {@link CONFORMANCE_FOREIGN_MARKER}.
92
+ * Omit to skip the cross-pack nesting case.
93
+ */
94
+ nestForeignChild?(container: PrimitiveNode): PrimitiveNode;
95
+ /**
96
+ * Must honor {@link PrimitiveConformanceHtmlOptions}. Cases assert the
97
+ * markup wraps the body in a `<section>`, that `measurement.js` is zero, and
98
+ * that `validationErrors` is empty. Omit to skip the HTML cases.
99
+ */
100
+ renderHTML?(composition: Composition, options?: PrimitiveConformanceHtmlOptions): HTMLRenderResult;
101
+ /**
102
+ * The child walker over every definition the harness renders with. Set it
103
+ * once every `react` renderer spreads `nodeAnchor` on its root; the anchor
104
+ * case then asserts each node renders one.
105
+ */
106
+ anchorWalk?: ChildNodeWalker;
107
+ /** Must throw when `css` references a `var(--name)` it never declares. Omit to skip the CSS variable case. */
108
+ assertVarRefsHaveDeclarations?(css: string): void;
109
+ /** Whole-composition text render, title envelope included. */
110
+ renderTextComposition(composition: Composition): string;
111
+ /** Whole-composition markdown render, title heading included. */
112
+ renderMarkdownComposition(composition: Composition): string;
113
+ /** Must lead with a `plain_text` header block carrying the composition title. */
114
+ renderSlackComposition(composition: Composition): PrimitiveConformanceSlackResult;
115
+ /** Must resolve to complete `<svg>`/`</svg>` markup with no validation errors. Omit for a pack with no frame. */
116
+ renderSVGComposition?(composition: Composition): Promise<PrimitiveConformanceSvgResult>;
117
+ }
118
+ /** One assertion, run once per example. */
119
+ export interface PrimitiveConformanceCase {
120
+ readonly name: string;
121
+ /** Signals failure by throwing. May be async, so a pack must await it. */
122
+ readonly run: (example: PrimitiveConformanceExample, harness: PrimitiveConformanceHarness) => void | Promise<void>;
123
+ }
124
+ /** Every definition's examples, flattened to one row each. */
125
+ export declare const examplesFromDefinitions: (definitions: readonly AnyPrimitiveDefinition[]) => readonly PrimitiveConformanceExample[];
126
+ /** Every example crossed with every case, shaped for `it.each`. */
127
+ export declare const primitiveConformanceRows: (definitions: readonly AnyPrimitiveDefinition[]) => readonly (PrimitiveConformanceExample & PrimitiveConformanceCase)[];
128
+ /**
129
+ * Asserts the inventory itself holds up: the pack has examples, every
130
+ * definition contributes one, each example's `type` matches its definition,
131
+ * and `catalog.example` is within the input budget and parses or matches a
132
+ * published example.
133
+ */
134
+ export declare const runPrimitiveInventoryConformance: (definitions: readonly AnyPrimitiveDefinition[]) => void;
135
+ /**
136
+ * Every assertion a primitive owes its callers, for a pack to drive with
137
+ * `it.each`.
138
+ */
139
+ export declare const primitiveConformanceCases: readonly PrimitiveConformanceCase[];
140
+ //# sourceMappingURL=conformance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../src/testing/conformance.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,E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CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAClD,8DAA8D;IAC9D,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC;IACxD,iEAAiE;IACjE,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC;IAC5D,iFAAiF;IACjF,sBAAsB,CACpB,WAAW,EAAE,WAAW,GACvB,+BAA+B,CAAC;IACnC,iHAAiH;IACjH,oBAAoB,CAAC,CACnB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,6BAA6B,CAAC,CAAC;CAC3C;AAED,2CAA2C;AAC3C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,QAAQ,CAAC,GAAG,EAAE,CACZ,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,2BAA2B,KACjC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,GAClC,aAAa,SAAS,sBAAsB,EAAE,KAC7C,SAAS,2BAA2B,EAQpC,CAAC;AAEJ,mEAAmE;AACnE,eAAO,MAAM,wBAAwB,GACnC,aAAa,SAAS,sBAAsB,EAAE,KAC7C,SAAS,CAAC,2BAA2B,GAAG,wBAAwB,CAAC,EAMjE,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,GAC3C,aAAa,SAAS,sBAAsB,EAAE,KAC7C,IAkCF,CAAC;AAgCF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,wBAAwB,EA2NxE,CAAC"}
@@ -0,0 +1,287 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ // The behaviour every primitive definition owes its callers, expressed once.
8
+ //
9
+ // Framework-agnostic on purpose: only `node:assert/strict` and Node builtins,
10
+ // so this ships on a public entry without dragging vitest into a vocabulary
11
+ // package's dependency set. Each pack drives the array with `it.each`, so a
12
+ // second vocabulary costs one package and one test file.
13
+ import assert from 'node:assert/strict';
14
+ import { anchoredNodes, anchorValue, NODE_ANCHOR_ATTRIBUTE, nodeType, } from '../render/anchors.js';
15
+ import { checkInputBudget } from '../validate/input_budget.js';
16
+ /**
17
+ * The foreign node {@link PrimitiveConformanceHarness.nestForeignChild}
18
+ * hands a container must render text/markdown containing this string, or the
19
+ * cross-pack nesting case cannot tell a dropped child from an empty one.
20
+ */
21
+ export const CONFORMANCE_FOREIGN_MARKER = '__isomer_conformance_foreign__';
22
+ /** Every definition's examples, flattened to one row each. */
23
+ export const examplesFromDefinitions = (definitions) => definitions.flatMap((definition) => definition.examples.map((node, exampleIndex) => ({
24
+ definition,
25
+ type: definition.type,
26
+ exampleIndex,
27
+ node,
28
+ })));
29
+ /** Every example crossed with every case, shaped for `it.each`. */
30
+ export const primitiveConformanceRows = (definitions) => examplesFromDefinitions(definitions).flatMap((example) => primitiveConformanceCases.map((conformanceCase) => ({
31
+ ...example,
32
+ ...conformanceCase,
33
+ })));
34
+ /**
35
+ * Asserts the inventory itself holds up: the pack has examples, every
36
+ * definition contributes one, each example's `type` matches its definition,
37
+ * and `catalog.example` is within the input budget and parses or matches a
38
+ * published example.
39
+ */
40
+ export const runPrimitiveInventoryConformance = (definitions) => {
41
+ const examples = examplesFromDefinitions(definitions);
42
+ assert.ok(examples.length > 0, 'expected at least one primitive example');
43
+ for (const definition of definitions) {
44
+ assert.ok(definition.examples.length > 0, `${definition.type} primitive must expose at least one example`);
45
+ const checked = checkInputBudget(definition.catalog.example);
46
+ if (!checked.valid) {
47
+ assert.fail(`${definition.type} catalog.example must be within the input budget: ${checked.error.message}`);
48
+ }
49
+ const catalogExample = checked.value;
50
+ const matchesPublished = definition.examples.some((node) => {
51
+ const published = checkInputBudget(node);
52
+ return (published.valid &&
53
+ JSON.stringify(published.value) === JSON.stringify(catalogExample));
54
+ });
55
+ if (matchesPublished) {
56
+ continue;
57
+ }
58
+ const parsed = definition.schema.safeParse(catalogExample);
59
+ assert.ok(parsed.success, `${definition.type} catalog.example must parse against its schema or match a published example`);
60
+ }
61
+ for (const { type, node } of examples) {
62
+ assert.equal(node.type, type);
63
+ }
64
+ };
65
+ const previewHint = (type, exampleIndex) => `Failing example: \`${type}\` definition, examples[${exampleIndex}].`;
66
+ const renderedClassNames = (html) => {
67
+ const classNames = new Set();
68
+ for (const match of html.matchAll(/\bclass="([^"]+)"/g)) {
69
+ match[1]
70
+ .split(/\s+/)
71
+ .filter(Boolean)
72
+ .forEach((className) => classNames.add(className));
73
+ }
74
+ return [...classNames].sort();
75
+ };
76
+ /** The node anchor values in serialized `html`, in document order. */
77
+ const renderedAnchors = (html) => {
78
+ const attribute = new RegExp(`\\s${NODE_ANCHOR_ATTRIBUTE}="([^"]*)"`);
79
+ // Only opening tags: the serializer escapes `<`, `>`, and `"` in text and attribute values.
80
+ return [...html.matchAll(/<[a-zA-Z][^>]*>/g)].flatMap(([tag]) => {
81
+ const [, value] = attribute.exec(tag) ?? [];
82
+ return value === undefined ? [] : [value];
83
+ });
84
+ };
85
+ const cssEscapeClass = (className) => className.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '\\$1');
86
+ const cssHasClassSelector = (css, className) => new RegExp(`\\.${cssEscapeClass(className)}(?![\\w-])`).test(css);
87
+ /**
88
+ * Every assertion a primitive owes its callers, for a pack to drive with
89
+ * `it.each`.
90
+ */
91
+ export const primitiveConformanceCases = [
92
+ {
93
+ name: 'validates as a primitive node and inside a composition',
94
+ run: ({ type, exampleIndex, node }, harness) => {
95
+ const hint = previewHint(type, exampleIndex);
96
+ const primitiveErrors = [...harness.validateNode(node)];
97
+ assert.deepEqual(primitiveErrors, [], hint);
98
+ const result = harness.validateComposition(harness.wrapComposition(node));
99
+ assert.equal(result.valid, true, hint);
100
+ assert.deepEqual(result.errors, [], hint);
101
+ },
102
+ },
103
+ {
104
+ name: 'renders through React without throwing',
105
+ run: ({ node }, harness) => {
106
+ const rendered = harness.renderReact(node);
107
+ assert.notEqual(rendered, undefined);
108
+ },
109
+ },
110
+ {
111
+ name: 'collects styles without throwing',
112
+ run: ({ node }, harness) => {
113
+ assert.doesNotThrow(() => harness.collectStyles(node));
114
+ },
115
+ },
116
+ {
117
+ name: 'a container recurses through scope for a node from another pack',
118
+ run: ({ definition, node }, harness) => {
119
+ if (!definition.children || !harness.nestForeignChild) {
120
+ return;
121
+ }
122
+ const nested = harness.nestForeignChild(node);
123
+ assert.notEqual(harness.renderReact(nested), undefined);
124
+ assert.ok(harness.renderText(nested).includes(CONFORMANCE_FOREIGN_MARKER));
125
+ assert.ok(harness.renderMarkdown(nested).includes(CONFORMANCE_FOREIGN_MARKER));
126
+ },
127
+ },
128
+ {
129
+ name: 'renders through plain text with non-empty output',
130
+ run: ({ node }, harness) => {
131
+ const text = harness.renderText(node);
132
+ assert.equal(typeof text, 'string');
133
+ assert.ok(text.trim().length > 0);
134
+ },
135
+ },
136
+ {
137
+ name: 'renders through markdown with non-empty output',
138
+ run: ({ node }, harness) => {
139
+ const markdown = harness.renderMarkdown(node);
140
+ assert.equal(typeof markdown, 'string');
141
+ assert.ok(markdown.trim().length > 0);
142
+ },
143
+ },
144
+ {
145
+ name: 'renders through Slack dispatch returning at least one block',
146
+ run: ({ node }, harness) => {
147
+ const blocks = harness.renderSlack(node);
148
+ assert.ok(blocks.length > 0);
149
+ for (const block of blocks) {
150
+ assert.equal(typeof block, 'object');
151
+ assert.equal(typeof block.type, 'string');
152
+ }
153
+ },
154
+ },
155
+ {
156
+ name: 'renders through SVG primitive dispatch without throwing',
157
+ run: ({ type, exampleIndex, node }, harness) => {
158
+ if (!harness.renderSvg) {
159
+ return;
160
+ }
161
+ assert.doesNotThrow(() => harness.renderSvg?.(node, `conformance-${type}-${exampleIndex}`));
162
+ },
163
+ },
164
+ {
165
+ name: 'reports a positive finite SVG height estimate',
166
+ run: ({ node }, harness) => {
167
+ if (harness.sizesFromNodeHeights === false ||
168
+ !harness.estimateSvgHeight) {
169
+ return;
170
+ }
171
+ const height = harness.estimateSvgHeight(node);
172
+ assert.equal(Number.isFinite(height), true);
173
+ assert.ok(height > 0);
174
+ },
175
+ },
176
+ {
177
+ name: 'renders through renderHTML wrapped in a minimal composition',
178
+ run: ({ node }, harness) => {
179
+ if (!harness.renderHTML) {
180
+ return;
181
+ }
182
+ const result = harness.renderHTML(harness.wrapComposition(node));
183
+ assert.deepEqual(result.validationErrors, []);
184
+ assert.ok(result.html.includes('<section'));
185
+ assert.equal(result.measurement.js, 0);
186
+ assert.ok(result.measurement.total > 0);
187
+ },
188
+ },
189
+ {
190
+ name: 'renders no node anchors unless asked',
191
+ run: ({ node }, harness) => {
192
+ if (!harness.renderHTML) {
193
+ return;
194
+ }
195
+ const { body } = harness.renderHTML(harness.wrapComposition(node));
196
+ assert.deepEqual(renderedAnchors(body), []);
197
+ },
198
+ },
199
+ {
200
+ name: 'renders a node anchor on every node when asked',
201
+ run: ({ type, exampleIndex, node }, harness) => {
202
+ if (!harness.renderHTML || !harness.anchorWalk) {
203
+ return;
204
+ }
205
+ const composition = harness.wrapComposition(node);
206
+ const { body } = harness.renderHTML(composition, { anchors: true });
207
+ const expected = anchoredNodes(composition.body, harness.anchorWalk).flatMap((anchored) => {
208
+ const anchoredType = nodeType(anchored);
209
+ return anchoredType === undefined ? [] : [anchorValue(anchoredType)];
210
+ });
211
+ assert.deepEqual(renderedAnchors(body), expected, `Expected one anchor per node, in walker order. ${previewHint(type, exampleIndex)}`);
212
+ },
213
+ },
214
+ {
215
+ name: 'emits CSS where every var(...) reference has a matching declaration',
216
+ run: ({ node }, harness) => {
217
+ if (!harness.renderHTML || !harness.assertVarRefsHaveDeclarations) {
218
+ return;
219
+ }
220
+ const result = harness.renderHTML(harness.wrapComposition(node), {
221
+ css: 'separate',
222
+ });
223
+ harness.assertVarRefsHaveDeclarations(result.css);
224
+ },
225
+ },
226
+ {
227
+ name: 'reaches every rendered readable class in compact CSS collection',
228
+ run: ({ type, exampleIndex, node }, harness) => {
229
+ if (!harness.renderHTML) {
230
+ return;
231
+ }
232
+ const result = harness.renderHTML(harness.wrapComposition(node), {
233
+ css: 'separate',
234
+ names: 'readable',
235
+ });
236
+ const missing = renderedClassNames(result.body).filter((className) => !cssHasClassSelector(result.css, className));
237
+ const hint = `Missing CSS for ${type} example #${exampleIndex}: ` +
238
+ `${missing.join(', ') || '(none)'}. ` +
239
+ previewHint(type, exampleIndex);
240
+ assert.deepEqual(missing, [], hint);
241
+ },
242
+ },
243
+ {
244
+ name: 'renders through renderText wrapped in a minimal composition',
245
+ run: ({ node }, harness) => {
246
+ const text = harness.renderTextComposition(harness.wrapComposition(node));
247
+ assert.ok(text.length > 0);
248
+ assert.ok(text.includes('CONFORMANCE FIXTURE'));
249
+ },
250
+ },
251
+ {
252
+ name: 'renders through renderMarkdown wrapped in a minimal composition',
253
+ run: ({ node }, harness) => {
254
+ const markdown = harness.renderMarkdownComposition(harness.wrapComposition(node));
255
+ assert.ok(markdown.length > 0);
256
+ assert.ok(markdown.includes('# Conformance fixture'));
257
+ },
258
+ },
259
+ {
260
+ name: 'renders through renderSlack wrapped in a minimal composition',
261
+ run: ({ node }, harness) => {
262
+ const result = harness.renderSlackComposition(harness.wrapComposition(node));
263
+ assert.ok(result.blocks.length > 0);
264
+ assert.ok(result.text.length > 0);
265
+ const first = result.blocks[0];
266
+ assert.ok(first);
267
+ if (first.type !== 'header') {
268
+ assert.fail(`expected a header block, got ${first.type}`);
269
+ }
270
+ assert.equal(first.text.type, 'plain_text');
271
+ },
272
+ },
273
+ {
274
+ name: 'renders through renderSVG wrapped in a minimal composition',
275
+ run: async ({ node }, harness) => {
276
+ if (!harness.renderSVGComposition) {
277
+ return;
278
+ }
279
+ const result = await harness.renderSVGComposition(harness.wrapComposition(node));
280
+ assert.deepEqual(result.validationErrors, []);
281
+ assert.ok(result.svg.includes('<svg'));
282
+ assert.ok(result.svg.includes('</svg>'));
283
+ assert.ok(result.measurement.total > 0);
284
+ },
285
+ },
286
+ ];
287
+ //# sourceMappingURL=conformance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.js","sourceRoot":"","sources":["../../src/testing/conformance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,yDAAyD;AAEzD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AASxC,OAAO,EACL,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,gCAAgC,CAAC;AA8H3E,8DAA8D;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,WAA8C,EACN,EAAE,CAC1C,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CACjC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC;IAC/C,UAAU;IACV,IAAI,EAAE,UAAU,CAAC,IAAI;IACrB,YAAY;IACZ,IAAI;CACL,CAAC,CAAC,CACJ,CAAC;AAEJ,mEAAmE;AACnE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,WAA8C,EACuB,EAAE,CACvE,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACvD,yBAAyB,CAAC,GAAG,CAAC,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAClD,GAAG,OAAO;IACV,GAAG,eAAe;CACnB,CAAC,CAAC,CACJ,CAAC;AAEJ;;;;;GAKG;AACH,MAAM,CAAC,M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IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;gBAClC,OAAO;YACT,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,oBAAoB,CAC/C,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAC9B,CAAC;YACF,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YAC9C,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACvC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;YACzC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC;KACF;CACF,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\n// The behaviour every primitive definition owes its callers, expressed once.\n//\n// Framework-agnostic on purpose: only `node:assert/strict` and Node builtins,\n// so this ships on a public entry without dragging vitest into a vocabulary\n// package's dependency set. Each pack drives the array with `it.each`, so a\n// second vocabulary costs one package and one test file.\n\nimport assert from 'node:assert/strict';\n\nimport type { ChildNodeWalker } from '../composition/body_node_base';\nimport type { Composition } from '../composition/composition';\nimport type { ValidationError } from '../composition/validation_error';\nimport type {\n AnyPrimitiveDefinition,\n PrimitiveNode,\n} from '../define/primitive_module';\nimport {\n anchoredNodes,\n anchorValue,\n NODE_ANCHOR_ATTRIBUTE,\n nodeType,\n} from '../render/anchors';\nimport type { HTMLRenderResult } from '../render/html/envelope';\nimport type { SlackBlock } from '../render/slack/blocks';\nimport { checkInputBudget } from '../validate/input_budget';\nimport type { ValidationResult } from '../validate/validation';\n\n/**\n * The foreign node {@link PrimitiveConformanceHarness.nestForeignChild}\n * hands a container must render text/markdown containing this string, or the\n * cross-pack nesting case cannot tell a dropped child from an empty one.\n */\nexport const CONFORMANCE_FOREIGN_MARKER = '__isomer_conformance_foreign__';\n\n/** One example node, paired with the definition that published it. */\nexport interface PrimitiveConformanceExample {\n readonly definition: AnyPrimitiveDefinition;\n /** Always `definition.type`, lifted onto the row so `it.each` titles can read it. */\n readonly type: string;\n /** Index into {@link AnyPrimitiveDefinition.examples}, and half of the preview hint a failure prints. */\n readonly exampleIndex: number;\n readonly node: PrimitiveNode;\n}\n\n/** The subset of a host's HTML render options the cases exercise. */\nexport interface PrimitiveConformanceHtmlOptions {\n /** `'separate'` must move the stylesheet out of the markup and into `css`; the CSS cases assert against that field. */\n readonly css?: 'inline' | 'separate';\n /** `'readable'` must emit human-legible class names, which the CSS coverage case matches back against the emitted selectors. */\n readonly names?: string;\n /** Must render node anchors, as the `anchors` HTML render option does. */\n readonly anchors?: boolean;\n}\n\n/** The subset of a host's SVG render result the cases assert on. */\nexport interface PrimitiveConformanceSvgResult {\n /** Must be empty for every published example. */\n readonly validationErrors: readonly ValidationError[];\n readonly svg: string;\n /** `total` is the rendered byte size, and must be positive. */\n readonly measurement: { readonly total: number };\n}\n\n/** The subset of a host's Slack render result the cases assert on. */\nexport interface PrimitiveConformanceSlackResult {\n readonly blocks: readonly SlackBlock[];\n /** Notification fallback text. Must be non-empty. */\n readonly text: string;\n}\n\n/**\n * Pack-owned render and validation bindings. The cases cannot import a\n * vocabulary package, so the pack closes over its dispatcher, frame, and\n * theme when it builds this object.\n *\n * Unsuffixed members take a single node; the `Composition`-suffixed ones take\n * a whole {@link Composition}. Optional members gate the cases that need\n * them, so a pack supplies only what its surfaces can answer.\n */\nexport interface PrimitiveConformanceHarness {\n /**\n * The smallest composition that carries one node. Its `title` must be\n * `'Conformance fixture'`, which the envelope cases look for as\n * `CONFORMANCE FIXTURE` in text and `# Conformance fixture` in markdown.\n */\n wrapComposition(node: PrimitiveNode): Composition;\n /** Validation errors for the node on its own. Must be empty for every published example. */\n validateNode(node: PrimitiveNode): readonly ValidationError[];\n /** Whole-composition validation. Must be `valid` with no `errors` for a wrapped example. */\n validateComposition(composition: Composition): ValidationResult;\n /** Must return something other than `undefined`; the case does not mount the element. */\n renderReact(node: PrimitiveNode): unknown;\n /** Drives the pack's style collection for one node. Must not throw. */\n collectStyles(node: PrimitiveNode): void;\n /** Must return a string with non-whitespace content. */\n renderText(node: PrimitiveNode): string;\n /** Must return a string with non-whitespace content. */\n renderMarkdown(node: PrimitiveNode): string;\n /** Must return at least one block, each an object with a string `type`. */\n renderSlack(node: PrimitiveNode): readonly SlackBlock[];\n /** `key` is unique per example and only has to survive into the React tree. Must not throw. Omit for a pack with no `svg` path. */\n renderSvg?(node: PrimitiveNode, key: string): unknown;\n /** Must be finite and greater than zero, so a frame can lay the node out unrendered. Omit for a pack with no `svg` path. */\n estimateSvgHeight?(node: PrimitiveNode): number;\n /**\n * Set `false` for packs whose frame is fixed-size (`sizesFromNodeHeights: false`).\n * Skips the positive-finite height assertion, which no fixed-frame pack can satisfy.\n */\n sizesFromNodeHeights?: boolean;\n /**\n * For a container example, returns `container` with one of its children\n * replaced by a node from a pack the harness composed in only for this\n * check — never one `container`'s own pack registers. That node's `text`\n * and `markdown` renderers must emit {@link CONFORMANCE_FOREIGN_MARKER}.\n * Omit to skip the cross-pack nesting case.\n */\n nestForeignChild?(container: PrimitiveNode): PrimitiveNode;\n /**\n * Must honor {@link PrimitiveConformanceHtmlOptions}. Cases assert the\n * markup wraps the body in a `<section>`, that `measurement.js` is zero, and\n * that `validationErrors` is empty. Omit to skip the HTML cases.\n */\n renderHTML?(\n composition: Composition,\n options?: PrimitiveConformanceHtmlOptions\n ): HTMLRenderResult;\n /**\n * The child walker over every definition the harness renders with. Set it\n * once every `react` renderer spreads `nodeAnchor` on its root; the anchor\n * case then asserts each node renders one.\n */\n anchorWalk?: ChildNodeWalker;\n /** Must throw when `css` references a `var(--name)` it never declares. Omit to skip the CSS variable case. */\n assertVarRefsHaveDeclarations?(css: string): void;\n /** Whole-composition text render, title envelope included. */\n renderTextComposition(composition: Composition): string;\n /** Whole-composition markdown render, title heading included. */\n renderMarkdownComposition(composition: Composition): string;\n /** Must lead with a `plain_text` header block carrying the composition title. */\n renderSlackComposition(\n composition: Composition\n ): PrimitiveConformanceSlackResult;\n /** Must resolve to complete `<svg>`/`</svg>` markup with no validation errors. Omit for a pack with no frame. */\n renderSVGComposition?(\n composition: Composition\n ): Promise<PrimitiveConformanceSvgResult>;\n}\n\n/** One assertion, run once per example. */\nexport interface PrimitiveConformanceCase {\n readonly name: string;\n /** Signals failure by throwing. May be async, so a pack must await it. */\n readonly run: (\n example: PrimitiveConformanceExample,\n harness: PrimitiveConformanceHarness\n ) => void | Promise<void>;\n}\n\n/** Every definition's examples, flattened to one row each. */\nexport const examplesFromDefinitions = (\n definitions: readonly AnyPrimitiveDefinition[]\n): readonly PrimitiveConformanceExample[] =>\n definitions.flatMap((definition) =>\n definition.examples.map((node, exampleIndex) => ({\n definition,\n type: definition.type,\n exampleIndex,\n node,\n }))\n );\n\n/** Every example crossed with every case, shaped for `it.each`. */\nexport const primitiveConformanceRows = (\n definitions: readonly AnyPrimitiveDefinition[]\n): readonly (PrimitiveConformanceExample & PrimitiveConformanceCase)[] =>\n examplesFromDefinitions(definitions).flatMap((example) =>\n primitiveConformanceCases.map((conformanceCase) => ({\n ...example,\n ...conformanceCase,\n }))\n );\n\n/**\n * Asserts the inventory itself holds up: the pack has examples, every\n * definition contributes one, each example's `type` matches its definition,\n * and `catalog.example` is within the input budget and parses or matches a\n * published example.\n */\nexport const runPrimitiveInventoryConformance = (\n definitions: readonly AnyPrimitiveDefinition[]\n): void => {\n const examples = examplesFromDefinitions(definitions);\n assert.ok(examples.length > 0, 'expected at least one primitive example');\n for (const definition of definitions) {\n assert.ok(\n definition.examples.length > 0,\n `${definition.type} primitive must expose at least one example`\n );\n const checked = checkInputBudget(definition.catalog.example);\n if (!checked.valid) {\n assert.fail(\n `${definition.type} catalog.example must be within the input budget: ${checked.error.message}`\n );\n }\n const catalogExample = checked.value;\n const matchesPublished = definition.examples.some((node) => {\n const published = checkInputBudget(node);\n return (\n published.valid &&\n JSON.stringify(published.value) === JSON.stringify(catalogExample)\n );\n });\n if (matchesPublished) {\n continue;\n }\n const parsed = definition.schema.safeParse(catalogExample);\n assert.ok(\n parsed.success,\n `${definition.type} catalog.example must parse against its schema or match a published example`\n );\n }\n for (const { type, node } of examples) {\n assert.equal(node.type, type);\n }\n};\n\nconst previewHint = (type: string, exampleIndex: number): string =>\n `Failing example: \\`${type}\\` definition, examples[${exampleIndex}].`;\n\nconst renderedClassNames = (html: string): string[] => {\n const classNames = new Set<string>();\n for (const match of html.matchAll(/\\bclass=\"([^\"]+)\"/g)) {\n match[1]!\n .split(/\\s+/)\n .filter(Boolean)\n .forEach((className) => classNames.add(className));\n }\n return [...classNames].sort();\n};\n\n/** The node anchor values in serialized `html`, in document order. */\nconst renderedAnchors = (html: string): string[] => {\n const attribute = new RegExp(`\\\\s${NODE_ANCHOR_ATTRIBUTE}=\"([^\"]*)\"`);\n // Only opening tags: the serializer escapes `<`, `>`, and `\"` in text and attribute values.\n return [...html.matchAll(/<[a-zA-Z][^>]*>/g)].flatMap(([tag]) => {\n const [, value] = attribute.exec(tag) ?? [];\n return value === undefined ? [] : [value];\n });\n};\n\nconst cssEscapeClass = (className: string): string =>\n className.replace(/([!\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~])/g, '\\\\$1');\n\nconst cssHasClassSelector = (css: string, className: string): boolean =>\n new RegExp(`\\\\.${cssEscapeClass(className)}(?![\\\\w-])`).test(css);\n\n/**\n * Every assertion a primitive owes its callers, for a pack to drive with\n * `it.each`.\n */\nexport const primitiveConformanceCases: readonly PrimitiveConformanceCase[] = [\n {\n name: 'validates as a primitive node and inside a composition',\n run: ({ type, exampleIndex, node }, harness) => {\n const hint = previewHint(type, exampleIndex);\n const primitiveErrors = [...harness.validateNode(node)];\n assert.deepEqual(primitiveErrors, [], hint);\n const result = harness.validateComposition(harness.wrapComposition(node));\n assert.equal(result.valid, true, hint);\n assert.deepEqual(result.errors, [], hint);\n },\n },\n {\n name: 'renders through React without throwing',\n run: ({ node }, harness) => {\n const rendered = harness.renderReact(node);\n assert.notEqual(rendered, undefined);\n },\n },\n {\n name: 'collects styles without throwing',\n run: ({ node }, harness) => {\n assert.doesNotThrow(() => harness.collectStyles(node));\n },\n },\n {\n name: 'a container recurses through scope for a node from another pack',\n run: ({ definition, node }, harness) => {\n if (!definition.children || !harness.nestForeignChild) {\n return;\n }\n const nested = harness.nestForeignChild(node);\n assert.notEqual(harness.renderReact(nested), undefined);\n assert.ok(\n harness.renderText(nested).includes(CONFORMANCE_FOREIGN_MARKER)\n );\n assert.ok(\n harness.renderMarkdown(nested).includes(CONFORMANCE_FOREIGN_MARKER)\n );\n },\n },\n {\n name: 'renders through plain text with non-empty output',\n run: ({ node }, harness) => {\n const text = harness.renderText(node);\n assert.equal(typeof text, 'string');\n assert.ok(text.trim().length > 0);\n },\n },\n {\n name: 'renders through markdown with non-empty output',\n run: ({ node }, harness) => {\n const markdown = harness.renderMarkdown(node);\n assert.equal(typeof markdown, 'string');\n assert.ok(markdown.trim().length > 0);\n },\n },\n {\n name: 'renders through Slack dispatch returning at least one block',\n run: ({ node }, harness) => {\n const blocks = harness.renderSlack(node);\n assert.ok(blocks.length > 0);\n for (const block of blocks) {\n assert.equal(typeof block, 'object');\n assert.equal(typeof block.type, 'string');\n }\n },\n },\n {\n name: 'renders through SVG primitive dispatch without throwing',\n run: ({ type, exampleIndex, node }, harness) => {\n if (!harness.renderSvg) {\n return;\n }\n assert.doesNotThrow(() =>\n harness.renderSvg?.(node, `conformance-${type}-${exampleIndex}`)\n );\n },\n },\n {\n name: 'reports a positive finite SVG height estimate',\n run: ({ node }, harness) => {\n if (\n harness.sizesFromNodeHeights === false ||\n !harness.estimateSvgHeight\n ) {\n return;\n }\n const height = harness.estimateSvgHeight(node);\n assert.equal(Number.isFinite(height), true);\n assert.ok(height > 0);\n },\n },\n {\n name: 'renders through renderHTML wrapped in a minimal composition',\n run: ({ node }, harness) => {\n if (!harness.renderHTML) {\n return;\n }\n const result = harness.renderHTML(harness.wrapComposition(node));\n assert.deepEqual(result.validationErrors, []);\n assert.ok(result.html.includes('<section'));\n assert.equal(result.measurement.js, 0);\n assert.ok(result.measurement.total > 0);\n },\n },\n {\n name: 'renders no node anchors unless asked',\n run: ({ node }, harness) => {\n if (!harness.renderHTML) {\n return;\n }\n const { body } = harness.renderHTML(harness.wrapComposition(node));\n assert.deepEqual(renderedAnchors(body), []);\n },\n },\n {\n name: 'renders a node anchor on every node when asked',\n run: ({ type, exampleIndex, node }, harness) => {\n if (!harness.renderHTML || !harness.anchorWalk) {\n return;\n }\n const composition = harness.wrapComposition(node);\n const { body } = harness.renderHTML(composition, { anchors: true });\n const expected = anchoredNodes(\n composition.body,\n harness.anchorWalk\n ).flatMap((anchored) => {\n const anchoredType = nodeType(anchored);\n return anchoredType === undefined ? [] : [anchorValue(anchoredType)];\n });\n assert.deepEqual(\n renderedAnchors(body),\n expected,\n `Expected one anchor per node, in walker order. ${previewHint(type, exampleIndex)}`\n );\n },\n },\n {\n name: 'emits CSS where every var(...) reference has a matching declaration',\n run: ({ node }, harness) => {\n if (!harness.renderHTML || !harness.assertVarRefsHaveDeclarations) {\n return;\n }\n const result = harness.renderHTML(harness.wrapComposition(node), {\n css: 'separate',\n });\n harness.assertVarRefsHaveDeclarations(result.css);\n },\n },\n {\n name: 'reaches every rendered readable class in compact CSS collection',\n run: ({ type, exampleIndex, node }, harness) => {\n if (!harness.renderHTML) {\n return;\n }\n const result = harness.renderHTML(harness.wrapComposition(node), {\n css: 'separate',\n names: 'readable',\n });\n const missing = renderedClassNames(result.body).filter(\n (className) => !cssHasClassSelector(result.css, className)\n );\n const hint =\n `Missing CSS for ${type} example #${exampleIndex}: ` +\n `${missing.join(', ') || '(none)'}. ` +\n previewHint(type, exampleIndex);\n assert.deepEqual(missing, [], hint);\n },\n },\n {\n name: 'renders through renderText wrapped in a minimal composition',\n run: ({ node }, harness) => {\n const text = harness.renderTextComposition(harness.wrapComposition(node));\n assert.ok(text.length > 0);\n assert.ok(text.includes('CONFORMANCE FIXTURE'));\n },\n },\n {\n name: 'renders through renderMarkdown wrapped in a minimal composition',\n run: ({ node }, harness) => {\n const markdown = harness.renderMarkdownComposition(\n harness.wrapComposition(node)\n );\n assert.ok(markdown.length > 0);\n assert.ok(markdown.includes('# Conformance fixture'));\n },\n },\n {\n name: 'renders through renderSlack wrapped in a minimal composition',\n run: ({ node }, harness) => {\n const result = harness.renderSlackComposition(\n harness.wrapComposition(node)\n );\n assert.ok(result.blocks.length > 0);\n assert.ok(result.text.length > 0);\n const first = result.blocks[0];\n assert.ok(first);\n if (first.type !== 'header') {\n assert.fail(`expected a header block, got ${first.type}`);\n }\n assert.equal(first.text.type, 'plain_text');\n },\n },\n {\n name: 'renders through renderSVG wrapped in a minimal composition',\n run: async ({ node }, harness) => {\n if (!harness.renderSVGComposition) {\n return;\n }\n const result = await harness.renderSVGComposition(\n harness.wrapComposition(node)\n );\n assert.deepEqual(result.validationErrors, []);\n assert.ok(result.svg.includes('<svg'));\n assert.ok(result.svg.includes('</svg>'));\n assert.ok(result.measurement.total > 0);\n },\n },\n];\n"]}
@@ -0,0 +1,3 @@
1
+ export { type PrimitiveConformanceCase, type PrimitiveConformanceExample, type PrimitiveConformanceHarness, type PrimitiveConformanceHtmlOptions, type PrimitiveConformanceSlackResult, type PrimitiveConformanceSvgResult, CONFORMANCE_FOREIGN_MARKER, primitiveConformanceRows, runPrimitiveInventoryConformance, } from './conformance.js';
2
+ export { type PackRegistrationOptions, assertPackRegistrationComplete, } from './registration.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,EAClC,0BAA0B,EAC1B,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,uBAAuB,EAC5B,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0; you may not use this file except in compliance with the Elastic License
5
+ * 2.0.
6
+ */
7
+ export { CONFORMANCE_FOREIGN_MARKER, primitiveConformanceRows, runPrimitiveInventoryConformance, } from './conformance.js';
8
+ export { assertPackRegistrationComplete, } from './registration.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAOL,0BAA0B,EAC1B,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport {\n type PrimitiveConformanceCase,\n type PrimitiveConformanceExample,\n type PrimitiveConformanceHarness,\n type PrimitiveConformanceHtmlOptions,\n type PrimitiveConformanceSlackResult,\n type PrimitiveConformanceSvgResult,\n CONFORMANCE_FOREIGN_MARKER,\n primitiveConformanceRows,\n runPrimitiveInventoryConformance,\n} from './conformance';\nexport {\n type PackRegistrationOptions,\n assertPackRegistrationComplete,\n} from './registration';\n"]}
@@ -0,0 +1,32 @@
1
+ import type { AnyPrimitiveDefinition } from '../define/primitive_module.js';
2
+ /** What {@link assertPackRegistrationComplete} needs to compare a pack against its directory. */
3
+ export interface PackRegistrationOptions {
4
+ /** Directory whose subdirectories are one primitive each. A `URL` is resolved with `fileURLToPath`. */
5
+ primitivesDir: URL | string;
6
+ /** The pack's registry array, as passed to `definePrimitivePack`. */
7
+ registered: readonly AnyPrimitiveDefinition[];
8
+ /** Subdirectory names that hold no primitive. */
9
+ ignore?: readonly string[];
10
+ }
11
+ /**
12
+ * Fails when the primitives directory and the pack's registry disagree: a
13
+ * subdirectory with no entry file or no exported definition, a defined type
14
+ * nothing registers, or a registered type no directory defines. Each problem
15
+ * line carries its fix.
16
+ *
17
+ * A pack keeps two hand-written lists, the registry array and the body-node
18
+ * union, and nothing in the type system relates either to the directory they
19
+ * describe. A primitive absent from both lists leaves them agreeing with each
20
+ * other, so it compiles and every other test passes while the primitive is
21
+ * unreachable. This is the check that notices.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * await assertPackRegistrationComplete({
26
+ * primitivesDir: new URL('./primitives/', import.meta.url),
27
+ * registered: slideDeckPrimitives,
28
+ * });
29
+ * ```
30
+ */
31
+ export declare const assertPackRegistrationComplete: ({ primitivesDir, registered, ignore, }: PackRegistrationOptions) => Promise<void>;
32
+ //# sourceMappingURL=registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../src/testing/registration.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,iGAAiG;AACjG,MAAM,WAAW,uBAAuB;IACtC,uGAAuG;IACvG,aAAa,EAAE,GAAG,GAAG,MAAM,CAAC;IAC5B,qEAAqE;IACrE,UAAU,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC9C,iDAAiD;IACjD,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AA2CD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,8BAA8B,GAAU,wCAIlD,uBAAuB,KAAG,OAAO,CAAC,IAAI,CA2DxC,CAAC"}