@elastic/isomer-studio 0.0.0 → 0.4.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 (406) hide show
  1. package/LICENSE.txt +93 -0
  2. package/NOTICE.txt +17329 -0
  3. package/README.md +64 -0
  4. package/THIRD_PARTY_LICENSES.md +404 -0
  5. package/bin/isomer-studio.js +10 -0
  6. package/dist/app/assets/codicon-5T574S7B.ttf +0 -0
  7. package/dist/app/assets/editor.worker.js +11 -0
  8. package/dist/app/assets/esbuild.wasm +0 -0
  9. package/dist/app/assets/json.worker.js +47 -0
  10. package/dist/app/assets/slack.css +1 -0
  11. package/dist/app/assets/studio.css +11 -0
  12. package/dist/app/assets/ts.worker.js +37029 -0
  13. package/dist/app/index.html +16 -0
  14. package/dist/apps/app_host.d.ts +8 -0
  15. package/dist/apps/app_host.d.ts.map +1 -0
  16. package/dist/apps/app_host.js +73 -0
  17. package/dist/apps/app_host.js.map +1 -0
  18. package/dist/browser/dev_host.d.ts +5 -0
  19. package/dist/browser/dev_host.d.ts.map +1 -0
  20. package/dist/browser/dev_host.js +46 -0
  21. package/dist/browser/dev_host.js.map +1 -0
  22. package/dist/browser/mount.d.ts +16 -0
  23. package/dist/browser/mount.d.ts.map +1 -0
  24. package/dist/browser/mount.js +37 -0
  25. package/dist/browser/mount.js.map +1 -0
  26. package/dist/browser/static_host.d.ts +5 -0
  27. package/dist/browser/static_host.d.ts.map +1 -0
  28. package/dist/browser/static_host.js +55 -0
  29. package/dist/browser/static_host.js.map +1 -0
  30. package/dist/chrome/accent.d.ts +14 -0
  31. package/dist/chrome/accent.d.ts.map +1 -0
  32. package/dist/chrome/accent.js +31 -0
  33. package/dist/chrome/accent.js.map +1 -0
  34. package/dist/chrome/app_pages.d.ts +13 -0
  35. package/dist/chrome/app_pages.d.ts.map +1 -0
  36. package/dist/chrome/app_pages.js +33 -0
  37. package/dist/chrome/app_pages.js.map +1 -0
  38. package/dist/chrome/color_mode.d.ts +10 -0
  39. package/dist/chrome/color_mode.d.ts.map +1 -0
  40. package/dist/chrome/color_mode.js +45 -0
  41. package/dist/chrome/color_mode.js.map +1 -0
  42. package/dist/chrome/dev_tint.d.ts +7 -0
  43. package/dist/chrome/dev_tint.d.ts.map +1 -0
  44. package/dist/chrome/dev_tint.js +31 -0
  45. package/dist/chrome/dev_tint.js.map +1 -0
  46. package/dist/chrome/header.d.ts +20 -0
  47. package/dist/chrome/header.d.ts.map +1 -0
  48. package/dist/chrome/header.js +124 -0
  49. package/dist/chrome/header.js.map +1 -0
  50. package/dist/chrome/icon_data_uri.d.ts +12 -0
  51. package/dist/chrome/icon_data_uri.d.ts.map +1 -0
  52. package/dist/chrome/icon_data_uri.js +21 -0
  53. package/dist/chrome/icon_data_uri.js.map +1 -0
  54. package/dist/chrome/isomer_mark.d.ts +17 -0
  55. package/dist/chrome/isomer_mark.d.ts.map +1 -0
  56. package/dist/chrome/isomer_mark.js +46 -0
  57. package/dist/chrome/isomer_mark.js.map +1 -0
  58. package/dist/chrome/nav.d.ts +22 -0
  59. package/dist/chrome/nav.d.ts.map +1 -0
  60. package/dist/chrome/nav.js +306 -0
  61. package/dist/chrome/nav.js.map +1 -0
  62. package/dist/chrome/nav_groups.d.ts +6 -0
  63. package/dist/chrome/nav_groups.d.ts.map +1 -0
  64. package/dist/chrome/nav_groups.js +48 -0
  65. package/dist/chrome/nav_groups.js.map +1 -0
  66. package/dist/chrome/nav_sections.d.ts +29 -0
  67. package/dist/chrome/nav_sections.d.ts.map +1 -0
  68. package/dist/chrome/nav_sections.js +55 -0
  69. package/dist/chrome/nav_sections.js.map +1 -0
  70. package/dist/chrome/oklch.d.ts +10 -0
  71. package/dist/chrome/oklch.d.ts.map +1 -0
  72. package/dist/chrome/oklch.js +61 -0
  73. package/dist/chrome/oklch.js.map +1 -0
  74. package/dist/chrome/primitive_glyph.d.ts +14 -0
  75. package/dist/chrome/primitive_glyph.d.ts.map +1 -0
  76. package/dist/chrome/primitive_glyph.js +48 -0
  77. package/dist/chrome/primitive_glyph.js.map +1 -0
  78. package/dist/chrome/primitive_heading.d.ts +14 -0
  79. package/dist/chrome/primitive_heading.d.ts.map +1 -0
  80. package/dist/chrome/primitive_heading.js +32 -0
  81. package/dist/chrome/primitive_heading.js.map +1 -0
  82. package/dist/chrome/primitive_peek.d.ts +8 -0
  83. package/dist/chrome/primitive_peek.d.ts.map +1 -0
  84. package/dist/chrome/primitive_peek.js +51 -0
  85. package/dist/chrome/primitive_peek.js.map +1 -0
  86. package/dist/chrome/primitive_search.d.ts +9 -0
  87. package/dist/chrome/primitive_search.d.ts.map +1 -0
  88. package/dist/chrome/primitive_search.js +93 -0
  89. package/dist/chrome/primitive_search.js.map +1 -0
  90. package/dist/chrome/route.d.ts +48 -0
  91. package/dist/chrome/route.d.ts.map +1 -0
  92. package/dist/chrome/route.js +136 -0
  93. package/dist/chrome/route.js.map +1 -0
  94. package/dist/cli/args.d.ts +39 -0
  95. package/dist/cli/args.d.ts.map +1 -0
  96. package/dist/cli/args.js +171 -0
  97. package/dist/cli/args.js.map +1 -0
  98. package/dist/cli/run.d.ts +15 -0
  99. package/dist/cli/run.d.ts.map +1 -0
  100. package/dist/cli/run.js +113 -0
  101. package/dist/cli/run.js.map +1 -0
  102. package/dist/cli.d.ts +2 -0
  103. package/dist/cli.d.ts.map +1 -0
  104. package/dist/cli.js +22 -0
  105. package/dist/cli.js.map +1 -0
  106. package/dist/config.d.ts +118 -0
  107. package/dist/config.d.ts.map +1 -0
  108. package/dist/config.js +11 -0
  109. package/dist/config.js.map +1 -0
  110. package/dist/dev/code_editor.d.ts +10 -0
  111. package/dist/dev/code_editor.d.ts.map +1 -0
  112. package/dist/dev/code_editor.js +22 -0
  113. package/dist/dev/code_editor.js.map +1 -0
  114. package/dist/dev/dev_view.d.ts +9 -0
  115. package/dist/dev/dev_view.d.ts.map +1 -0
  116. package/dist/dev/dev_view.js +65 -0
  117. package/dist/dev/dev_view.js.map +1 -0
  118. package/dist/dev/editor_panel.d.ts +17 -0
  119. package/dist/dev/editor_panel.d.ts.map +1 -0
  120. package/dist/dev/editor_panel.js +51 -0
  121. package/dist/dev/editor_panel.js.map +1 -0
  122. package/dist/dev/monaco_editor.d.ts +15 -0
  123. package/dist/dev/monaco_editor.d.ts.map +1 -0
  124. package/dist/dev/monaco_editor.js +159 -0
  125. package/dist/dev/monaco_editor.js.map +1 -0
  126. package/dist/dev/preview_panel.d.ts +10 -0
  127. package/dist/dev/preview_panel.d.ts.map +1 -0
  128. package/dist/dev/preview_panel.js +45 -0
  129. package/dist/dev/preview_panel.js.map +1 -0
  130. package/dist/dev/prop_reference.d.ts +9 -0
  131. package/dist/dev/prop_reference.d.ts.map +1 -0
  132. package/dist/dev/prop_reference.js +134 -0
  133. package/dist/dev/prop_reference.js.map +1 -0
  134. package/dist/dev/tsx_language.d.ts +10 -0
  135. package/dist/dev/tsx_language.d.ts.map +1 -0
  136. package/dist/dev/tsx_language.js +283 -0
  137. package/dist/dev/tsx_language.js.map +1 -0
  138. package/dist/dev/use_editor.d.ts +23 -0
  139. package/dist/dev/use_editor.d.ts.map +1 -0
  140. package/dist/dev/use_editor.js +124 -0
  141. package/dist/dev/use_editor.js.map +1 -0
  142. package/dist/docs/docs_view.d.ts +10 -0
  143. package/dist/docs/docs_view.d.ts.map +1 -0
  144. package/dist/docs/docs_view.js +80 -0
  145. package/dist/docs/docs_view.js.map +1 -0
  146. package/dist/docs/example_source.d.ts +7 -0
  147. package/dist/docs/example_source.d.ts.map +1 -0
  148. package/dist/docs/example_source.js +56 -0
  149. package/dist/docs/example_source.js.map +1 -0
  150. package/dist/docs/examples_panel.d.ts +10 -0
  151. package/dist/docs/examples_panel.d.ts.map +1 -0
  152. package/dist/docs/examples_panel.js +51 -0
  153. package/dist/docs/examples_panel.js.map +1 -0
  154. package/dist/docs/gallery_view.d.ts +9 -0
  155. package/dist/docs/gallery_view.d.ts.map +1 -0
  156. package/dist/docs/gallery_view.js +98 -0
  157. package/dist/docs/gallery_view.js.map +1 -0
  158. package/dist/docs/inline_code.d.ts +11 -0
  159. package/dist/docs/inline_code.d.ts.map +1 -0
  160. package/dist/docs/inline_code.js +24 -0
  161. package/dist/docs/inline_code.js.map +1 -0
  162. package/dist/docs/on_this_page.d.ts +17 -0
  163. package/dist/docs/on_this_page.d.ts.map +1 -0
  164. package/dist/docs/on_this_page.js +77 -0
  165. package/dist/docs/on_this_page.js.map +1 -0
  166. package/dist/docs/props_table.d.ts +14 -0
  167. package/dist/docs/props_table.d.ts.map +1 -0
  168. package/dist/docs/props_table.js +34 -0
  169. package/dist/docs/props_table.js.map +1 -0
  170. package/dist/home/apps_section.d.ts +6 -0
  171. package/dist/home/apps_section.d.ts.map +1 -0
  172. package/dist/home/apps_section.js +44 -0
  173. package/dist/home/apps_section.js.map +1 -0
  174. package/dist/home/featured_strip.d.ts +12 -0
  175. package/dist/home/featured_strip.d.ts.map +1 -0
  176. package/dist/home/featured_strip.js +176 -0
  177. package/dist/home/featured_strip.js.map +1 -0
  178. package/dist/home/home_view.d.ts +11 -0
  179. package/dist/home/home_view.d.ts.map +1 -0
  180. package/dist/home/home_view.js +261 -0
  181. package/dist/home/home_view.js.map +1 -0
  182. package/dist/home/links.d.ts +8 -0
  183. package/dist/home/links.d.ts.map +1 -0
  184. package/dist/home/links.js +14 -0
  185. package/dist/home/links.js.map +1 -0
  186. package/dist/home/loaded_panel.d.ts +6 -0
  187. package/dist/home/loaded_panel.d.ts.map +1 -0
  188. package/dist/home/loaded_panel.js +116 -0
  189. package/dist/home/loaded_panel.js.map +1 -0
  190. package/dist/home/surface_chart.d.ts +6 -0
  191. package/dist/home/surface_chart.d.ts.map +1 -0
  192. package/dist/home/surface_chart.js +263 -0
  193. package/dist/home/surface_chart.js.map +1 -0
  194. package/dist/home/tokens.d.ts +49 -0
  195. package/dist/home/tokens.d.ts.map +1 -0
  196. package/dist/home/tokens.js +171 -0
  197. package/dist/home/tokens.js.map +1 -0
  198. package/dist/index.d.ts +6 -0
  199. package/dist/index.d.ts.map +1 -0
  200. package/dist/index.js +9 -0
  201. package/dist/index.js.map +1 -0
  202. package/dist/model/app_problems.d.ts +4 -0
  203. package/dist/model/app_problems.d.ts.map +1 -0
  204. package/dist/model/app_problems.js +90 -0
  205. package/dist/model/app_problems.js.map +1 -0
  206. package/dist/model/authoring_types.d.ts +23 -0
  207. package/dist/model/authoring_types.d.ts.map +1 -0
  208. package/dist/model/authoring_types.js +35 -0
  209. package/dist/model/authoring_types.js.map +1 -0
  210. package/dist/model/compile_jsx.d.ts +19 -0
  211. package/dist/model/compile_jsx.d.ts.map +1 -0
  212. package/dist/model/compile_jsx.js +55 -0
  213. package/dist/model/compile_jsx.js.map +1 -0
  214. package/dist/model/compose_example.d.ts +9 -0
  215. package/dist/model/compose_example.d.ts.map +1 -0
  216. package/dist/model/compose_example.js +24 -0
  217. package/dist/model/compose_example.js.map +1 -0
  218. package/dist/model/composition_key.d.ts +6 -0
  219. package/dist/model/composition_key.d.ts.map +1 -0
  220. package/dist/model/composition_key.js +26 -0
  221. package/dist/model/composition_key.js.map +1 -0
  222. package/dist/model/describe_runtime.d.ts +33 -0
  223. package/dist/model/describe_runtime.d.ts.map +1 -0
  224. package/dist/model/describe_runtime.js +77 -0
  225. package/dist/model/describe_runtime.js.map +1 -0
  226. package/dist/model/featured.d.ts +11 -0
  227. package/dist/model/featured.d.ts.map +1 -0
  228. package/dist/model/featured.js +70 -0
  229. package/dist/model/featured.js.map +1 -0
  230. package/dist/model/jsx_transform.d.ts +10 -0
  231. package/dist/model/jsx_transform.d.ts.map +1 -0
  232. package/dist/model/jsx_transform.js +31 -0
  233. package/dist/model/jsx_transform.js.map +1 -0
  234. package/dist/model/png_manifest.d.ts +23 -0
  235. package/dist/model/png_manifest.d.ts.map +1 -0
  236. package/dist/model/png_manifest.js +26 -0
  237. package/dist/model/png_manifest.js.map +1 -0
  238. package/dist/model/read_examples.d.ts +12 -0
  239. package/dist/model/read_examples.d.ts.map +1 -0
  240. package/dist/model/read_examples.js +43 -0
  241. package/dist/model/read_examples.js.map +1 -0
  242. package/dist/model/search.d.ts +4 -0
  243. package/dist/model/search.d.ts.map +1 -0
  244. package/dist/model/search.js +29 -0
  245. package/dist/model/search.js.map +1 -0
  246. package/dist/model/sha256.d.ts +3 -0
  247. package/dist/model/sha256.d.ts.map +1 -0
  248. package/dist/model/sha256.js +72 -0
  249. package/dist/model/sha256.js.map +1 -0
  250. package/dist/model/slack_limits.d.ts +9 -0
  251. package/dist/model/slack_limits.d.ts.map +1 -0
  252. package/dist/model/slack_limits.js +213 -0
  253. package/dist/model/slack_limits.js.map +1 -0
  254. package/dist/node/app_bundle.d.ts +45 -0
  255. package/dist/node/app_bundle.d.ts.map +1 -0
  256. package/dist/node/app_bundle.js +212 -0
  257. package/dist/node/app_bundle.js.map +1 -0
  258. package/dist/node/build_site.d.ts +28 -0
  259. package/dist/node/build_site.d.ts.map +1 -0
  260. package/dist/node/build_site.js +90 -0
  261. package/dist/node/build_site.js.map +1 -0
  262. package/dist/node/check.d.ts +40 -0
  263. package/dist/node/check.d.ts.map +1 -0
  264. package/dist/node/check.js +162 -0
  265. package/dist/node/check.js.map +1 -0
  266. package/dist/node/dev_bundle.d.ts +21 -0
  267. package/dist/node/dev_bundle.d.ts.map +1 -0
  268. package/dist/node/dev_bundle.js +121 -0
  269. package/dist/node/dev_bundle.js.map +1 -0
  270. package/dist/node/dev_server.d.ts +16 -0
  271. package/dist/node/dev_server.d.ts.map +1 -0
  272. package/dist/node/dev_server.js +291 -0
  273. package/dist/node/dev_server.js.map +1 -0
  274. package/dist/node/init_config.d.ts +30 -0
  275. package/dist/node/init_config.d.ts.map +1 -0
  276. package/dist/node/init_config.js +158 -0
  277. package/dist/node/init_config.js.map +1 -0
  278. package/dist/node/load_config.d.ts +34 -0
  279. package/dist/node/load_config.d.ts.map +1 -0
  280. package/dist/node/load_config.js +246 -0
  281. package/dist/node/load_config.js.map +1 -0
  282. package/dist/node/project_resolution.d.ts +17 -0
  283. package/dist/node/project_resolution.d.ts.map +1 -0
  284. package/dist/node/project_resolution.js +66 -0
  285. package/dist/node/project_resolution.js.map +1 -0
  286. package/dist/node/rasterize.d.ts +23 -0
  287. package/dist/node/rasterize.d.ts.map +1 -0
  288. package/dist/node/rasterize.js +79 -0
  289. package/dist/node/rasterize.js.map +1 -0
  290. package/dist/node/report.d.ts +8 -0
  291. package/dist/node/report.d.ts.map +1 -0
  292. package/dist/node/report.js +57 -0
  293. package/dist/node/report.js.map +1 -0
  294. package/dist/node/resolve_hooks.d.ts +16 -0
  295. package/dist/node/resolve_hooks.d.ts.map +1 -0
  296. package/dist/node/resolve_hooks.js +104 -0
  297. package/dist/node/resolve_hooks.js.map +1 -0
  298. package/dist/studio.d.ts +4 -0
  299. package/dist/studio.d.ts.map +1 -0
  300. package/dist/studio.js +188 -0
  301. package/dist/studio.js.map +1 -0
  302. package/dist/studio_context.d.ts +27 -0
  303. package/dist/studio_context.d.ts.map +1 -0
  304. package/dist/studio_context.js +17 -0
  305. package/dist/studio_context.js.map +1 -0
  306. package/dist/surfaces/adopt_stylesheet.d.ts +7 -0
  307. package/dist/surfaces/adopt_stylesheet.d.ts.map +1 -0
  308. package/dist/surfaces/adopt_stylesheet.js +64 -0
  309. package/dist/surfaces/adopt_stylesheet.js.map +1 -0
  310. package/dist/surfaces/app_preview.d.ts +4 -0
  311. package/dist/surfaces/app_preview.d.ts.map +1 -0
  312. package/dist/surfaces/app_preview.js +28 -0
  313. package/dist/surfaces/app_preview.js.map +1 -0
  314. package/dist/surfaces/app_surface.d.ts +9 -0
  315. package/dist/surfaces/app_surface.d.ts.map +1 -0
  316. package/dist/surfaces/app_surface.js +27 -0
  317. package/dist/surfaces/app_surface.js.map +1 -0
  318. package/dist/surfaces/applicable_enhancements.d.ts +4 -0
  319. package/dist/surfaces/applicable_enhancements.d.ts.map +1 -0
  320. package/dist/surfaces/applicable_enhancements.js +16 -0
  321. package/dist/surfaces/applicable_enhancements.js.map +1 -0
  322. package/dist/surfaces/enhancement_select.d.ts +10 -0
  323. package/dist/surfaces/enhancement_select.d.ts.map +1 -0
  324. package/dist/surfaces/enhancement_select.js +28 -0
  325. package/dist/surfaces/enhancement_select.js.map +1 -0
  326. package/dist/surfaces/example_picker.d.ts +11 -0
  327. package/dist/surfaces/example_picker.d.ts.map +1 -0
  328. package/dist/surfaces/example_picker.js +44 -0
  329. package/dist/surfaces/example_picker.js.map +1 -0
  330. package/dist/surfaces/format_source.d.ts +4 -0
  331. package/dist/surfaces/format_source.d.ts.map +1 -0
  332. package/dist/surfaces/format_source.js +30 -0
  333. package/dist/surfaces/format_source.js.map +1 -0
  334. package/dist/surfaces/html_surface.d.ts +14 -0
  335. package/dist/surfaces/html_surface.d.ts.map +1 -0
  336. package/dist/surfaces/html_surface.js +122 -0
  337. package/dist/surfaces/html_surface.js.map +1 -0
  338. package/dist/surfaces/png_surface.d.ts +13 -0
  339. package/dist/surfaces/png_surface.d.ts.map +1 -0
  340. package/dist/surfaces/png_surface.js +68 -0
  341. package/dist/surfaces/png_surface.js.map +1 -0
  342. package/dist/surfaces/react_surface.d.ts +11 -0
  343. package/dist/surfaces/react_surface.d.ts.map +1 -0
  344. package/dist/surfaces/react_surface.js +55 -0
  345. package/dist/surfaces/react_surface.js.map +1 -0
  346. package/dist/surfaces/render_output.d.ts +31 -0
  347. package/dist/surfaces/render_output.d.ts.map +1 -0
  348. package/dist/surfaces/render_output.js +119 -0
  349. package/dist/surfaces/render_output.js.map +1 -0
  350. package/dist/surfaces/scaled_preview.d.ts +17 -0
  351. package/dist/surfaces/scaled_preview.d.ts.map +1 -0
  352. package/dist/surfaces/scaled_preview.js +74 -0
  353. package/dist/surfaces/scaled_preview.js.map +1 -0
  354. package/dist/surfaces/shadow_root.d.ts +8 -0
  355. package/dist/surfaces/shadow_root.d.ts.map +1 -0
  356. package/dist/surfaces/shadow_root.js +41 -0
  357. package/dist/surfaces/shadow_root.js.map +1 -0
  358. package/dist/surfaces/slack_surface.d.ts +12 -0
  359. package/dist/surfaces/slack_surface.d.ts.map +1 -0
  360. package/dist/surfaces/slack_surface.js +27 -0
  361. package/dist/surfaces/slack_surface.js.map +1 -0
  362. package/dist/surfaces/snapshot_surface.d.ts +6 -0
  363. package/dist/surfaces/snapshot_surface.d.ts.map +1 -0
  364. package/dist/surfaces/snapshot_surface.js +5 -0
  365. package/dist/surfaces/snapshot_surface.js.map +1 -0
  366. package/dist/surfaces/surface_board.d.ts +19 -0
  367. package/dist/surfaces/surface_board.d.ts.map +1 -0
  368. package/dist/surfaces/surface_board.js +128 -0
  369. package/dist/surfaces/surface_board.js.map +1 -0
  370. package/dist/surfaces/surface_frame.d.ts +8 -0
  371. package/dist/surfaces/surface_frame.d.ts.map +1 -0
  372. package/dist/surfaces/surface_frame.js +4 -0
  373. package/dist/surfaces/surface_frame.js.map +1 -0
  374. package/dist/surfaces/surface_logos.d.ts +9 -0
  375. package/dist/surfaces/surface_logos.d.ts.map +1 -0
  376. package/dist/surfaces/surface_logos.js +21 -0
  377. package/dist/surfaces/surface_logos.js.map +1 -0
  378. package/dist/surfaces/surface_preview.d.ts +32 -0
  379. package/dist/surfaces/surface_preview.d.ts.map +1 -0
  380. package/dist/surfaces/surface_preview.js +66 -0
  381. package/dist/surfaces/surface_preview.js.map +1 -0
  382. package/dist/surfaces/surface_select.d.ts +34 -0
  383. package/dist/surfaces/surface_select.d.ts.map +1 -0
  384. package/dist/surfaces/surface_select.js +119 -0
  385. package/dist/surfaces/surface_select.js.map +1 -0
  386. package/dist/surfaces/text_surfaces.d.ts +14 -0
  387. package/dist/surfaces/text_surfaces.d.ts.map +1 -0
  388. package/dist/surfaces/text_surfaces.js +31 -0
  389. package/dist/surfaces/text_surfaces.js.map +1 -0
  390. package/dist/surfaces/zoom_select.d.ts +9 -0
  391. package/dist/surfaces/zoom_select.d.ts.map +1 -0
  392. package/dist/surfaces/zoom_select.js +32 -0
  393. package/dist/surfaces/zoom_select.js.map +1 -0
  394. package/dist/types.d.ts +32 -0
  395. package/dist/types.d.ts.map +1 -0
  396. package/dist/types.js +9 -0
  397. package/dist/types.js.map +1 -0
  398. package/docs/ci.md +55 -0
  399. package/docs/commands.md +167 -0
  400. package/docs/config.md +192 -0
  401. package/docs/images/home.png +0 -0
  402. package/docs/images/reference.png +0 -0
  403. package/docs/images/workbench.png +0 -0
  404. package/docs/index.md +96 -0
  405. package/docs/toc.yml +10 -0
  406. package/package.json +89 -5
