@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.
- package/LICENSE.txt +93 -0
- package/NOTICE.txt +17329 -0
- package/README.md +64 -0
- package/THIRD_PARTY_LICENSES.md +404 -0
- package/bin/isomer-studio.js +10 -0
- package/dist/app/assets/codicon-5T574S7B.ttf +0 -0
- package/dist/app/assets/editor.worker.js +11 -0
- package/dist/app/assets/esbuild.wasm +0 -0
- package/dist/app/assets/json.worker.js +47 -0
- package/dist/app/assets/slack.css +1 -0
- package/dist/app/assets/studio.css +11 -0
- package/dist/app/assets/ts.worker.js +37029 -0
- package/dist/app/index.html +16 -0
- package/dist/apps/app_host.d.ts +8 -0
- package/dist/apps/app_host.d.ts.map +1 -0
- package/dist/apps/app_host.js +73 -0
- package/dist/apps/app_host.js.map +1 -0
- package/dist/browser/dev_host.d.ts +5 -0
- package/dist/browser/dev_host.d.ts.map +1 -0
- package/dist/browser/dev_host.js +46 -0
- package/dist/browser/dev_host.js.map +1 -0
- package/dist/browser/mount.d.ts +16 -0
- package/dist/browser/mount.d.ts.map +1 -0
- package/dist/browser/mount.js +37 -0
- package/dist/browser/mount.js.map +1 -0
- package/dist/browser/static_host.d.ts +5 -0
- package/dist/browser/static_host.d.ts.map +1 -0
- package/dist/browser/static_host.js +55 -0
- package/dist/browser/static_host.js.map +1 -0
- package/dist/chrome/accent.d.ts +14 -0
- package/dist/chrome/accent.d.ts.map +1 -0
- package/dist/chrome/accent.js +31 -0
- package/dist/chrome/accent.js.map +1 -0
- package/dist/chrome/app_pages.d.ts +13 -0
- package/dist/chrome/app_pages.d.ts.map +1 -0
- package/dist/chrome/app_pages.js +33 -0
- package/dist/chrome/app_pages.js.map +1 -0
- package/dist/chrome/color_mode.d.ts +10 -0
- package/dist/chrome/color_mode.d.ts.map +1 -0
- package/dist/chrome/color_mode.js +45 -0
- package/dist/chrome/color_mode.js.map +1 -0
- package/dist/chrome/dev_tint.d.ts +7 -0
- package/dist/chrome/dev_tint.d.ts.map +1 -0
- package/dist/chrome/dev_tint.js +31 -0
- package/dist/chrome/dev_tint.js.map +1 -0
- package/dist/chrome/header.d.ts +20 -0
- package/dist/chrome/header.d.ts.map +1 -0
- package/dist/chrome/header.js +124 -0
- package/dist/chrome/header.js.map +1 -0
- package/dist/chrome/icon_data_uri.d.ts +12 -0
- package/dist/chrome/icon_data_uri.d.ts.map +1 -0
- package/dist/chrome/icon_data_uri.js +21 -0
- package/dist/chrome/icon_data_uri.js.map +1 -0
- package/dist/chrome/isomer_mark.d.ts +17 -0
- package/dist/chrome/isomer_mark.d.ts.map +1 -0
- package/dist/chrome/isomer_mark.js +46 -0
- package/dist/chrome/isomer_mark.js.map +1 -0
- package/dist/chrome/nav.d.ts +22 -0
- package/dist/chrome/nav.d.ts.map +1 -0
- package/dist/chrome/nav.js +306 -0
- package/dist/chrome/nav.js.map +1 -0
- package/dist/chrome/nav_groups.d.ts +6 -0
- package/dist/chrome/nav_groups.d.ts.map +1 -0
- package/dist/chrome/nav_groups.js +48 -0
- package/dist/chrome/nav_groups.js.map +1 -0
- package/dist/chrome/nav_sections.d.ts +29 -0
- package/dist/chrome/nav_sections.d.ts.map +1 -0
- package/dist/chrome/nav_sections.js +55 -0
- package/dist/chrome/nav_sections.js.map +1 -0
- package/dist/chrome/oklch.d.ts +10 -0
- package/dist/chrome/oklch.d.ts.map +1 -0
- package/dist/chrome/oklch.js +61 -0
- package/dist/chrome/oklch.js.map +1 -0
- package/dist/chrome/primitive_glyph.d.ts +14 -0
- package/dist/chrome/primitive_glyph.d.ts.map +1 -0
- package/dist/chrome/primitive_glyph.js +48 -0
- package/dist/chrome/primitive_glyph.js.map +1 -0
- package/dist/chrome/primitive_heading.d.ts +14 -0
- package/dist/chrome/primitive_heading.d.ts.map +1 -0
- package/dist/chrome/primitive_heading.js +32 -0
- package/dist/chrome/primitive_heading.js.map +1 -0
- package/dist/chrome/primitive_peek.d.ts +8 -0
- package/dist/chrome/primitive_peek.d.ts.map +1 -0
- package/dist/chrome/primitive_peek.js +51 -0
- package/dist/chrome/primitive_peek.js.map +1 -0
- package/dist/chrome/primitive_search.d.ts +9 -0
- package/dist/chrome/primitive_search.d.ts.map +1 -0
- package/dist/chrome/primitive_search.js +93 -0
- package/dist/chrome/primitive_search.js.map +1 -0
- package/dist/chrome/route.d.ts +48 -0
- package/dist/chrome/route.d.ts.map +1 -0
- package/dist/chrome/route.js +136 -0
- package/dist/chrome/route.js.map +1 -0
- package/dist/cli/args.d.ts +39 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +171 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/run.d.ts +15 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +113 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +22 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +118 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +11 -0
- package/dist/config.js.map +1 -0
- package/dist/dev/code_editor.d.ts +10 -0
- package/dist/dev/code_editor.d.ts.map +1 -0
- package/dist/dev/code_editor.js +22 -0
- package/dist/dev/code_editor.js.map +1 -0
- package/dist/dev/dev_view.d.ts +9 -0
- package/dist/dev/dev_view.d.ts.map +1 -0
- package/dist/dev/dev_view.js +65 -0
- package/dist/dev/dev_view.js.map +1 -0
- package/dist/dev/editor_panel.d.ts +17 -0
- package/dist/dev/editor_panel.d.ts.map +1 -0
- package/dist/dev/editor_panel.js +51 -0
- package/dist/dev/editor_panel.js.map +1 -0
- package/dist/dev/monaco_editor.d.ts +15 -0
- package/dist/dev/monaco_editor.d.ts.map +1 -0
- package/dist/dev/monaco_editor.js +159 -0
- package/dist/dev/monaco_editor.js.map +1 -0
- package/dist/dev/preview_panel.d.ts +10 -0
- package/dist/dev/preview_panel.d.ts.map +1 -0
- package/dist/dev/preview_panel.js +45 -0
- package/dist/dev/preview_panel.js.map +1 -0
- package/dist/dev/prop_reference.d.ts +9 -0
- package/dist/dev/prop_reference.d.ts.map +1 -0
- package/dist/dev/prop_reference.js +134 -0
- package/dist/dev/prop_reference.js.map +1 -0
- package/dist/dev/tsx_language.d.ts +10 -0
- package/dist/dev/tsx_language.d.ts.map +1 -0
- package/dist/dev/tsx_language.js +283 -0
- package/dist/dev/tsx_language.js.map +1 -0
- package/dist/dev/use_editor.d.ts +23 -0
- package/dist/dev/use_editor.d.ts.map +1 -0
- package/dist/dev/use_editor.js +124 -0
- package/dist/dev/use_editor.js.map +1 -0
- package/dist/docs/docs_view.d.ts +10 -0
- package/dist/docs/docs_view.d.ts.map +1 -0
- package/dist/docs/docs_view.js +80 -0
- package/dist/docs/docs_view.js.map +1 -0
- package/dist/docs/example_source.d.ts +7 -0
- package/dist/docs/example_source.d.ts.map +1 -0
- package/dist/docs/example_source.js +56 -0
- package/dist/docs/example_source.js.map +1 -0
- package/dist/docs/examples_panel.d.ts +10 -0
- package/dist/docs/examples_panel.d.ts.map +1 -0
- package/dist/docs/examples_panel.js +51 -0
- package/dist/docs/examples_panel.js.map +1 -0
- package/dist/docs/gallery_view.d.ts +9 -0
- package/dist/docs/gallery_view.d.ts.map +1 -0
- package/dist/docs/gallery_view.js +98 -0
- package/dist/docs/gallery_view.js.map +1 -0
- package/dist/docs/inline_code.d.ts +11 -0
- package/dist/docs/inline_code.d.ts.map +1 -0
- package/dist/docs/inline_code.js +24 -0
- package/dist/docs/inline_code.js.map +1 -0
- package/dist/docs/on_this_page.d.ts +17 -0
- package/dist/docs/on_this_page.d.ts.map +1 -0
- package/dist/docs/on_this_page.js +77 -0
- package/dist/docs/on_this_page.js.map +1 -0
- package/dist/docs/props_table.d.ts +14 -0
- package/dist/docs/props_table.d.ts.map +1 -0
- package/dist/docs/props_table.js +34 -0
- package/dist/docs/props_table.js.map +1 -0
- package/dist/home/apps_section.d.ts +6 -0
- package/dist/home/apps_section.d.ts.map +1 -0
- package/dist/home/apps_section.js +44 -0
- package/dist/home/apps_section.js.map +1 -0
- package/dist/home/featured_strip.d.ts +12 -0
- package/dist/home/featured_strip.d.ts.map +1 -0
- package/dist/home/featured_strip.js +176 -0
- package/dist/home/featured_strip.js.map +1 -0
- package/dist/home/home_view.d.ts +11 -0
- package/dist/home/home_view.d.ts.map +1 -0
- package/dist/home/home_view.js +261 -0
- package/dist/home/home_view.js.map +1 -0
- package/dist/home/links.d.ts +8 -0
- package/dist/home/links.d.ts.map +1 -0
- package/dist/home/links.js +14 -0
- package/dist/home/links.js.map +1 -0
- package/dist/home/loaded_panel.d.ts +6 -0
- package/dist/home/loaded_panel.d.ts.map +1 -0
- package/dist/home/loaded_panel.js +116 -0
- package/dist/home/loaded_panel.js.map +1 -0
- package/dist/home/surface_chart.d.ts +6 -0
- package/dist/home/surface_chart.d.ts.map +1 -0
- package/dist/home/surface_chart.js +263 -0
- package/dist/home/surface_chart.js.map +1 -0
- package/dist/home/tokens.d.ts +49 -0
- package/dist/home/tokens.d.ts.map +1 -0
- package/dist/home/tokens.js +171 -0
- package/dist/home/tokens.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/model/app_problems.d.ts +4 -0
- package/dist/model/app_problems.d.ts.map +1 -0
- package/dist/model/app_problems.js +90 -0
- package/dist/model/app_problems.js.map +1 -0
- package/dist/model/authoring_types.d.ts +23 -0
- package/dist/model/authoring_types.d.ts.map +1 -0
- package/dist/model/authoring_types.js +35 -0
- package/dist/model/authoring_types.js.map +1 -0
- package/dist/model/compile_jsx.d.ts +19 -0
- package/dist/model/compile_jsx.d.ts.map +1 -0
- package/dist/model/compile_jsx.js +55 -0
- package/dist/model/compile_jsx.js.map +1 -0
- package/dist/model/compose_example.d.ts +9 -0
- package/dist/model/compose_example.d.ts.map +1 -0
- package/dist/model/compose_example.js +24 -0
- package/dist/model/compose_example.js.map +1 -0
- package/dist/model/composition_key.d.ts +6 -0
- package/dist/model/composition_key.d.ts.map +1 -0
- package/dist/model/composition_key.js +26 -0
- package/dist/model/composition_key.js.map +1 -0
- package/dist/model/describe_runtime.d.ts +33 -0
- package/dist/model/describe_runtime.d.ts.map +1 -0
- package/dist/model/describe_runtime.js +77 -0
- package/dist/model/describe_runtime.js.map +1 -0
- package/dist/model/featured.d.ts +11 -0
- package/dist/model/featured.d.ts.map +1 -0
- package/dist/model/featured.js +70 -0
- package/dist/model/featured.js.map +1 -0
- package/dist/model/jsx_transform.d.ts +10 -0
- package/dist/model/jsx_transform.d.ts.map +1 -0
- package/dist/model/jsx_transform.js +31 -0
- package/dist/model/jsx_transform.js.map +1 -0
- package/dist/model/png_manifest.d.ts +23 -0
- package/dist/model/png_manifest.d.ts.map +1 -0
- package/dist/model/png_manifest.js +26 -0
- package/dist/model/png_manifest.js.map +1 -0
- package/dist/model/read_examples.d.ts +12 -0
- package/dist/model/read_examples.d.ts.map +1 -0
- package/dist/model/read_examples.js +43 -0
- package/dist/model/read_examples.js.map +1 -0
- package/dist/model/search.d.ts +4 -0
- package/dist/model/search.d.ts.map +1 -0
- package/dist/model/search.js +29 -0
- package/dist/model/search.js.map +1 -0
- package/dist/model/sha256.d.ts +3 -0
- package/dist/model/sha256.d.ts.map +1 -0
- package/dist/model/sha256.js +72 -0
- package/dist/model/sha256.js.map +1 -0
- package/dist/model/slack_limits.d.ts +9 -0
- package/dist/model/slack_limits.d.ts.map +1 -0
- package/dist/model/slack_limits.js +213 -0
- package/dist/model/slack_limits.js.map +1 -0
- package/dist/node/app_bundle.d.ts +45 -0
- package/dist/node/app_bundle.d.ts.map +1 -0
- package/dist/node/app_bundle.js +212 -0
- package/dist/node/app_bundle.js.map +1 -0
- package/dist/node/build_site.d.ts +28 -0
- package/dist/node/build_site.d.ts.map +1 -0
- package/dist/node/build_site.js +90 -0
- package/dist/node/build_site.js.map +1 -0
- package/dist/node/check.d.ts +40 -0
- package/dist/node/check.d.ts.map +1 -0
- package/dist/node/check.js +162 -0
- package/dist/node/check.js.map +1 -0
- package/dist/node/dev_bundle.d.ts +21 -0
- package/dist/node/dev_bundle.d.ts.map +1 -0
- package/dist/node/dev_bundle.js +121 -0
- package/dist/node/dev_bundle.js.map +1 -0
- package/dist/node/dev_server.d.ts +16 -0
- package/dist/node/dev_server.d.ts.map +1 -0
- package/dist/node/dev_server.js +291 -0
- package/dist/node/dev_server.js.map +1 -0
- package/dist/node/init_config.d.ts +30 -0
- package/dist/node/init_config.d.ts.map +1 -0
- package/dist/node/init_config.js +158 -0
- package/dist/node/init_config.js.map +1 -0
- package/dist/node/load_config.d.ts +34 -0
- package/dist/node/load_config.d.ts.map +1 -0
- package/dist/node/load_config.js +246 -0
- package/dist/node/load_config.js.map +1 -0
- package/dist/node/project_resolution.d.ts +17 -0
- package/dist/node/project_resolution.d.ts.map +1 -0
- package/dist/node/project_resolution.js +66 -0
- package/dist/node/project_resolution.js.map +1 -0
- package/dist/node/rasterize.d.ts +23 -0
- package/dist/node/rasterize.d.ts.map +1 -0
- package/dist/node/rasterize.js +79 -0
- package/dist/node/rasterize.js.map +1 -0
- package/dist/node/report.d.ts +8 -0
- package/dist/node/report.d.ts.map +1 -0
- package/dist/node/report.js +57 -0
- package/dist/node/report.js.map +1 -0
- package/dist/node/resolve_hooks.d.ts +16 -0
- package/dist/node/resolve_hooks.d.ts.map +1 -0
- package/dist/node/resolve_hooks.js +104 -0
- package/dist/node/resolve_hooks.js.map +1 -0
- package/dist/studio.d.ts +4 -0
- package/dist/studio.d.ts.map +1 -0
- package/dist/studio.js +188 -0
- package/dist/studio.js.map +1 -0
- package/dist/studio_context.d.ts +27 -0
- package/dist/studio_context.d.ts.map +1 -0
- package/dist/studio_context.js +17 -0
- package/dist/studio_context.js.map +1 -0
- package/dist/surfaces/adopt_stylesheet.d.ts +7 -0
- package/dist/surfaces/adopt_stylesheet.d.ts.map +1 -0
- package/dist/surfaces/adopt_stylesheet.js +64 -0
- package/dist/surfaces/adopt_stylesheet.js.map +1 -0
- package/dist/surfaces/app_preview.d.ts +4 -0
- package/dist/surfaces/app_preview.d.ts.map +1 -0
- package/dist/surfaces/app_preview.js +28 -0
- package/dist/surfaces/app_preview.js.map +1 -0
- package/dist/surfaces/app_surface.d.ts +9 -0
- package/dist/surfaces/app_surface.d.ts.map +1 -0
- package/dist/surfaces/app_surface.js +27 -0
- package/dist/surfaces/app_surface.js.map +1 -0
- package/dist/surfaces/applicable_enhancements.d.ts +4 -0
- package/dist/surfaces/applicable_enhancements.d.ts.map +1 -0
- package/dist/surfaces/applicable_enhancements.js +16 -0
- package/dist/surfaces/applicable_enhancements.js.map +1 -0
- package/dist/surfaces/enhancement_select.d.ts +10 -0
- package/dist/surfaces/enhancement_select.d.ts.map +1 -0
- package/dist/surfaces/enhancement_select.js +28 -0
- package/dist/surfaces/enhancement_select.js.map +1 -0
- package/dist/surfaces/example_picker.d.ts +11 -0
- package/dist/surfaces/example_picker.d.ts.map +1 -0
- package/dist/surfaces/example_picker.js +44 -0
- package/dist/surfaces/example_picker.js.map +1 -0
- package/dist/surfaces/format_source.d.ts +4 -0
- package/dist/surfaces/format_source.d.ts.map +1 -0
- package/dist/surfaces/format_source.js +30 -0
- package/dist/surfaces/format_source.js.map +1 -0
- package/dist/surfaces/html_surface.d.ts +14 -0
- package/dist/surfaces/html_surface.d.ts.map +1 -0
- package/dist/surfaces/html_surface.js +122 -0
- package/dist/surfaces/html_surface.js.map +1 -0
- package/dist/surfaces/png_surface.d.ts +13 -0
- package/dist/surfaces/png_surface.d.ts.map +1 -0
- package/dist/surfaces/png_surface.js +68 -0
- package/dist/surfaces/png_surface.js.map +1 -0
- package/dist/surfaces/react_surface.d.ts +11 -0
- package/dist/surfaces/react_surface.d.ts.map +1 -0
- package/dist/surfaces/react_surface.js +55 -0
- package/dist/surfaces/react_surface.js.map +1 -0
- package/dist/surfaces/render_output.d.ts +31 -0
- package/dist/surfaces/render_output.d.ts.map +1 -0
- package/dist/surfaces/render_output.js +119 -0
- package/dist/surfaces/render_output.js.map +1 -0
- package/dist/surfaces/scaled_preview.d.ts +17 -0
- package/dist/surfaces/scaled_preview.d.ts.map +1 -0
- package/dist/surfaces/scaled_preview.js +74 -0
- package/dist/surfaces/scaled_preview.js.map +1 -0
- package/dist/surfaces/shadow_root.d.ts +8 -0
- package/dist/surfaces/shadow_root.d.ts.map +1 -0
- package/dist/surfaces/shadow_root.js +41 -0
- package/dist/surfaces/shadow_root.js.map +1 -0
- package/dist/surfaces/slack_surface.d.ts +12 -0
- package/dist/surfaces/slack_surface.d.ts.map +1 -0
- package/dist/surfaces/slack_surface.js +27 -0
- package/dist/surfaces/slack_surface.js.map +1 -0
- package/dist/surfaces/snapshot_surface.d.ts +6 -0
- package/dist/surfaces/snapshot_surface.d.ts.map +1 -0
- package/dist/surfaces/snapshot_surface.js +5 -0
- package/dist/surfaces/snapshot_surface.js.map +1 -0
- package/dist/surfaces/surface_board.d.ts +19 -0
- package/dist/surfaces/surface_board.d.ts.map +1 -0
- package/dist/surfaces/surface_board.js +128 -0
- package/dist/surfaces/surface_board.js.map +1 -0
- package/dist/surfaces/surface_frame.d.ts +8 -0
- package/dist/surfaces/surface_frame.d.ts.map +1 -0
- package/dist/surfaces/surface_frame.js +4 -0
- package/dist/surfaces/surface_frame.js.map +1 -0
- package/dist/surfaces/surface_logos.d.ts +9 -0
- package/dist/surfaces/surface_logos.d.ts.map +1 -0
- package/dist/surfaces/surface_logos.js +21 -0
- package/dist/surfaces/surface_logos.js.map +1 -0
- package/dist/surfaces/surface_preview.d.ts +32 -0
- package/dist/surfaces/surface_preview.d.ts.map +1 -0
- package/dist/surfaces/surface_preview.js +66 -0
- package/dist/surfaces/surface_preview.js.map +1 -0
- package/dist/surfaces/surface_select.d.ts +34 -0
- package/dist/surfaces/surface_select.d.ts.map +1 -0
- package/dist/surfaces/surface_select.js +119 -0
- package/dist/surfaces/surface_select.js.map +1 -0
- package/dist/surfaces/text_surfaces.d.ts +14 -0
- package/dist/surfaces/text_surfaces.d.ts.map +1 -0
- package/dist/surfaces/text_surfaces.js +31 -0
- package/dist/surfaces/text_surfaces.js.map +1 -0
- package/dist/surfaces/zoom_select.d.ts +9 -0
- package/dist/surfaces/zoom_select.d.ts.map +1 -0
- package/dist/surfaces/zoom_select.js +32 -0
- package/dist/surfaces/zoom_select.js.map +1 -0
- package/dist/types.d.ts +32 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/docs/ci.md +55 -0
- package/docs/commands.md +167 -0
- package/docs/config.md +192 -0
- package/docs/images/home.png +0 -0
- package/docs/images/reference.png +0 -0
- package/docs/images/workbench.png +0 -0
- package/docs/index.md +96 -0
- package/docs/toc.yml +10 -0
- package/package.json +89 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe_runtime.d.ts","sourceRoot":"","sources":["../../src/model/describe_runtime.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,wCAAwC;AACxC,MAAM,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC;AAElD,qHAAqH;AACrH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAOlE,CAAC;AAEF,6FAA6F;AAC7F,MAAM,WAAW,YAAa,SAAQ,qBAAqB;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,UAAU,EAAE,sBAAsB,CAAC;CACpC;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,8HAA8H;IAC9H,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED,qFAAqF;AACrF,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,MAMvC,CAAC;AAKF,oHAAoH;AACpH,eAAO,MAAM,eAAe,GAC1B,SAAS,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,KACvC,aAAa,EAMf,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,eAAe,GAAI,SAAS,aAAa,KAAG,WAuDxD,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { UNCATEGORIZED_GROUP_TITLE } from '@elastic/isomer-sdk';
|
|
8
|
+
import { authoringComponents, authoringDeclarations, bodyJsonSchema, } from './authoring_types.js';
|
|
9
|
+
import { readExamples } from './read_examples.js';
|
|
10
|
+
/** Display names in display order, exhaustive over the runtime's surfaces so a new one fails the type check here. */
|
|
11
|
+
export const SURFACE_LABELS = {
|
|
12
|
+
react: 'React',
|
|
13
|
+
html: 'HTML',
|
|
14
|
+
slack: 'Slack',
|
|
15
|
+
markdown: 'Markdown',
|
|
16
|
+
text: 'Text',
|
|
17
|
+
snapshot: 'Snapshot',
|
|
18
|
+
};
|
|
19
|
+
/** `statGroup` becomes `Stat group`, for a primitive whose catalog has no `name`. */
|
|
20
|
+
export const humanize = (type) => {
|
|
21
|
+
const words = type
|
|
22
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
23
|
+
.replace(/[_-]+/g, ' ')
|
|
24
|
+
.toLowerCase();
|
|
25
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
26
|
+
};
|
|
27
|
+
const isStudioSurface = (name) => name in SURFACE_LABELS;
|
|
28
|
+
/** Surfaces present on `runtime.surfaces`, in {@link SURFACE_LABELS} order; `snapshot` is absent without frames. */
|
|
29
|
+
export const runtimeSurfaces = (runtime) => {
|
|
30
|
+
const { surfaces } = runtime;
|
|
31
|
+
return Object.keys(SURFACE_LABELS).filter((name) => isStudioSurface(name) && surfaces[name] !== undefined);
|
|
32
|
+
};
|
|
33
|
+
/** Everything the Studio shows about a runtime, read from its public API. */
|
|
34
|
+
export const describeRuntime = (runtime) => {
|
|
35
|
+
const context = runtime.getAuthoringContext();
|
|
36
|
+
const { primitives: catalog, groups, views } = context;
|
|
37
|
+
const { support } = runtime.getCapabilities();
|
|
38
|
+
const { props } = context.describePrimitives(runtime.primitives.map(({ type }) => type));
|
|
39
|
+
const surfaces = runtimeSurfaces(runtime);
|
|
40
|
+
const groupOf = new Map(groups.flatMap(({ title, types }) => types.map((type) => [type, title])));
|
|
41
|
+
const primitives = runtime.primitives.map((definition) => {
|
|
42
|
+
const { type } = definition;
|
|
43
|
+
const entry = catalog.find((candidate) => candidate.type === type) ??
|
|
44
|
+
definition.catalog;
|
|
45
|
+
return {
|
|
46
|
+
...entry,
|
|
47
|
+
label: entry.name ?? humanize(type),
|
|
48
|
+
group: groupOf.get(type) ?? UNCATEGORIZED_GROUP_TITLE,
|
|
49
|
+
examples: readExamples(definition),
|
|
50
|
+
props: (props[type] ?? []).filter(({ name }) => name !== 'type'),
|
|
51
|
+
surfaces: surfaces.filter((surface) => support[type]?.[surface] === 'native'),
|
|
52
|
+
definition,
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
const labelOf = new Map(primitives.map(({ type, label }) => [type, label]));
|
|
56
|
+
const byLabel = (types) => [...types].sort((a, b) => (labelOf.get(a) ?? a).localeCompare(labelOf.get(b) ?? b));
|
|
57
|
+
const ungrouped = primitives
|
|
58
|
+
.filter(({ type }) => !groupOf.has(type))
|
|
59
|
+
.map(({ type }) => type);
|
|
60
|
+
return {
|
|
61
|
+
primitives,
|
|
62
|
+
groups: [
|
|
63
|
+
...groups.map(({ title, types }) => ({ title, types: byLabel(types) })),
|
|
64
|
+
...(ungrouped.length
|
|
65
|
+
? [{ title: UNCATEGORIZED_GROUP_TITLE, types: byLabel(ungrouped) }]
|
|
66
|
+
: []),
|
|
67
|
+
],
|
|
68
|
+
views,
|
|
69
|
+
surfaces,
|
|
70
|
+
authoring: {
|
|
71
|
+
declarations: authoringDeclarations(context.schema, runtime.primitives),
|
|
72
|
+
bodySchema: bodyJsonSchema(context),
|
|
73
|
+
components: authoringComponents(runtime.primitives),
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=describe_runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe_runtime.js","sourceRoot":"","sources":["../../src/model/describe_runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAKhE,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK/C,qHAAqH;AACrH,MAAM,CAAC,MAAM,cAAc,GAA4C;IACrE,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MA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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 {\n PropDescriptor,\n RegisteredViewSummary,\n RuntimeSurfaces,\n} from '@elastic/isomer-runtime';\nimport type {\n AnyPrimitiveDefinition,\n PrimitiveCatalogEntry,\n PrimitiveGroup,\n} from '@elastic/isomer-sdk';\nimport { UNCATEGORIZED_GROUP_TITLE } from '@elastic/isomer-sdk';\n\nimport type { StudioRuntime } from '../config';\n\nimport type { AuthoringTypes } from './authoring_types';\nimport {\n authoringComponents,\n authoringDeclarations,\n bodyJsonSchema,\n} from './authoring_types';\nimport type { StudioExample } from './read_examples';\nimport { readExamples } from './read_examples';\n\n/** A surface the runtime can expose. */\nexport type StudioSurface = keyof RuntimeSurfaces;\n\n/** Display names in display order, exhaustive over the runtime's surfaces so a new one fails the type check here. */\nexport const SURFACE_LABELS: Readonly<Record<StudioSurface, string>> = {\n react: 'React',\n html: 'HTML',\n slack: 'Slack',\n markdown: 'Markdown',\n text: 'Text',\n snapshot: 'Snapshot',\n};\n\n/** The runtime's catalog entry for a primitive, plus what the Studio derives for display. */\nexport interface PrimitiveDoc extends PrimitiveCatalogEntry {\n label: string;\n group: string;\n examples: StudioExample[];\n props: PropDescriptor[];\n surfaces: StudioSurface[];\n definition: AnyPrimitiveDefinition;\n}\n\nexport interface RuntimeDocs {\n primitives: PrimitiveDoc[];\n /** The packs' groups in pack order, each sorted by label, then {@link UNCATEGORIZED_GROUP_TITLE} for ungrouped primitives. */\n groups: PrimitiveGroup[];\n views: RegisteredViewSummary[];\n surfaces: StudioSurface[];\n authoring: AuthoringTypes;\n}\n\n/** `statGroup` becomes `Stat group`, for a primitive whose catalog has no `name`. */\nexport const humanize = (type: string): string => {\n const words = type\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/[_-]+/g, ' ')\n .toLowerCase();\n return words.charAt(0).toUpperCase() + words.slice(1);\n};\n\nconst isStudioSurface = (name: string): name is StudioSurface =>\n name in SURFACE_LABELS;\n\n/** Surfaces present on `runtime.surfaces`, in {@link SURFACE_LABELS} order; `snapshot` is absent without frames. */\nexport const runtimeSurfaces = (\n runtime: Pick<StudioRuntime, 'surfaces'>\n): StudioSurface[] => {\n const { surfaces } = runtime;\n return Object.keys(SURFACE_LABELS).filter(\n (name): name is StudioSurface =>\n isStudioSurface(name) && surfaces[name] !== undefined\n );\n};\n\n/** Everything the Studio shows about a runtime, read from its public API. */\nexport const describeRuntime = (runtime: StudioRuntime): RuntimeDocs => {\n const context = runtime.getAuthoringContext();\n const { primitives: catalog, groups, views } = context;\n const { support } = runtime.getCapabilities();\n const { props } = context.describePrimitives(\n runtime.primitives.map(({ type }) => type)\n );\n const surfaces = runtimeSurfaces(runtime);\n const groupOf = new Map(\n groups.flatMap(({ title, types }) => types.map((type) => [type, title]))\n );\n\n const primitives = runtime.primitives.map((definition): PrimitiveDoc => {\n const { type } = definition;\n const entry =\n catalog.find((candidate) => candidate.type === type) ??\n definition.catalog;\n return {\n ...entry,\n label: entry.name ?? humanize(type),\n group: groupOf.get(type) ?? UNCATEGORIZED_GROUP_TITLE,\n examples: readExamples(definition),\n props: (props[type] ?? []).filter(({ name }) => name !== 'type'),\n surfaces: surfaces.filter(\n (surface) => support[type]?.[surface] === 'native'\n ),\n definition,\n };\n });\n\n const labelOf = new Map(primitives.map(({ type, label }) => [type, label]));\n const byLabel = (types: readonly string[]): string[] =>\n [...types].sort((a, b) =>\n (labelOf.get(a) ?? a).localeCompare(labelOf.get(b) ?? b)\n );\n const ungrouped = primitives\n .filter(({ type }) => !groupOf.has(type))\n .map(({ type }) => type);\n\n return {\n primitives,\n groups: [\n ...groups.map(({ title, types }) => ({ title, types: byLabel(types) })),\n ...(ungrouped.length\n ? [{ title: UNCATEGORIZED_GROUP_TITLE, types: byLabel(ungrouped) }]\n : []),\n ],\n views,\n surfaces,\n authoring: {\n declarations: authoringDeclarations(context.schema, runtime.primitives),\n bodySchema: bodyJsonSchema(context),\n components: authoringComponents(runtime.primitives),\n },\n };\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PrimitiveDoc } from './describe_runtime.js';
|
|
2
|
+
/**
|
|
3
|
+
* The primitives Home features: the config's `featured`, in its order, skipping types the runtime lacks;
|
|
4
|
+
* or, without one, up to {@link FEATURED_COUNT} drawn at random without repeats.
|
|
5
|
+
*/
|
|
6
|
+
export declare const pickFeatured: (primitives: readonly PrimitiveDoc[], featured: readonly string[] | undefined, random?: () => number) => PrimitiveDoc[];
|
|
7
|
+
/** The primitive types a runtime reports, or none when `runtime` is not one; `featuredProblems` then names every entry. */
|
|
8
|
+
export declare const runtimePrimitiveTypes: (runtime: unknown) => string[];
|
|
9
|
+
/** What is wrong with a config's `featured`, one line per problem. Runs in Node and the browser. */
|
|
10
|
+
export declare const featuredProblems: (featured: unknown, types: readonly string[]) => string[];
|
|
11
|
+
//# sourceMappingURL=featured.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featured.d.ts","sourceRoot":"","sources":["../../src/model/featured.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,YAAY,SAAS,YAAY,EAAE,EACnC,UAAU,SAAS,MAAM,EAAE,GAAG,SAAS,EACvC,SAAQ,MAAM,MAAoB,KACjC,YAAY,EAgBd,CAAC;AAEF,2HAA2H;AAC3H,eAAO,MAAM,qBAAqB,GAAI,SAAS,OAAO,KAAG,MAAM,EAe9D,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,gBAAgB,GAC3B,UAAU,OAAO,EACjB,OAAO,SAAS,MAAM,EAAE,KACvB,MAAM,EAyBR,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { FEATURED_COUNT } from '../config.js';
|
|
8
|
+
/**
|
|
9
|
+
* The primitives Home features: the config's `featured`, in its order, skipping types the runtime lacks;
|
|
10
|
+
* or, without one, up to {@link FEATURED_COUNT} drawn at random without repeats.
|
|
11
|
+
*/
|
|
12
|
+
export const pickFeatured = (primitives, featured, random = Math.random) => {
|
|
13
|
+
if (featured !== undefined) {
|
|
14
|
+
return featured.flatMap((type) => {
|
|
15
|
+
const doc = primitives.find((candidate) => candidate.type === type);
|
|
16
|
+
return doc ? [doc] : [];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const pool = [...primitives];
|
|
20
|
+
const picked = [];
|
|
21
|
+
while (pool.length && picked.length < FEATURED_COUNT) {
|
|
22
|
+
const [doc] = pool.splice(Math.floor(random() * pool.length), 1);
|
|
23
|
+
if (doc) {
|
|
24
|
+
picked.push(doc);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return picked;
|
|
28
|
+
};
|
|
29
|
+
/** The primitive types a runtime reports, or none when `runtime` is not one; `featuredProblems` then names every entry. */
|
|
30
|
+
export const runtimePrimitiveTypes = (runtime) => {
|
|
31
|
+
const primitives = typeof runtime === 'object' && runtime !== null && 'primitives' in runtime
|
|
32
|
+
? runtime.primitives
|
|
33
|
+
: undefined;
|
|
34
|
+
return Array.isArray(primitives)
|
|
35
|
+
? primitives.flatMap((definition) => typeof definition === 'object' &&
|
|
36
|
+
definition !== null &&
|
|
37
|
+
'type' in definition &&
|
|
38
|
+
typeof definition.type === 'string'
|
|
39
|
+
? [definition.type]
|
|
40
|
+
: [])
|
|
41
|
+
: [];
|
|
42
|
+
};
|
|
43
|
+
/** What is wrong with a config's `featured`, one line per problem. Runs in Node and the browser. */
|
|
44
|
+
export const featuredProblems = (featured, types) => {
|
|
45
|
+
if (featured === undefined) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
if (!Array.isArray(featured)) {
|
|
49
|
+
return ['featured must be an array of primitive types.'];
|
|
50
|
+
}
|
|
51
|
+
const problems = [];
|
|
52
|
+
const seen = new Set();
|
|
53
|
+
featured.forEach((type, index) => {
|
|
54
|
+
if (typeof type !== 'string') {
|
|
55
|
+
problems.push(`featured[${index}] must be a primitive type.`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!types.includes(type)) {
|
|
59
|
+
problems.push(`featured[${index}] ("${type}") names no primitive in the runtime.`);
|
|
60
|
+
}
|
|
61
|
+
else if (seen.has(type)) {
|
|
62
|
+
problems.push(`featured[${index}] ("${type}") repeats an earlier entry.`);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
seen.add(type);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return problems;
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=featured.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featured.js","sourceRoot":"","sources":["../../src/model/featured.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAI3C;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,UAAmC,EACnC,QAAuC,EACvC,SAAuB,IAAI,CAAC,MAAM,EAClB,EAAE;IAClB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC/B,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YACpE,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1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QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,+CAA+C,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAa,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,QAAQ,CAAC,IAAI,CAAC,YAAY,KAAK,6BAA6B,CAAC,CAAC;YAC9D,OAAO;QACT,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,IAAI,CACX,YAAY,KAAK,OAAO,IAAI,uCAAuC,CACpE,CAAC;QACJ,CAAC;aAAM,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,IAAI,CAAC,YAAY,KAAK,OAAO,IAAI,8BAA8B,CAAC,CAAC;QAC5E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;IACH,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\nimport { FEATURED_COUNT } from '../config';\n\nimport type { PrimitiveDoc } from './describe_runtime';\n\n/**\n * The primitives Home features: the config's `featured`, in its order, skipping types the runtime lacks;\n * or, without one, up to {@link FEATURED_COUNT} drawn at random without repeats.\n */\nexport const pickFeatured = (\n primitives: readonly PrimitiveDoc[],\n featured: readonly string[] | undefined,\n random: () => number = Math.random\n): PrimitiveDoc[] => {\n if (featured !== undefined) {\n return featured.flatMap((type) => {\n const doc = primitives.find((candidate) => candidate.type === type);\n return doc ? [doc] : [];\n });\n }\n const pool = [...primitives];\n const picked: PrimitiveDoc[] = [];\n while (pool.length && picked.length < FEATURED_COUNT) {\n const [doc] = pool.splice(Math.floor(random() * pool.length), 1);\n if (doc) {\n picked.push(doc);\n }\n }\n return picked;\n};\n\n/** The primitive types a runtime reports, or none when `runtime` is not one; `featuredProblems` then names every entry. */\nexport const runtimePrimitiveTypes = (runtime: unknown): string[] => {\n const primitives =\n typeof runtime === 'object' && runtime !== null && 'primitives' in runtime\n ? runtime.primitives\n : undefined;\n return Array.isArray(primitives)\n ? primitives.flatMap((definition: unknown) =>\n typeof definition === 'object' &&\n definition !== null &&\n 'type' in definition &&\n typeof definition.type === 'string'\n ? [definition.type]\n : []\n )\n : [];\n};\n\n/** What is wrong with a config's `featured`, one line per problem. Runs in Node and the browser. */\nexport const featuredProblems = (\n featured: unknown,\n types: readonly string[]\n): string[] => {\n if (featured === undefined) {\n return [];\n }\n if (!Array.isArray(featured)) {\n return ['featured must be an array of primitive types.'];\n }\n const problems: string[] = [];\n const seen = new Set<string>();\n featured.forEach((type: unknown, index) => {\n if (typeof type !== 'string') {\n problems.push(`featured[${index}] must be a primitive type.`);\n return;\n }\n if (!types.includes(type)) {\n problems.push(\n `featured[${index}] (\"${type}\") names no primitive in the runtime.`\n );\n } else if (seen.has(type)) {\n problems.push(`featured[${index}] (\"${type}\") repeats an earlier entry.`);\n } else {\n seen.add(type);\n }\n });\n return problems;\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** esbuild `transform` options for the editor's JSX. Factory names are lowercase-initial, so no primitive's component shadows them. */
|
|
2
|
+
export declare const JSX_TRANSFORM_OPTIONS: {
|
|
3
|
+
readonly loader: "jsx";
|
|
4
|
+
readonly jsx: "transform";
|
|
5
|
+
readonly jsxFactory: "isomerStudioH";
|
|
6
|
+
readonly jsxFragment: "isomerStudioFragment";
|
|
7
|
+
};
|
|
8
|
+
/** esbuild's errors as `line:column text` lines, or the error's message. */
|
|
9
|
+
export declare const describeTransformError: (error: unknown) => string;
|
|
10
|
+
//# sourceMappingURL=jsx_transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx_transform.d.ts","sourceRoot":"","sources":["../../src/model/jsx_transform.ts"],"names":[],"mappings":"AAOA,uIAAuI;AACvI,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAaX,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,GAAI,OAAO,OAAO,KAAG,MAcvD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
/** esbuild `transform` options for the editor's JSX. Factory names are lowercase-initial, so no primitive's component shadows them. */
|
|
8
|
+
export const JSX_TRANSFORM_OPTIONS = {
|
|
9
|
+
loader: 'jsx',
|
|
10
|
+
jsx: 'transform',
|
|
11
|
+
jsxFactory: 'isomerStudioH',
|
|
12
|
+
jsxFragment: 'isomerStudioFragment',
|
|
13
|
+
};
|
|
14
|
+
const isMessage = (value) => typeof value === 'object' &&
|
|
15
|
+
value !== null &&
|
|
16
|
+
'text' in value &&
|
|
17
|
+
typeof value.text === 'string';
|
|
18
|
+
/** esbuild's errors as `line:column text` lines, or the error's message. */
|
|
19
|
+
export const describeTransformError = (error) => {
|
|
20
|
+
const errors = typeof error === 'object' && error !== null && 'errors' in error
|
|
21
|
+
? error.errors
|
|
22
|
+
: undefined;
|
|
23
|
+
const messages = Array.isArray(errors) ? errors.filter(isMessage) : [];
|
|
24
|
+
if (messages.length) {
|
|
25
|
+
return messages
|
|
26
|
+
.map(({ text, location }) => location ? `${location.line}:${location.column} ${text}` : text)
|
|
27
|
+
.join('\n');
|
|
28
|
+
}
|
|
29
|
+
return error instanceof Error ? error.message : String(error);
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=jsx_transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx_transform.js","sourceRoot":"","sources":["../../src/model/jsx_transform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uIAAuI;AACvI,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,MAAM,EAAE,KAAK;IACb,GAAG,EAAE,WAAW;IAChB,UAAU,EAAE,eAAe;IAC3B,WAAW,EAAE,sBAAsB;CAC3B,CAAC;AAOX,MAAM,SAAS,GAAG,CAAC,KAAc,EAA2B,EAAE,CAC5D,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,MAAM,IAAI,KAAK;IACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAEjC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAc,EAAU,EAAE;IAC/D,MAAM,MAAM,GACV,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK;QAC9D,CAAC,CAAC,KAAK,CAAC,MAAM;QACd,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,QAAQ;aACZ,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAC1B,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAChE;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IACD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,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\n/** esbuild `transform` options for the editor's JSX. Factory names are lowercase-initial, so no primitive's component shadows them. */\nexport const JSX_TRANSFORM_OPTIONS = {\n loader: 'jsx',\n jsx: 'transform',\n jsxFactory: 'isomerStudioH',\n jsxFragment: 'isomerStudioFragment',\n} as const;\n\ninterface EsbuildMessage {\n text: string;\n location?: { line: number; column: number } | null;\n}\n\nconst isMessage = (value: unknown): value is EsbuildMessage =>\n typeof value === 'object' &&\n value !== null &&\n 'text' in value &&\n typeof value.text === 'string';\n\n/** esbuild's errors as `line:column text` lines, or the error's message. */\nexport const describeTransformError = (error: unknown): string => {\n const errors =\n typeof error === 'object' && error !== null && 'errors' in error\n ? error.errors\n : undefined;\n const messages = Array.isArray(errors) ? errors.filter(isMessage) : [];\n if (messages.length) {\n return messages\n .map(({ text, location }) =>\n location ? `${location.line}:${location.column} ${text}` : text\n )\n .join('\\n');\n }\n return error instanceof Error ? error.message : String(error);\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { StudioTheme } from '../config.js';
|
|
2
|
+
/** One prerendered PNG, with where it came from for debugging. */
|
|
3
|
+
export interface PngManifestEntry {
|
|
4
|
+
/** Relative to the manifest. */
|
|
5
|
+
file: string;
|
|
6
|
+
primitive: string;
|
|
7
|
+
example: string;
|
|
8
|
+
theme: StudioTheme;
|
|
9
|
+
}
|
|
10
|
+
/** `png/manifest.json` in a static build, keyed by `compositionKey`. */
|
|
11
|
+
export interface PngManifest {
|
|
12
|
+
version: 1;
|
|
13
|
+
entries: Record<string, PngManifestEntry>;
|
|
14
|
+
}
|
|
15
|
+
export declare const PNG_UNAVAILABLE_MESSAGE = "PNG previews of edited compositions need `isomer-studio dev`.";
|
|
16
|
+
/** A static build has no PNG for this composition. Identify it by `name`. */
|
|
17
|
+
export declare class PngUnavailableError extends Error {
|
|
18
|
+
readonly name = "PngUnavailableError";
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
export declare const isPngUnavailableError: (error: unknown) => boolean;
|
|
22
|
+
export declare const isPngManifest: (value: unknown) => value is PngManifest;
|
|
23
|
+
//# sourceMappingURL=png_manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png_manifest.d.ts","sourceRoot":"","sources":["../../src/model/png_manifest.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,wEAAwE;AACxE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC3C;AAED,eAAO,MAAM,uBAAuB,kEAC6B,CAAC;AAElE,6EAA6E;AAC7E,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAkB,IAAI,yBAAyB;;CAKhD;AAED,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,OAIjB,CAAC;AAEvC,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAOhC,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
|
+
export const PNG_UNAVAILABLE_MESSAGE = 'PNG previews of edited compositions need `isomer-studio dev`.';
|
|
8
|
+
/** A static build has no PNG for this composition. Identify it by `name`. */
|
|
9
|
+
export class PngUnavailableError extends Error {
|
|
10
|
+
name = 'PngUnavailableError';
|
|
11
|
+
constructor() {
|
|
12
|
+
super(PNG_UNAVAILABLE_MESSAGE);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export const isPngUnavailableError = (error) => typeof error === 'object' &&
|
|
16
|
+
error !== null &&
|
|
17
|
+
'name' in error &&
|
|
18
|
+
error.name === 'PngUnavailableError';
|
|
19
|
+
export const isPngManifest = (value) => typeof value === 'object' &&
|
|
20
|
+
value !== null &&
|
|
21
|
+
'version' in value &&
|
|
22
|
+
value.version === 1 &&
|
|
23
|
+
'entries' in value &&
|
|
24
|
+
typeof value.entries === 'object' &&
|
|
25
|
+
value.entries !== null;
|
|
26
|
+
//# sourceMappingURL=png_manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png_manifest.js","sourceRoot":"","sources":["../../src/model/png_manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,MAAM,CAAC,MAAM,uBAAuB,GAClC,+DAA+D,CAAC;AAElE,6EAA6E;AAC7E,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC1B,IAAI,GAAG,qBAAqB,CAAC;IAE/C;QACE,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACjC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAc,EAAW,EAAE,CAC/D,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,MAAM,IAAI,KAAK;IACf,KAAK,CAAC,IAAI,KAAK,qBAAqB,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE,CACpE,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,SAAS,IAAI,KAAK;IAClB,KAAK,CAAC,OAAO,KAAK,CAAC;IACnB,SAAS,IAAI,KAAK;IAClB,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;IACjC,KAAK,CAAC,OAAO,KAAK,IAAI,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 { StudioTheme } from '../config';\n\n/** One prerendered PNG, with where it came from for debugging. */\nexport interface PngManifestEntry {\n /** Relative to the manifest. */\n file: string;\n primitive: string;\n example: string;\n theme: StudioTheme;\n}\n\n/** `png/manifest.json` in a static build, keyed by `compositionKey`. */\nexport interface PngManifest {\n version: 1;\n entries: Record<string, PngManifestEntry>;\n}\n\nexport const PNG_UNAVAILABLE_MESSAGE =\n 'PNG previews of edited compositions need `isomer-studio dev`.';\n\n/** A static build has no PNG for this composition. Identify it by `name`. */\nexport class PngUnavailableError extends Error {\n override readonly name = 'PngUnavailableError';\n\n constructor() {\n super(PNG_UNAVAILABLE_MESSAGE);\n }\n}\n\nexport const isPngUnavailableError = (error: unknown): boolean =>\n typeof error === 'object' &&\n error !== null &&\n 'name' in error &&\n error.name === 'PngUnavailableError';\n\nexport const isPngManifest = (value: unknown): value is PngManifest =>\n typeof value === 'object' &&\n value !== null &&\n 'version' in value &&\n value.version === 1 &&\n 'entries' in value &&\n typeof value.entries === 'object' &&\n value.entries !== null;\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PrimitiveExample, PrimitiveNode } from '@elastic/isomer-sdk';
|
|
2
|
+
/** One example as the Studio lists it. */
|
|
3
|
+
export interface StudioExample {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
node: PrimitiveNode;
|
|
7
|
+
}
|
|
8
|
+
/** A definition's examples, labeling a bare node by the short values that tell it apart from the others. */
|
|
9
|
+
export declare const readExamples: (definition: {
|
|
10
|
+
examples: readonly (PrimitiveNode | PrimitiveExample)[];
|
|
11
|
+
}) => StudioExample[];
|
|
12
|
+
//# sourceMappingURL=read_examples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_examples.d.ts","sourceRoot":"","sources":["../../src/model/read_examples.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG3E,0CAA0C;AAC1C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC;CACrB;AAyCD,4GAA4G;AAC5G,eAAO,MAAM,YAAY,GAAI,YAAY;IACvC,QAAQ,EAAE,SAAS,CAAC,aAAa,GAAG,gBAAgB,CAAC,EAAE,CAAC;CACzD,KAAG,aAAa,EAWhB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { primitiveExamples } from '@elastic/isomer-sdk';
|
|
8
|
+
const IDENTIFIER = /^[\w-]{1,24}$/;
|
|
9
|
+
/** Keys whose short, identifier-like string values differ between examples, such as `tone`. */
|
|
10
|
+
const distinguishingKeys = (nodes) => {
|
|
11
|
+
const values = new Map();
|
|
12
|
+
nodes.forEach((node) => Object.entries(node).forEach(([key, value]) => {
|
|
13
|
+
if (key === 'type' ||
|
|
14
|
+
key === 'id' ||
|
|
15
|
+
typeof value !== 'string' ||
|
|
16
|
+
!IDENTIFIER.test(value)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
values.set(key, (values.get(key) ?? new Set()).add(value));
|
|
20
|
+
}));
|
|
21
|
+
return [...values].filter(([, seen]) => seen.size > 1).map(([key]) => key);
|
|
22
|
+
};
|
|
23
|
+
const labelFor = (node, index, keys) => {
|
|
24
|
+
const fields = new Map(Object.entries(node));
|
|
25
|
+
const parts = keys.flatMap((key) => {
|
|
26
|
+
const value = fields.get(key);
|
|
27
|
+
return typeof value === 'string' ? [`${key}: ${value}`] : [];
|
|
28
|
+
});
|
|
29
|
+
return parts.length
|
|
30
|
+
? `Example ${index + 1} (${parts.join(', ')})`
|
|
31
|
+
: `Example ${index + 1}`;
|
|
32
|
+
};
|
|
33
|
+
/** A definition's examples, labeling a bare node by the short values that tell it apart from the others. */
|
|
34
|
+
export const readExamples = (definition) => {
|
|
35
|
+
const examples = primitiveExamples(definition);
|
|
36
|
+
const keys = distinguishingKeys(examples.filter(({ name }) => name === undefined).map(({ node }) => node));
|
|
37
|
+
return examples.map(({ name, description, node }, index) => ({
|
|
38
|
+
name: name ?? labelFor(node, index, keys),
|
|
39
|
+
...(description === undefined ? {} : { description }),
|
|
40
|
+
node,
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=read_examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_examples.js","sourceRoot":"","sources":["../../src/model/read_examples.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AASxD,MAAM,UAAU,GAAG,eAAe,CAAC;AAEnC,+FAA+F;AAC/F,MAAM,kBAAkB,GAAG,CAAC,KAA+B,EAAY,EAAE;IACvE,MAAM,M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AAC,CAAC;IAEH,OAAO,KAAK,CAAC,MAAM;QACjB,CAAC,CAAC,WAAW,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QAC9C,CAAC,CAAC,WAAW,KAAK,GAAG,CAAC,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,4GAA4G;AAC5G,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAE5B,EAAmB,EAAE;IACpB,MAAM,QAAQ,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,kBAAkB,CAC7B,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAC1E,CAAC;IAEF,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3D,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC;QACzC,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;QACrD,IAAI;KACL,CAAC,CAAC,CAAC;AACN,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 { PrimitiveExample, PrimitiveNode } from '@elastic/isomer-sdk';\nimport { primitiveExamples } from '@elastic/isomer-sdk';\n\n/** One example as the Studio lists it. */\nexport interface StudioExample {\n name: string;\n description?: string;\n node: PrimitiveNode;\n}\n\nconst IDENTIFIER = /^[\\w-]{1,24}$/;\n\n/** Keys whose short, identifier-like string values differ between examples, such as `tone`. */\nconst distinguishingKeys = (nodes: readonly PrimitiveNode[]): string[] => {\n const values = new Map<string, Set<string>>();\n\n nodes.forEach((node) =>\n Object.entries(node).forEach(([key, value]) => {\n if (\n key === 'type' ||\n key === 'id' ||\n typeof value !== 'string' ||\n !IDENTIFIER.test(value)\n ) {\n return;\n }\n values.set(key, (values.get(key) ?? new Set()).add(value));\n })\n );\n\n return [...values].filter(([, seen]) => seen.size > 1).map(([key]) => key);\n};\n\nconst labelFor = (\n node: PrimitiveNode,\n index: number,\n keys: readonly string[]\n): string => {\n const fields = new Map<string, unknown>(Object.entries(node));\n const parts = keys.flatMap((key) => {\n const value = fields.get(key);\n return typeof value === 'string' ? [`${key}: ${value}`] : [];\n });\n\n return parts.length\n ? `Example ${index + 1} (${parts.join(', ')})`\n : `Example ${index + 1}`;\n};\n\n/** A definition's examples, labeling a bare node by the short values that tell it apart from the others. */\nexport const readExamples = (definition: {\n examples: readonly (PrimitiveNode | PrimitiveExample)[];\n}): StudioExample[] => {\n const examples = primitiveExamples(definition);\n const keys = distinguishingKeys(\n examples.filter(({ name }) => name === undefined).map(({ node }) => node)\n );\n\n return examples.map(({ name, description, node }, index) => ({\n name: name ?? labelFor(node, index, keys),\n ...(description === undefined ? {} : { description }),\n node,\n }));\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PrimitiveDoc } from './describe_runtime.js';
|
|
2
|
+
/** Primitives matching every word of `query`, those matching by name first. */
|
|
3
|
+
export declare const searchPrimitives: (primitives: readonly PrimitiveDoc[], query: string) => PrimitiveDoc[];
|
|
4
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/model/search.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,GAC3B,YAAY,SAAS,YAAY,EAAE,EACnC,OAAO,MAAM,KACZ,YAAY,EAsBd,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
/** Primitives matching every word of `query`, those matching by name first. */
|
|
8
|
+
export const searchPrimitives = (primitives, query) => {
|
|
9
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
10
|
+
if (!words.length) {
|
|
11
|
+
return [...primitives];
|
|
12
|
+
}
|
|
13
|
+
const scored = primitives.flatMap((doc) => {
|
|
14
|
+
const { type, label, purpose, useWhen, avoidWhen } = doc;
|
|
15
|
+
const name = `${type} ${label}`.toLowerCase();
|
|
16
|
+
const text = [name, purpose, ...useWhen, ...avoidWhen]
|
|
17
|
+
.join(' ')
|
|
18
|
+
.toLowerCase();
|
|
19
|
+
if (!words.every((word) => text.includes(word))) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return [{ doc, byName: words.every((word) => name.includes(word)) }];
|
|
23
|
+
});
|
|
24
|
+
return [
|
|
25
|
+
...scored.filter(({ byName }) => byName),
|
|
26
|
+
...scored.filter(({ byName }) => !byName),
|
|
27
|
+
].map(({ doc }) => doc);
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/model/search.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,UAAmC,EACnC,KAAa,EACG,EAAE;IAClB,MAAM,KAAK,GAAG,KAAK,CAAC,WAA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\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 { PrimitiveDoc } from './describe_runtime';\n\n/** Primitives matching every word of `query`, those matching by name first. */\nexport const searchPrimitives = (\n primitives: readonly PrimitiveDoc[],\n query: string\n): PrimitiveDoc[] => {\n const words = query.toLowerCase().split(/\\s+/).filter(Boolean);\n if (!words.length) {\n return [...primitives];\n }\n\n const scored = primitives.flatMap((doc) => {\n const { type, label, purpose, useWhen, avoidWhen } = doc;\n const name = `${type} ${label}`.toLowerCase();\n const text = [name, purpose, ...useWhen, ...avoidWhen]\n .join(' ')\n .toLowerCase();\n if (!words.every((word) => text.includes(word))) {\n return [];\n }\n return [{ doc, byName: words.every((word) => name.includes(word)) }];\n });\n\n return [\n ...scored.filter(({ byName }) => byName),\n ...scored.filter(({ byName }) => !byName),\n ].map(({ doc }) => doc);\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["../../src/model/sha256.ts"],"names":[],"mappings":"AAwBA,sFAAsF;AACtF,eAAO,MAAM,SAAS,GAAI,OAAO,UAAU,KAAG,MAyD7C,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
const K = Uint32Array.from([
|
|
8
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
|
|
9
|
+
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
|
10
|
+
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
|
|
11
|
+
0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
12
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
|
|
13
|
+
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
|
14
|
+
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
|
|
15
|
+
0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
16
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
|
|
17
|
+
0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
|
18
|
+
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
19
|
+
]);
|
|
20
|
+
const rotr = (value, bits) => (value >>> bits) | (value << (32 - bits));
|
|
21
|
+
/** The SHA-256 of `bytes`, as hex; `crypto.subtle` is missing on insecure origins. */
|
|
22
|
+
export const sha256Hex = (bytes) => {
|
|
23
|
+
const padded = new Uint8Array((((bytes.length + 8) >> 6) + 1) << 6);
|
|
24
|
+
padded.set(bytes);
|
|
25
|
+
padded[bytes.length] = 0x80;
|
|
26
|
+
const view = new DataView(padded.buffer);
|
|
27
|
+
const bits = bytes.length * 8;
|
|
28
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 2 ** 32));
|
|
29
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
30
|
+
const hash = Uint32Array.from([
|
|
31
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c,
|
|
32
|
+
0x1f83d9ab, 0x5be0cd19,
|
|
33
|
+
]);
|
|
34
|
+
const w = new Uint32Array(64);
|
|
35
|
+
for (let offset = 0; offset < padded.length; offset += 64) {
|
|
36
|
+
for (let i = 0; i < 16; i++) {
|
|
37
|
+
w[i] = view.getUint32(offset + i * 4);
|
|
38
|
+
}
|
|
39
|
+
for (let i = 16; i < 64; i++) {
|
|
40
|
+
const a = w[i - 15] ?? 0;
|
|
41
|
+
const b = w[i - 2] ?? 0;
|
|
42
|
+
const s0 = rotr(a, 7) ^ rotr(a, 18) ^ (a >>> 3);
|
|
43
|
+
const s1 = rotr(b, 17) ^ rotr(b, 19) ^ (b >>> 10);
|
|
44
|
+
w[i] = (w[i - 16] ?? 0) + s0 + (w[i - 7] ?? 0) + s1;
|
|
45
|
+
}
|
|
46
|
+
let [a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0] = hash;
|
|
47
|
+
for (let i = 0; i < 64; i++) {
|
|
48
|
+
const t1 = (h +
|
|
49
|
+
(rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) +
|
|
50
|
+
((e & f) ^ (~e & g)) +
|
|
51
|
+
(K[i] ?? 0) +
|
|
52
|
+
(w[i] ?? 0)) >>>
|
|
53
|
+
0;
|
|
54
|
+
const t2 = ((rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) +
|
|
55
|
+
((a & b) ^ (a & c) ^ (b & c))) >>>
|
|
56
|
+
0;
|
|
57
|
+
h = g;
|
|
58
|
+
g = f;
|
|
59
|
+
f = e;
|
|
60
|
+
e = (d + t1) >>> 0;
|
|
61
|
+
d = c;
|
|
62
|
+
c = b;
|
|
63
|
+
b = a;
|
|
64
|
+
a = (t1 + t2) >>> 0;
|
|
65
|
+
}
|
|
66
|
+
[a, b, c, d, e, f, g, h].forEach((value, i) => {
|
|
67
|
+
hash[i] = (hash[i] ?? 0) + value;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return Array.from(hash, (word) => word.toString(16).padStart(8, '0')).join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AAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CACxE,EAAE,CACH,CAAC;AACJ,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\nconst K = Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,\n 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,\n 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,\n 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\nconst rotr = (value: number, bits: number): number =>\n (value >>> bits) | (value << (32 - bits));\n\n/** The SHA-256 of `bytes`, as hex; `crypto.subtle` is missing on insecure origins. */\nexport const sha256Hex = (bytes: Uint8Array): string => {\n const padded = new Uint8Array((((bytes.length + 8) >> 6) + 1) << 6);\n padded.set(bytes);\n padded[bytes.length] = 0x80;\n const view = new DataView(padded.buffer);\n const bits = bytes.length * 8;\n view.setUint32(padded.length - 8, Math.floor(bits / 2 ** 32));\n view.setUint32(padded.length - 4, bits >>> 0);\n\n const hash = Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c,\n 0x1f83d9ab, 0x5be0cd19,\n ]);\n const w = new Uint32Array(64);\n\n for (let offset = 0; offset < padded.length; offset += 64) {\n for (let i = 0; i < 16; i++) {\n w[i] = view.getUint32(offset + i * 4);\n }\n for (let i = 16; i < 64; i++) {\n const a = w[i - 15] ?? 0;\n const b = w[i - 2] ?? 0;\n const s0 = rotr(a, 7) ^ rotr(a, 18) ^ (a >>> 3);\n const s1 = rotr(b, 17) ^ rotr(b, 19) ^ (b >>> 10);\n w[i] = (w[i - 16] ?? 0) + s0 + (w[i - 7] ?? 0) + s1;\n }\n\n let [a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0] = hash;\n for (let i = 0; i < 64; i++) {\n const t1 =\n (h +\n (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) +\n ((e & f) ^ (~e & g)) +\n (K[i] ?? 0) +\n (w[i] ?? 0)) >>>\n 0;\n const t2 =\n ((rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) +\n ((a & b) ^ (a & c) ^ (b & c))) >>>\n 0;\n h = g;\n g = f;\n f = e;\n e = (d + t1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) >>> 0;\n }\n [a, b, c, d, e, f, g, h].forEach((value, i) => {\n hash[i] = (hash[i] ?? 0) + value;\n });\n }\n\n return Array.from(hash, (word) => word.toString(16).padStart(8, '0')).join(\n ''\n );\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SlackBlock } from '@elastic/isomer-sdk/slack';
|
|
2
|
+
/** One note per block type Isomer does not model: the envelope passed those blocks through unfitted, and {@link slackLimitProblems} cannot check them. */
|
|
3
|
+
export declare const unmodeledSlackNotes: (blocks: readonly SlackBlock[]) => string[];
|
|
4
|
+
/** Where a rendered Slack message breaks `SLACK_LIMITS`; empty when Slack would accept it. */
|
|
5
|
+
export declare const slackLimitProblems: ({ text, blocks, }: {
|
|
6
|
+
text: string;
|
|
7
|
+
blocks: readonly SlackBlock[];
|
|
8
|
+
}) => string[];
|
|
9
|
+
//# sourceMappingURL=slack_limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slack_limits.d.ts","sourceRoot":"","sources":["../../src/model/slack_limits.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,UAAU,EAOX,MAAM,2BAA2B,CAAC;AA+YnC,0JAA0J;AAC1J,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,UAAU,EAAE,KAAG,MAAM,EAUvE,CAAC;AAEJ,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,GAAI,mBAGhC;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;CAC/B,KAAG,MAAM,EAaT,CAAC"}
|