@@ -0,0 +1,171 @@
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
+ import { css } from '@emotion/react';
8
+ import { ISOMER_MARK } from '../chrome/isomer_mark.js';
9
+ /** Home's own palette: one dark look on the plum shell, whatever the color mode. */
10
+ export const HOME = {
11
+ shell: '#3E3748',
12
+ fg: '#FFFFFF',
13
+ fg2: 'rgba(255, 255, 255, 0.72)',
14
+ fg3: 'rgba(255, 255, 255, 0.55)',
15
+ surface1: 'rgba(255, 255, 255, 0.05)',
16
+ surface2: 'rgba(255, 255, 255, 0.07)',
17
+ surface3: 'rgba(255, 255, 255, 0.11)',
18
+ field: 'rgba(22, 12, 30, 0.5)',
19
+ line1: 'rgba(255, 255, 255, 0.12)',
20
+ line2: 'rgba(255, 255, 255, 0.14)',
21
+ line3: 'rgba(255, 255, 255, 0.18)',
22
+ accent: '#F78BBB',
23
+ accentBorder: '#F04E98',
24
+ docs: ISOMER_MARK.blue,
25
+ dev: ISOMER_MARK.teal,
26
+ app: ISOMER_MARK.yellow,
27
+ actionSurface: '#302938',
28
+ actionSurfaceHover: '#382F40',
29
+ };
30
+ /** The glows behind the shell: the same stops as Workbench and Reference, in the logo's palette. */
31
+ export const homeBackground = css `
32
+ background-color: ${HOME.shell};
33
+ background-image:
34
+ radial-gradient(circle at 0% 0%, rgba(0, 191, 179, 0.3), transparent 24%),
35
+ radial-gradient(
36
+ circle at 4% 100%,
37
+ rgba(254, 197, 20, 0.2),
38
+ transparent 22%
39
+ ),
40
+ radial-gradient(circle at 40% 0%, rgba(240, 78, 152, 0.14), transparent 18%);
41
+ `;
42
+ export const CONTENT_WIDTH = 620;
43
+ export const HOME_NARROW = `@container isomer-home (max-width: ${CONTENT_WIDTH - 1}px)`;
44
+ export const WIDE_CONTENT_WIDTH = 880;
45
+ export const PANEL_WIDTH = 360;
46
+ export const GUTTER = 48;
47
+ /** Where the main column fits {@link WIDE_CONTENT_WIDTH} beside the panel. */
48
+ export const WIDE = `@media (min-width: ${WIDE_CONTENT_WIDTH + 2 * GUTTER + PANEL_WIDTH + 64}px)`;
49
+ /** Tiles per row, set on the main column and read by every tile grid inside it. */
50
+ export const TILE_COLUMNS = '--isomer-studio-tile-columns';
51
+ export const sectionLabel = css `
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: space-between;
55
+ font-size: 12px;
56
+ font-weight: 600;
57
+ letter-spacing: 0.01em;
58
+ color: ${HOME.fg2};
59
+ `;
60
+ export const sectionHeading = css `
61
+ margin: 0;
62
+ font: inherit;
63
+ `;
64
+ export const quietLabel = css `
65
+ ${sectionLabel};
66
+ font-size: 11px;
67
+ font-weight: 400;
68
+ letter-spacing: 0.06em;
69
+ text-transform: uppercase;
70
+ color: ${HOME.fg3};
71
+ `;
72
+ /** A tile's chrome. Rows line up across a grid through subgrid, so a wrapped title shifts its neighbours too. */
73
+ export const tile = (rows) => css `
74
+ display: grid;
75
+ grid-template-rows: subgrid;
76
+ grid-row: span ${rows};
77
+ row-gap: 5px;
78
+ padding: 14px 16px;
79
+ border-radius: 10px;
80
+ box-sizing: border-box;
81
+ min-height: 120px;
82
+ background: ${HOME.surface2};
83
+ border: 1px solid ${HOME.line2};
84
+ color: ${HOME.fg2};
85
+ text-decoration: none;
86
+ transition:
87
+ background 0.12s,
88
+ border-color 0.12s;
89
+ &:hover,
90
+ &:focus-within {
91
+ background: ${HOME.surface3};
92
+ text-decoration: none;
93
+ }
94
+ `;
95
+ /** Opaque plum keeps the logo-colored actions readable over the shell's glows. */
96
+ export const actionCard = css `
97
+ background: ${HOME.actionSurface};
98
+ &:hover,
99
+ &:focus-within {
100
+ background: ${HOME.actionSurfaceHover};
101
+ }
102
+ `;
103
+ export const tileTop = css `
104
+ display: flex;
105
+ align-items: flex-start;
106
+ justify-content: space-between;
107
+ gap: 8px;
108
+ `;
109
+ export const tileName = css `
110
+ font-size: 14px;
111
+ font-weight: 600;
112
+ color: ${HOME.accent};
113
+ `;
114
+ export const tileDescription = css `
115
+ font-size: 12px;
116
+ color: ${HOME.fg2};
117
+ text-wrap: pretty;
118
+ `;
119
+ /** The bottom row of links, shown on hover or focus; always shown where there is no hover. */
120
+ export const tileActions = css `
121
+ margin-top: auto;
122
+ padding-top: 6px;
123
+ display: flex;
124
+ gap: 14px;
125
+ font-size: 12px;
126
+ font-weight: 600;
127
+ opacity: 0;
128
+ transition: opacity 0.12s;
129
+ a {
130
+ text-decoration: none;
131
+ }
132
+ a:hover {
133
+ text-decoration: underline;
134
+ }
135
+ *:hover > &,
136
+ *:focus-within > & {
137
+ opacity: 1;
138
+ }
139
+ @media (hover: none) {
140
+ opacity: 1;
141
+ }
142
+ `;
143
+ /** A dashed tile that points somewhere else: the gallery, or the docs on adding an app. */
144
+ export const helpTile = (rows, color) => css `
145
+ ${tile(rows)};
146
+ display: flex;
147
+ flex-direction: column;
148
+ justify-content: center;
149
+ align-items: center;
150
+ text-align: center;
151
+ gap: 6px;
152
+ border-style: dashed;
153
+ border-color: rgba(255, 255, 255, 0.25);
154
+ background: ${HOME.surface1};
155
+ &:hover,
156
+ &:focus-within {
157
+ border-color: ${color};
158
+ }
159
+ `;
160
+ export const tilesGrid = css `
161
+ display: grid;
162
+ grid-template-columns: repeat(var(${TILE_COLUMNS}, 3), minmax(0, 1fr));
163
+ gap: 12px;
164
+ ${HOME_NARROW} {
165
+ grid-template-columns: minmax(0, 1fr);
166
+ }
167
+ `;
168
+ export const monoFont = (familyCode) => css `
169
+ font-family: ${familyCode};
170
+ `;
171
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/home/tokens.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,oFAAoF;AACpF,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,KAAK,EAAE,SAAS;IAChB,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,2BAA2B;IAChC,GAAG,EAAE,2BAA2B;IAChC,QAAQ,EAAE,2BAA2B;IACrC,QAAQ,EAAE,2BAA2B;IACrC,QAAQ,EAAE,2BAA2B;IACrC,KAAK,EAAE,uBAAuB;IAC9B,KAAK,EAAE,2BAA2B;IAClC,KAAK,EAAE,2BAA2B;IAClC,KAAK,EAAE,2BAA2B;IAClC,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,SAAS;IACvB,IAAI,EAAE,WAAW,CAAC,IAAI;IACtB,GAAG,EAAE,WAAW,CAAC,IAAI;IACrB,GAAG,EAAE,WAAW,CAAC,MAAM;IACvB,aAAa,EAAE,SAAS;IACxB,kBAAkB,EAAE,SAAS;CACrB,CAAC;AAEX,oGAAoG;AACpG,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;sBACX,IAAI,CAAC,KAAK;;;;;;;;;CAS/B,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AACjC,MAAM,CAAC,MAAM,WAAW,GAAG,sCAAsC,aAAa,GAAG,CAAC,KAAK,CAAC;AACxF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAC/B,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC;AAEzB,8EAA8E;AAC9E,M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AE,CAAC,GAAG,CAAA;IACxD,IAAI,CAAC,IAAI,CAAC;;;;;;;;;gBASE,IAAI,CAAC,QAAQ;;;oBAGT,KAAK;;CAExB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;sCAEU,YAAY;;IAE9C,WAAW;;;CAGd,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,UAAkB,EAAE,EAAE,CAAC,GAAG,CAAA;iBAClC,UAAU;CAC1B,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 { css } from '@emotion/react';\n\nimport { ISOMER_MARK } from '../chrome/isomer_mark';\n\n/** Home's own palette: one dark look on the plum shell, whatever the color mode. */\nexport const HOME = {\n shell: '#3E3748',\n fg: '#FFFFFF',\n fg2: 'rgba(255, 255, 255, 0.72)',\n fg3: 'rgba(255, 255, 255, 0.55)',\n surface1: 'rgba(255, 255, 255, 0.05)',\n surface2: 'rgba(255, 255, 255, 0.07)',\n surface3: 'rgba(255, 255, 255, 0.11)',\n field: 'rgba(22, 12, 30, 0.5)',\n line1: 'rgba(255, 255, 255, 0.12)',\n line2: 'rgba(255, 255, 255, 0.14)',\n line3: 'rgba(255, 255, 255, 0.18)',\n accent: '#F78BBB',\n accentBorder: '#F04E98',\n docs: ISOMER_MARK.blue,\n dev: ISOMER_MARK.teal,\n app: ISOMER_MARK.yellow,\n actionSurface: '#302938',\n actionSurfaceHover: '#382F40',\n} as const;\n\n/** The glows behind the shell: the same stops as Workbench and Reference, in the logo's palette. */\nexport const homeBackground = css`\n background-color: ${HOME.shell};\n background-image:\n radial-gradient(circle at 0% 0%, rgba(0, 191, 179, 0.3), transparent 24%),\n radial-gradient(\n circle at 4% 100%,\n rgba(254, 197, 20, 0.2),\n transparent 22%\n ),\n radial-gradient(circle at 40% 0%, rgba(240, 78, 152, 0.14), transparent 18%);\n`;\n\nexport const CONTENT_WIDTH = 620;\nexport const HOME_NARROW = `@container isomer-home (max-width: ${CONTENT_WIDTH - 1}px)`;\nexport const WIDE_CONTENT_WIDTH = 880;\nexport const PANEL_WIDTH = 360;\nexport const GUTTER = 48;\n\n/** Where the main column fits {@link WIDE_CONTENT_WIDTH} beside the panel. */\nexport const WIDE = `@media (min-width: ${WIDE_CONTENT_WIDTH + 2 * GUTTER + PANEL_WIDTH + 64}px)`;\n\n/** Tiles per row, set on the main column and read by every tile grid inside it. */\nexport const TILE_COLUMNS = '--isomer-studio-tile-columns';\n\nexport const sectionLabel = css`\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 12px;\n font-weight: 600;\n letter-spacing: 0.01em;\n color: ${HOME.fg2};\n`;\n\nexport const sectionHeading = css`\n margin: 0;\n font: inherit;\n`;\n\nexport const quietLabel = css`\n ${sectionLabel};\n font-size: 11px;\n font-weight: 400;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: ${HOME.fg3};\n`;\n\n/** A tile's chrome. Rows line up across a grid through subgrid, so a wrapped title shifts its neighbours too. */\nexport const tile = (rows: number) => css`\n display: grid;\n grid-template-rows: subgrid;\n grid-row: span ${rows};\n row-gap: 5px;\n padding: 14px 16px;\n border-radius: 10px;\n box-sizing: border-box;\n min-height: 120px;\n background: ${HOME.surface2};\n border: 1px solid ${HOME.line2};\n color: ${HOME.fg2};\n text-decoration: none;\n transition:\n background 0.12s,\n border-color 0.12s;\n &:hover,\n &:focus-within {\n background: ${HOME.surface3};\n text-decoration: none;\n }\n`;\n\n/** Opaque plum keeps the logo-colored actions readable over the shell's glows. */\nexport const actionCard = css`\n background: ${HOME.actionSurface};\n &:hover,\n &:focus-within {\n background: ${HOME.actionSurfaceHover};\n }\n`;\n\nexport const tileTop = css`\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 8px;\n`;\n\nexport const tileName = css`\n font-size: 14px;\n font-weight: 600;\n color: ${HOME.accent};\n`;\n\nexport const tileDescription = css`\n font-size: 12px;\n color: ${HOME.fg2};\n text-wrap: pretty;\n`;\n\n/** The bottom row of links, shown on hover or focus; always shown where there is no hover. */\nexport const tileActions = css`\n margin-top: auto;\n padding-top: 6px;\n display: flex;\n gap: 14px;\n font-size: 12px;\n font-weight: 600;\n opacity: 0;\n transition: opacity 0.12s;\n a {\n text-decoration: none;\n }\n a:hover {\n text-decoration: underline;\n }\n *:hover > &,\n *:focus-within > & {\n opacity: 1;\n }\n @media (hover: none) {\n opacity: 1;\n }\n`;\n\n/** A dashed tile that points somewhere else: the gallery, or the docs on adding an app. */\nexport const helpTile = (rows: number, color: string) => css`\n ${tile(rows)};\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n gap: 6px;\n border-style: dashed;\n border-color: rgba(255, 255, 255, 0.25);\n background: ${HOME.surface1};\n &:hover,\n &:focus-within {\n border-color: ${color};\n }\n`;\n\nexport const tilesGrid = css`\n display: grid;\n grid-template-columns: repeat(var(${TILE_COLUMNS}, 3), minmax(0, 1fr));\n gap: 12px;\n ${HOME_NARROW} {\n grid-template-columns: minmax(0, 1fr);\n }\n`;\n\nexport const monoFont = (familyCode: string) => css`\n font-family: ${familyCode};\n`;\n"]}
@@ -0,0 +1,6 @@
1
+ export type { StudioApp, StudioAppPage, StudioAppProps, StudioAppSurface, StudioCompose, StudioConfig, StudioPreviewProps, StudioRuntime, StudioSurfaceProps, StudioTheme, } from './config.js';
2
+ export { defineStudioConfig } from './config.js';
3
+ export { adoptStylesheet } from './surfaces/adopt_stylesheet.js';
4
+ export type { PreviewZoom } from './surfaces/scaled_preview.js';
5
+ export type { RenderPdf } from './types.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,YAAY,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,WAAW,GACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -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 { defineStudioConfig } from './config.js';
8
+ export { adoptStylesheet } from './surfaces/adopt_stylesheet.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,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 type {\n StudioApp,\n StudioAppPage,\n StudioAppProps,\n StudioAppSurface,\n StudioCompose,\n StudioConfig,\n StudioPreviewProps,\n StudioRuntime,\n StudioSurfaceProps,\n StudioTheme,\n} from './config';\nexport { defineStudioConfig } from './config';\nexport { adoptStylesheet } from './surfaces/adopt_stylesheet';\nexport type { PreviewZoom } from './surfaces/scaled_preview';\nexport type { RenderPdf } from './types';\n"]}
@@ -0,0 +1,4 @@
1
+ export declare const APP_ID_PATTERN: RegExp;
2
+ /** What is wrong with a config's `apps`, one line per problem, each naming the app. Runs in Node and the browser. */
3
+ export declare const appProblems: (apps: unknown) => string[];
4
+ //# sourceMappingURL=app_problems.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app_problems.d.ts","sourceRoot":"","sources":["../../src/model/app_problems.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc,QAAsB,CAAC;AAkDlD,qHAAqH;AACrH,eAAO,MAAM,WAAW,GAAI,MAAM,OAAO,KAAG,MAAM,EAyCjD,CAAC"}
@@ -0,0 +1,90 @@
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 const APP_ID_PATTERN = /^[a-z][a-z0-9-]*$/;
8
+ const isRecord = (value) => typeof value === 'object' && value !== null;
9
+ const label = (index, id) => typeof id === 'string' ? `apps[${index}] ("${id}")` : `apps[${index}]`;
10
+ const isNonEmptyString = (value) => typeof value === 'string' && value.trim().length > 0;
11
+ const isPagePath = (path) => typeof path === 'string' &&
12
+ path.split('/').every((segment) => segment.length > 0);
13
+ const pageProblems = (name, pages) => {
14
+ if (pages === undefined) {
15
+ return [];
16
+ }
17
+ if (!Array.isArray(pages)) {
18
+ return [`${name}: pages must be an array.`];
19
+ }
20
+ const problems = [];
21
+ const seen = new Set();
22
+ pages.forEach((page, index) => {
23
+ const at = `${name}: pages[${index}]`;
24
+ if (!isRecord(page)) {
25
+ problems.push(`${at} must be an object.`);
26
+ return;
27
+ }
28
+ const { path, title, section } = page;
29
+ if (!isPagePath(path)) {
30
+ problems.push(`${at}: path must be one or more non-empty segments, with no leading or trailing "/".`);
31
+ }
32
+ else if (seen.has(path)) {
33
+ problems.push(`${at}: path "${path}" is used by an earlier page.`);
34
+ }
35
+ else {
36
+ seen.add(path);
37
+ }
38
+ if (!isNonEmptyString(title)) {
39
+ problems.push(`${at}: title must be a non-empty string.`);
40
+ }
41
+ if (section !== undefined && !isNonEmptyString(section)) {
42
+ problems.push(`${at}: section must be a non-empty string.`);
43
+ }
44
+ });
45
+ return problems;
46
+ };
47
+ /** What is wrong with a config's `apps`, one line per problem, each naming the app. Runs in Node and the browser. */
48
+ export const appProblems = (apps) => {
49
+ if (apps === undefined) {
50
+ return [];
51
+ }
52
+ if (!Array.isArray(apps)) {
53
+ return ['apps must be an array.'];
54
+ }
55
+ const problems = [];
56
+ const seen = new Set();
57
+ apps.forEach((app, index) => {
58
+ if (!isRecord(app)) {
59
+ problems.push(`apps[${index}] must be an object.`);
60
+ return;
61
+ }
62
+ const { id, title, description, icon, load, pages } = app;
63
+ const name = label(index, id);
64
+ if (typeof id !== 'string' || !APP_ID_PATTERN.test(id)) {
65
+ problems.push(`${name}: id must match ${APP_ID_PATTERN.source}.`);
66
+ }
67
+ else if (seen.has(id)) {
68
+ problems.push(`${name}: id is used by an earlier app.`);
69
+ }
70
+ else {
71
+ seen.add(id);
72
+ }
73
+ if (!isNonEmptyString(title)) {
74
+ problems.push(`${name}: title must be a non-empty string.`);
75
+ }
76
+ if (description !== undefined && !isNonEmptyString(description)) {
77
+ problems.push(`${name}: description must be a non-empty string.`);
78
+ }
79
+ if (typeof load !== 'function') {
80
+ problems.push(`${name}: load must be a function.`);
81
+ }
82
+ if (icon !== undefined &&
83
+ !(isRecord(icon) && typeof icon.svg === 'string')) {
84
+ problems.push(`${name}: icon must be { svg: string }.`);
85
+ }
86
+ problems.push(...pageProblems(name, pages));
87
+ });
88
+ return problems;
89
+ };
90
+ //# sourceMappingURL=app_problems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app_problems.js","sourceRoot":"","sources":["../../src/model/app_problems.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAElD,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,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,GAAG,IAAI,iCAAiC,CAAC,CAAC;QAC1D,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,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\nexport const APP_ID_PATTERN = /^[a-z][a-z0-9-]*$/;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null;\n\nconst label = (index: number, id: unknown) =>\n typeof id === 'string' ? `apps[${index}] (\"${id}\")` : `apps[${index}]`;\n\nconst isNonEmptyString = (value: unknown): value is string =>\n typeof value === 'string' && value.trim().length > 0;\n\nconst isPagePath = (path: unknown): path is string =>\n typeof path === 'string' &&\n path.split('/').every((segment) => segment.length > 0);\n\nconst pageProblems = (name: string, pages: unknown): string[] => {\n if (pages === undefined) {\n return [];\n }\n if (!Array.isArray(pages)) {\n return [`${name}: pages must be an array.`];\n }\n const problems: string[] = [];\n const seen = new Set<string>();\n pages.forEach((page: unknown, index) => {\n const at = `${name}: pages[${index}]`;\n if (!isRecord(page)) {\n problems.push(`${at} must be an object.`);\n return;\n }\n const { path, title, section } = page;\n if (!isPagePath(path)) {\n problems.push(\n `${at}: path must be one or more non-empty segments, with no leading or trailing \"/\".`\n );\n } else if (seen.has(path)) {\n problems.push(`${at}: path \"${path}\" is used by an earlier page.`);\n } else {\n seen.add(path);\n }\n if (!isNonEmptyString(title)) {\n problems.push(`${at}: title must be a non-empty string.`);\n }\n if (section !== undefined && !isNonEmptyString(section)) {\n problems.push(`${at}: section must be a non-empty string.`);\n }\n });\n return problems;\n};\n\n/** What is wrong with a config's `apps`, one line per problem, each naming the app. Runs in Node and the browser. */\nexport const appProblems = (apps: unknown): string[] => {\n if (apps === undefined) {\n return [];\n }\n if (!Array.isArray(apps)) {\n return ['apps must be an array.'];\n }\n const problems: string[] = [];\n const seen = new Set<string>();\n apps.forEach((app: unknown, index) => {\n if (!isRecord(app)) {\n problems.push(`apps[${index}] must be an object.`);\n return;\n }\n const { id, title, description, icon, load, pages } = app;\n const name = label(index, id);\n if (typeof id !== 'string' || !APP_ID_PATTERN.test(id)) {\n problems.push(`${name}: id must match ${APP_ID_PATTERN.source}.`);\n } else if (seen.has(id)) {\n problems.push(`${name}: id is used by an earlier app.`);\n } else {\n seen.add(id);\n }\n if (!isNonEmptyString(title)) {\n problems.push(`${name}: title must be a non-empty string.`);\n }\n if (description !== undefined && !isNonEmptyString(description)) {\n problems.push(`${name}: description must be a non-empty string.`);\n }\n if (typeof load !== 'function') {\n problems.push(`${name}: load must be a function.`);\n }\n if (\n icon !== undefined &&\n !(isRecord(icon) && typeof icon.svg === 'string')\n ) {\n problems.push(`${name}: icon must be { svg: string }.`);\n }\n problems.push(...pageProblems(name, pages));\n });\n return problems;\n};\n"]}
@@ -0,0 +1,23 @@
1
+ import type { RuntimeAuthoringContext } from '@elastic/isomer-runtime';
2
+ import type { AnyPrimitiveDefinition } from '@elastic/isomer-sdk';
3
+ type SchemaNode = Record<string, unknown>;
4
+ /** The module the SDK declares the authoring components in, and the editor's `jsxImportSource`. */
5
+ export declare const AUTHORING_MODULE = "@elastic/isomer-authoring";
6
+ /** What the editors check against: TypeScript declarations for JSX, a JSON Schema for JSON. */
7
+ export interface AuthoringTypes {
8
+ declarations: string;
9
+ bodySchema: SchemaNode;
10
+ /** The component names JSX source uses without importing. */
11
+ components: string[];
12
+ }
13
+ /** The shim's components: what JSX source can open a tag with. */
14
+ export declare const authoringComponents: (primitives: readonly AnyPrimitiveDefinition[]) => string[];
15
+ /**
16
+ * The SDK's authoring module, plus a global per shim component, since the editor's source uses
17
+ * them without importing.
18
+ */
19
+ export declare const authoringDeclarations: (schema: SchemaNode, primitives: readonly AnyPrimitiveDefinition[]) => string;
20
+ /** A JSON Schema for the JSON editor: one body node, or an array of them. */
21
+ export declare const bodyJsonSchema: ({ bodySchema, }: Pick<RuntimeAuthoringContext, "bodySchema">) => SchemaNode;
22
+ export {};
23
+ //# sourceMappingURL=authoring_types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring_types.d.ts","sourceRoot":"","sources":["../../src/model/authoring_types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAKlE,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C,mGAAmG;AACnG,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAE5D,+FAA+F;AAC/F,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,GAC9B,YAAY,SAAS,sBAAsB,EAAE,KAC5C,MAAM,EAGN,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,UAAU,EAClB,YAAY,SAAS,sBAAsB,EAAE,KAC5C,MAYF,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,cAAc,GAAI,iBAE5B,IAAI,CAAC,uBAAuB,EAAE,YAAY,CAAC,KAAG,UAMhD,CAAC"}
@@ -0,0 +1,35 @@
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
+ import { buildAuthoringDeclarations } from '@elastic/isomer-sdk/author';
8
+ import { createShim } from './compile_jsx.js';
9
+ /** The module the SDK declares the authoring components in, and the editor's `jsxImportSource`. */
10
+ export const AUTHORING_MODULE = '@elastic/isomer-authoring';
11
+ /** The shim's components: what JSX source can open a tag with. */
12
+ export const authoringComponents = (primitives) => Object.keys(createShim(primitives)).filter((name) => name !== 'toComposition');
13
+ /**
14
+ * The SDK's authoring module, plus a global per shim component, since the editor's source uses
15
+ * them without importing.
16
+ */
17
+ export const authoringDeclarations = (schema, primitives) => {
18
+ const names = authoringComponents(primitives);
19
+ return [
20
+ buildAuthoringDeclarations(schema, primitives, {
21
+ jsx: true,
22
+ moduleName: AUTHORING_MODULE,
23
+ }),
24
+ ...names.map((name) => `declare const ${name}: typeof import(${JSON.stringify(AUTHORING_MODULE)}).${name};`),
25
+ ].join('\n\n');
26
+ };
27
+ /** A JSON Schema for the JSON editor: one body node, or an array of them. */
28
+ export const bodyJsonSchema = ({ bodySchema, }) => {
29
+ const { $defs, items } = bodySchema;
30
+ if (!items) {
31
+ return {};
32
+ }
33
+ return { $defs, oneOf: [items, { type: 'array', minItems: 1, items }] };
34
+ };
35
+ //# sourceMappingURL=authoring_types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring_types.js","sourceRoot":"","sources":["../../src/model/authoring_types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,mGAAmG;AACnG,MAAM,CAAC,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAU5D,kEAAkE;AAClE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,UAA6C,EACnC,EAAE,CACZ,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,eAAe,CACnC,CAAC;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,MAAkB,EAClB,UAA6C,EACrC,EAAE;IACV,MAAM,KAAK,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC9C,OAAO;QACL,0BAA0B,CAAC,MAAM,EAAE,UAAU,EAAE;YAC7C,GAAG,EAAE,IAAI;YACT,UAAU,EAAE,gBAAgB;SAC7B,CAAC;QACF,GAAG,KAAK,CAAC,GAAG,CACV,CAAC,IAAI,EAAE,EAAE,CACP,iBAAiB,IAAI,mBAAmB,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,KAAK,IAAI,GAAG,CACvF;KACF,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,UAAU,GACkC,EAAc,EAAE;IAC5D,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;IACpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAC1E,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 { RuntimeAuthoringContext } from '@elastic/isomer-runtime';\nimport type { AnyPrimitiveDefinition } from '@elastic/isomer-sdk';\nimport { buildAuthoringDeclarations } from '@elastic/isomer-sdk/author';\n\nimport { createShim } from './compile_jsx';\n\ntype SchemaNode = Record<string, unknown>;\n\n/** The module the SDK declares the authoring components in, and the editor's `jsxImportSource`. */\nexport const AUTHORING_MODULE = '@elastic/isomer-authoring';\n\n/** What the editors check against: TypeScript declarations for JSX, a JSON Schema for JSON. */\nexport interface AuthoringTypes {\n declarations: string;\n bodySchema: SchemaNode;\n /** The component names JSX source uses without importing. */\n components: string[];\n}\n\n/** The shim's components: what JSX source can open a tag with. */\nexport const authoringComponents = (\n primitives: readonly AnyPrimitiveDefinition[]\n): string[] =>\n Object.keys(createShim(primitives)).filter(\n (name) => name !== 'toComposition'\n );\n\n/**\n * The SDK's authoring module, plus a global per shim component, since the editor's source uses\n * them without importing.\n */\nexport const authoringDeclarations = (\n schema: SchemaNode,\n primitives: readonly AnyPrimitiveDefinition[]\n): string => {\n const names = authoringComponents(primitives);\n return [\n buildAuthoringDeclarations(schema, primitives, {\n jsx: true,\n moduleName: AUTHORING_MODULE,\n }),\n ...names.map(\n (name) =>\n `declare const ${name}: typeof import(${JSON.stringify(AUTHORING_MODULE)}).${name};`\n ),\n ].join('\\n\\n');\n};\n\n/** A JSON Schema for the JSON editor: one body node, or an array of them. */\nexport const bodyJsonSchema = ({\n bodySchema,\n}: Pick<RuntimeAuthoringContext, 'bodySchema'>): SchemaNode => {\n const { $defs, items } = bodySchema;\n if (!items) {\n return {};\n }\n return { $defs, oneOf: [items, { type: 'array', minItems: 1, items }] };\n};\n"]}
@@ -0,0 +1,19 @@
1
+ import type { PrimitiveNode } from '@elastic/isomer-sdk';
2
+ import type { JsxShim } from '@elastic/isomer-sdk/author';
3
+ import type { JsxTransform } from '../types.js';
4
+ /** The binding compiled code assigns its element to. Lowercase-initial, so no component name can shadow it. */
5
+ export declare const COMPILED_RESULT = "isomerStudioResult";
6
+ /** Builds the authoring shim once per primitive inventory. */
7
+ export declare const createShim: (primitives: readonly {
8
+ type: string;
9
+ }[]) => JsxShim;
10
+ /** Runs compiled code with `scope` as its free variables and returns {@link COMPILED_RESULT}. */
11
+ export type CompiledEvaluator = (code: string, scope: Readonly<Record<string, unknown>>) => unknown;
12
+ /**
13
+ * Compiles one `<Composition>` element written as authoring JSX to its body nodes.
14
+ * Runs the source in this page as a module by default, so only feed it what the user typed.
15
+ */
16
+ export declare const compileCompositionJsx: (source: string, shim: JsxShim, transformJsx: JsxTransform, { evaluate }?: {
17
+ evaluate?: CompiledEvaluator;
18
+ }) => Promise<PrimitiveNode[]>;
19
+ //# sourceMappingURL=compile_jsx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile_jsx.d.ts","sourceRoot":"","sources":["../../src/model/compile_jsx.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAEV,OAAO,EACR,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAI7C,+GAA+G;AAC/G,eAAO,MAAM,eAAe,uBAAuB,CAAC;AAEpD,8DAA8D;AAC9D,eAAO,MAAM,UAAU,GAAI,YAAY,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,KAAG,OAC3C,CAAC;AAU3B,iGAAiG;AACjG,MAAM,MAAM,iBAAiB,GAAG,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KACrC,OAAO,CAAC;AA+Bb;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,MAAM,EACd,MAAM,OAAO,EACb,cAAc,YAAY,EAC1B,eAAiC;IAAE,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAAO,KACrE,OAAO,CAAC,aAAa,EAAE,CAezB,CAAC"}
@@ -0,0 +1,55 @@
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
+ import { createElement, Fragment } from 'react';
8
+ import { buildJsxShim } from '@elastic/isomer-sdk/author';
9
+ import { JSX_TRANSFORM_OPTIONS } from './jsx_transform.js';
10
+ /** The binding compiled code assigns its element to. Lowercase-initial, so no component name can shadow it. */
11
+ export const COMPILED_RESULT = 'isomerStudioResult';
12
+ /** Builds the authoring shim once per primitive inventory. */
13
+ export const createShim = (primitives) => buildJsxShim(primitives);
14
+ const isElement = (value) => typeof value === 'object' &&
15
+ value !== null &&
16
+ 'type' in value &&
17
+ 'props' in value;
18
+ const isRunner = (value) => typeof value === 'function';
19
+ const evaluateAsModule = async (code, scope) => {
20
+ const module = `export default ({ ${Object.keys(scope).join(', ')} }) => {
21
+ let ${COMPILED_RESULT};
22
+ ${code}
23
+ return ${COMPILED_RESULT};
24
+ };`;
25
+ const url = URL.createObjectURL(new Blob([module], { type: 'text/javascript' }));
26
+ try {
27
+ const { default: run } = (await import(
28
+ /* @vite-ignore */ /* webpackIgnore: true */ url));
29
+ if (!isRunner(run)) {
30
+ throw new Error('The compiled JSX did not load.');
31
+ }
32
+ return run(scope);
33
+ }
34
+ finally {
35
+ URL.revokeObjectURL(url);
36
+ }
37
+ };
38
+ /**
39
+ * Compiles one `<Composition>` element written as authoring JSX to its body nodes.
40
+ * Runs the source in this page as a module by default, so only feed it what the user typed.
41
+ */
42
+ export const compileCompositionJsx = async (source, shim, transformJsx, { evaluate = evaluateAsModule } = {}) => {
43
+ const compiled = await transformJsx(`${COMPILED_RESULT} =\n${source}`);
44
+ const components = Object.fromEntries(Object.entries(shim).filter(([name]) => name !== 'toComposition'));
45
+ const element = await evaluate(compiled, {
46
+ ...components,
47
+ [JSX_TRANSFORM_OPTIONS.jsxFactory]: createElement,
48
+ [JSX_TRANSFORM_OPTIONS.jsxFragment]: Fragment,
49
+ });
50
+ if (!isElement(element)) {
51
+ throw new Error('The JSX did not produce an element.');
52
+ }
53
+ return shim.toComposition(element).body;
54
+ };
55
+ //# sourceMappingURL=compile_jsx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile_jsx.js","sourceRoot":"","sources":["../../src/model/compile_jsx.ts"],"names":[],"mappings":"A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,GAAG,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;YAAS,CAAC;QACT,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,MAAc,EACd,IAAa,EACb,YAA0B,EAC1B,EAAE,QAAQ,GAAG,gBAAgB,KAAuC,EAAE,EAC5C,EAAE;IAC5B,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,GAAG,eAAe,OAAO,MAAM,EAAE,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,KAAK,eAAe,CAAC,CAClE,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE;QACvC,GAAG,UAAU;QACb,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE,aAAa;QACjD,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAAE,QAAQ;KAC9C,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;AAC1C,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 { ReactElement } from 'react';\nimport { createElement, Fragment } from 'react';\nimport type { PrimitiveNode } from '@elastic/isomer-sdk';\nimport type {\n CompositionAuthorProps,\n JsxShim,\n} from '@elastic/isomer-sdk/author';\nimport { buildJsxShim } from '@elastic/isomer-sdk/author';\n\nimport type { JsxTransform } from '../types';\n\nimport { JSX_TRANSFORM_OPTIONS } from './jsx_transform';\n\n/** The binding compiled code assigns its element to. Lowercase-initial, so no component name can shadow it. */\nexport const COMPILED_RESULT = 'isomerStudioResult';\n\n/** Builds the authoring shim once per primitive inventory. */\nexport const createShim = (primitives: readonly { type: string }[]): JsxShim =>\n buildJsxShim(primitives);\n\nconst isElement = (\n value: unknown\n): value is ReactElement<CompositionAuthorProps> =>\n typeof value === 'object' &&\n value !== null &&\n 'type' in value &&\n 'props' in value;\n\n/** Runs compiled code with `scope` as its free variables and returns {@link COMPILED_RESULT}. */\nexport type CompiledEvaluator = (\n code: string,\n scope: Readonly<Record<string, unknown>>\n) => unknown;\n\nconst isRunner = (\n value: unknown\n): value is (scope: Readonly<Record<string, unknown>>) => unknown =>\n typeof value === 'function';\n\nconst evaluateAsModule: CompiledEvaluator = async (code, scope) => {\n const module = `export default ({ ${Object.keys(scope).join(', ')} }) => {\n let ${COMPILED_RESULT};\n ${code}\n return ${COMPILED_RESULT};\n};`;\n const url = URL.createObjectURL(\n new Blob([module], { type: 'text/javascript' })\n );\n try {\n const { default: run } = (await import(\n /* @vite-ignore */ /* webpackIgnore: true */ url\n )) as {\n default?: unknown;\n };\n if (!isRunner(run)) {\n throw new Error('The compiled JSX did not load.');\n }\n return run(scope);\n } finally {\n URL.revokeObjectURL(url);\n }\n};\n\n/**\n * Compiles one `<Composition>` element written as authoring JSX to its body nodes.\n * Runs the source in this page as a module by default, so only feed it what the user typed.\n */\nexport const compileCompositionJsx = async (\n source: string,\n shim: JsxShim,\n transformJsx: JsxTransform,\n { evaluate = evaluateAsModule }: { evaluate?: CompiledEvaluator } = {}\n): Promise<PrimitiveNode[]> => {\n const compiled = await transformJsx(`${COMPILED_RESULT} =\\n${source}`);\n const components = Object.fromEntries(\n Object.entries(shim).filter(([name]) => name !== 'toComposition')\n );\n const element = await evaluate(compiled, {\n ...components,\n [JSX_TRANSFORM_OPTIONS.jsxFactory]: createElement,\n [JSX_TRANSFORM_OPTIONS.jsxFragment]: Fragment,\n });\n\n if (!isElement(element)) {\n throw new Error('The JSX did not produce an element.');\n }\n return shim.toComposition(element).body;\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import type { Composition, PrimitiveNode } from '@elastic/isomer-sdk';
2
+ import type { StudioCompose, StudioConfig, StudioTheme } from '../config.js';
3
+ /** A `view` composition with `nodes` as its body. */
4
+ export declare const defaultCompose: StudioCompose;
5
+ /** The config's `compose`, else one that shows a lone node through `previewExample`. */
6
+ export declare const composeOf: ({ compose, previewExample, }: Pick<StudioConfig, "compose" | "previewExample">) => StudioCompose | undefined;
7
+ /** The one way the Studio, its static build, and `check` turn example nodes into a composition. */
8
+ export declare const composeExample: (compose: StudioCompose | undefined, nodes: readonly PrimitiveNode[], theme: StudioTheme) => Composition;
9
+ //# sourceMappingURL=compose_example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose_example.d.ts","sourceRoot":"","sources":["../../src/model/compose_example.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE1E,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE,aAI3B,CAAC;AAEH,wFAAwF;AACxF,eAAO,MAAM,SAAS,GAAI,8BAGvB,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,gBAAgB,CAAC,KACjD,aAAa,GAAG,SAQX,CAAC;AAER,mGAAmG;AACnG,eAAO,MAAM,cAAc,GACzB,SAAS,aAAa,GAAG,SAAS,EAClC,OAAO,SAAS,aAAa,EAAE,EAC/B,OAAO,WAAW,KACjB,WAA4D,CAAC"}
@@ -0,0 +1,24 @@
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
+ /** A `view` composition with `nodes` as its body. */
8
+ export const defaultCompose = (nodes, { theme }) => ({
9
+ type: 'view',
10
+ body: [...nodes],
11
+ theme,
12
+ });
13
+ /** The config's `compose`, else one that shows a lone node through `previewExample`. */
14
+ export const composeOf = ({ compose, previewExample, }) => compose ??
15
+ (previewExample &&
16
+ ((nodes, { theme }) => {
17
+ const [only] = nodes;
18
+ return only && nodes.length === 1
19
+ ? { ...previewExample(only), theme }
20
+ : defaultCompose(nodes, { theme });
21
+ }));
22
+ /** The one way the Studio, its static build, and `check` turn example nodes into a composition. */
23
+ export const composeExample = (compose, nodes, theme) => (compose ?? defaultCompose)(nodes, { theme });
24
+ //# sourceMappingURL=compose_example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose_example.js","sourceRoot":"","sources":["../../src/model/compose_example.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,qDAAqD;AACrD,MAAM,CAAC,MAAM,cAAc,GAAkB,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAClE,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;IAChB,KAAK;CACN,CAAC,CAAC;AAEH,wFAAwF;AACxF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EACxB,OAAO,EACP,cAAc,GACmC,EACvB,EAAE,CAC5B,OAAO;IACP,CAAC,cAAc;QACb,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;YACpB,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACrB,OAAO,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAC/B,CAAC,CAAC,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE;gBACpC,CAAC,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC,CAAC;AAER,mGAAmG;AACnG,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,OAAkC,EAClC,KAA+B,EAC/B,KAAkB,EACL,EAAE,CAAC,CAAC,OAAO,IAAI,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,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, PrimitiveNode } from '@elastic/isomer-sdk';\n\nimport type { StudioCompose, StudioConfig, StudioTheme } from '../config';\n\n/** A `view` composition with `nodes` as its body. */\nexport const defaultCompose: StudioCompose = (nodes, { theme }) => ({\n type: 'view',\n body: [...nodes],\n theme,\n});\n\n/** The config's `compose`, else one that shows a lone node through `previewExample`. */\nexport const composeOf = ({\n compose,\n previewExample,\n}: Pick<StudioConfig, 'compose' | 'previewExample'>):\n StudioCompose | undefined =>\n compose ??\n (previewExample &&\n ((nodes, { theme }) => {\n const [only] = nodes;\n return only && nodes.length === 1\n ? { ...previewExample(only), theme }\n : defaultCompose(nodes, { theme });\n }));\n\n/** The one way the Studio, its static build, and `check` turn example nodes into a composition. */\nexport const composeExample = (\n compose: StudioCompose | undefined,\n nodes: readonly PrimitiveNode[],\n theme: StudioTheme\n): Composition => (compose ?? defaultCompose)(nodes, { theme });\n"]}
@@ -0,0 +1,6 @@
1
+ import type { Composition } from '@elastic/isomer-sdk';
2
+ /** JSON with sorted keys and no whitespace, dropping `undefined` properties as `JSON.stringify` does. */
3
+ export declare const canonicalJson: (value: unknown) => string;
4
+ /** The SHA-256 of `composition`'s canonical JSON, as hex; the same in Node and the browser. */
5
+ export declare const compositionKey: (composition: Composition) => string;
6
+ //# sourceMappingURL=composition_key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition_key.d.ts","sourceRoot":"","sources":["../../src/model/composition_key.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,yGAAyG;AACzG,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MAe9C,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,cAAc,GAAI,aAAa,WAAW,KAAG,MACO,CAAC"}
@@ -0,0 +1,26 @@
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
+ import { sha256Hex } from './sha256.js';
8
+ const isRecord = (value) => typeof value === 'object' && value !== null;
9
+ /** JSON with sorted keys and no whitespace, dropping `undefined` properties as `JSON.stringify` does. */
10
+ export const canonicalJson = (value) => {
11
+ if (Array.isArray(value)) {
12
+ return `[${value.map((item) => (item === undefined ? 'null' : canonicalJson(item))).join(',')}]`;
13
+ }
14
+ if (isRecord(value)) {
15
+ const entries = Object.keys(value)
16
+ .sort()
17
+ .flatMap((key) => value[key] === undefined
18
+ ? []
19
+ : [`${JSON.stringify(key)}:${canonicalJson(value[key])}`]);
20
+ return `{${entries.join(',')}}`;
21
+ }
22
+ return JSON.stringify(value) ?? 'null';
23
+ };
24
+ /** The SHA-256 of `composition`'s canonical JSON, as hex; the same in Node and the browser. */
25
+ export const compositionKey = (composition) => sha256Hex(new TextEncoder().encode(canonicalJson(composition)));
26
+ //# sourceMappingURL=composition_key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition_key.js","sourceRoot":"","sources":["../../src/model/composition_key.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AAE9C,yGAAyG;AACzG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAU,EAAE;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACnG,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aAC/B,IAAI,EAAE;aACN,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CACf,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS;YACtB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAC5D,CAAC;QACJ,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAClC,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC;AACzC,CAAC,CAAC;AAEF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,WAAwB,EAAU,EAAE,CACjE,SAAS,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,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 '@elastic/isomer-sdk';\n\nimport { sha256Hex } from './sha256';\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null;\n\n/** JSON with sorted keys and no whitespace, dropping `undefined` properties as `JSON.stringify` does. */\nexport const canonicalJson = (value: unknown): string => {\n if (Array.isArray(value)) {\n return `[${value.map((item) => (item === undefined ? 'null' : canonicalJson(item))).join(',')}]`;\n }\n if (isRecord(value)) {\n const entries = Object.keys(value)\n .sort()\n .flatMap((key) =>\n value[key] === undefined\n ? []\n : [`${JSON.stringify(key)}:${canonicalJson(value[key])}`]\n );\n return `{${entries.join(',')}}`;\n }\n return JSON.stringify(value) ?? 'null';\n};\n\n/** The SHA-256 of `composition`'s canonical JSON, as hex; the same in Node and the browser. */\nexport const compositionKey = (composition: Composition): string =>\n sha256Hex(new TextEncoder().encode(canonicalJson(composition)));\n"]}
@@ -0,0 +1,33 @@
1
+ import type { PropDescriptor, RegisteredViewSummary, RuntimeSurfaces } from '@elastic/isomer-runtime';
2
+ import type { AnyPrimitiveDefinition, PrimitiveCatalogEntry, PrimitiveGroup } from '@elastic/isomer-sdk';
3
+ import type { StudioRuntime } from '../config.js';
4
+ import type { AuthoringTypes } from './authoring_types.js';
5
+ import type { StudioExample } from './read_examples.js';
6
+ /** A surface the runtime can expose. */
7
+ export type StudioSurface = keyof RuntimeSurfaces;
8
+ /** Display names in display order, exhaustive over the runtime's surfaces so a new one fails the type check here. */
9
+ export declare const SURFACE_LABELS: Readonly<Record<StudioSurface, string>>;
10
+ /** The runtime's catalog entry for a primitive, plus what the Studio derives for display. */
11
+ export interface PrimitiveDoc extends PrimitiveCatalogEntry {
12
+ label: string;
13
+ group: string;
14
+ examples: StudioExample[];
15
+ props: PropDescriptor[];
16
+ surfaces: StudioSurface[];
17
+ definition: AnyPrimitiveDefinition;
18
+ }
19
+ export interface RuntimeDocs {
20
+ primitives: PrimitiveDoc[];
21
+ /** The packs' groups in pack order, each sorted by label, then {@link UNCATEGORIZED_GROUP_TITLE} for ungrouped primitives. */
22
+ groups: PrimitiveGroup[];
23
+ views: RegisteredViewSummary[];
24
+ surfaces: StudioSurface[];
25
+ authoring: AuthoringTypes;
26
+ }
27
+ /** `statGroup` becomes `Stat group`, for a primitive whose catalog has no `name`. */
28
+ export declare const humanize: (type: string) => string;
29
+ /** Surfaces present on `runtime.surfaces`, in {@link SURFACE_LABELS} order; `snapshot` is absent without frames. */
30
+ export declare const runtimeSurfaces: (runtime: Pick<StudioRuntime, "surfaces">) => StudioSurface[];
31
+ /** Everything the Studio shows about a runtime, read from its public API. */
32
+ export declare const describeRuntime: (runtime: StudioRuntime) => RuntimeDocs;
33
+ //# sourceMappingURL=describe_runtime.d.ts.map