@elastic/isomer-sdk 0.0.0 → 0.2.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 +1861 -0
- package/README.md +69 -0
- package/THIRD_PARTY_LICENSES.md +957 -0
- package/dist/author/authored_fields.d.ts +153 -0
- package/dist/author/authored_fields.d.ts.map +1 -0
- package/dist/author/authored_fields.js +227 -0
- package/dist/author/authored_fields.js.map +1 -0
- package/dist/author/authoring_input.d.ts +7 -0
- package/dist/author/authoring_input.d.ts.map +1 -0
- package/dist/author/authoring_input.js +60 -0
- package/dist/author/authoring_input.js.map +1 -0
- package/dist/author/authoring_model.d.ts +27 -0
- package/dist/author/authoring_model.d.ts.map +1 -0
- package/dist/author/authoring_model.js +98 -0
- package/dist/author/authoring_model.js.map +1 -0
- package/dist/author/declarations.d.ts +13 -0
- package/dist/author/declarations.d.ts.map +1 -0
- package/dist/author/declarations.js +277 -0
- package/dist/author/declarations.js.map +1 -0
- package/dist/author/index.d.ts +7 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +12 -0
- package/dist/author/index.js.map +1 -0
- package/dist/author/jsx.d.ts +21 -0
- package/dist/author/jsx.d.ts.map +1 -0
- package/dist/author/jsx.js +20 -0
- package/dist/author/jsx.js.map +1 -0
- package/dist/author/jsx_shim.d.ts +117 -0
- package/dist/author/jsx_shim.d.ts.map +1 -0
- package/dist/author/jsx_shim.js +270 -0
- package/dist/author/jsx_shim.js.map +1 -0
- package/dist/author/prompt.d.ts +58 -0
- package/dist/author/prompt.d.ts.map +1 -0
- package/dist/author/prompt.js +148 -0
- package/dist/author/prompt.js.map +1 -0
- package/dist/author/schema_to_typescript.d.ts +37 -0
- package/dist/author/schema_to_typescript.d.ts.map +1 -0
- package/dist/author/schema_to_typescript.js +286 -0
- package/dist/author/schema_to_typescript.js.map +1 -0
- package/dist/cjs/author/authored_fields.js +233 -0
- package/dist/cjs/author/authored_fields.js.map +1 -0
- package/dist/cjs/author/authoring_input.js +64 -0
- package/dist/cjs/author/authoring_input.js.map +1 -0
- package/dist/cjs/author/authoring_model.js +104 -0
- package/dist/cjs/author/authoring_model.js.map +1 -0
- package/dist/cjs/author/declarations.js +281 -0
- package/dist/cjs/author/declarations.js.map +1 -0
- package/dist/cjs/author/index.js +25 -0
- package/dist/cjs/author/index.js.map +1 -0
- package/dist/cjs/author/jsx.js +24 -0
- package/dist/cjs/author/jsx.js.map +1 -0
- package/dist/cjs/author/jsx_shim.js +276 -0
- package/dist/cjs/author/jsx_shim.js.map +1 -0
- package/dist/cjs/author/prompt.js +153 -0
- package/dist/cjs/author/prompt.js.map +1 -0
- package/dist/cjs/author/schema_to_typescript.js +295 -0
- package/dist/cjs/author/schema_to_typescript.js.map +1 -0
- package/dist/cjs/composition/action_event.js +9 -0
- package/dist/cjs/composition/action_event.js.map +1 -0
- package/dist/cjs/composition/body_node_base.js +112 -0
- package/dist/cjs/composition/body_node_base.js.map +1 -0
- package/dist/cjs/composition/composition.js +9 -0
- package/dist/cjs/composition/composition.js.map +1 -0
- package/dist/cjs/composition/error.js +73 -0
- package/dist/cjs/composition/error.js.map +1 -0
- package/dist/cjs/composition/index.js +32 -0
- package/dist/cjs/composition/index.js.map +1 -0
- package/dist/cjs/composition/map_nodes.js +85 -0
- package/dist/cjs/composition/map_nodes.js.map +1 -0
- package/dist/cjs/composition/named_color.js +20 -0
- package/dist/cjs/composition/named_color.js.map +1 -0
- package/dist/cjs/composition/node.js +9 -0
- package/dist/cjs/composition/node.js.map +1 -0
- package/dist/cjs/composition/one_line.js +23 -0
- package/dist/cjs/composition/one_line.js.map +1 -0
- package/dist/cjs/composition/structured_value.js +21 -0
- package/dist/cjs/composition/structured_value.js.map +1 -0
- package/dist/cjs/composition/validation_error.js +40 -0
- package/dist/cjs/composition/validation_error.js.map +1 -0
- package/dist/cjs/define/frame.js +31 -0
- package/dist/cjs/define/frame.js.map +1 -0
- package/dist/cjs/define/index.js +31 -0
- package/dist/cjs/define/index.js.map +1 -0
- package/dist/cjs/define/markdown_content.js +12 -0
- package/dist/cjs/define/markdown_content.js.map +1 -0
- package/dist/cjs/define/primitive_example.js +26 -0
- package/dist/cjs/define/primitive_example.js.map +1 -0
- package/dist/cjs/define/primitive_icon.js +17 -0
- package/dist/cjs/define/primitive_icon.js.map +1 -0
- package/dist/cjs/define/primitive_module.js +118 -0
- package/dist/cjs/define/primitive_module.js.map +1 -0
- package/dist/cjs/define/slack_assets.js +9 -0
- package/dist/cjs/define/slack_assets.js.map +1 -0
- package/dist/cjs/define/slack_blocks.js +9 -0
- package/dist/cjs/define/slack_blocks.js.map +1 -0
- package/dist/cjs/define/zod_format.js +122 -0
- package/dist/cjs/define/zod_format.js.map +1 -0
- package/dist/cjs/define/zod_helpers.js +26 -0
- package/dist/cjs/define/zod_helpers.js.map +1 -0
- package/dist/cjs/entries/html.js +12 -0
- package/dist/cjs/entries/html.js.map +1 -0
- package/dist/cjs/entries/index.js +80 -0
- package/dist/cjs/entries/index.js.map +1 -0
- package/dist/cjs/entries/markdown.js +14 -0
- package/dist/cjs/entries/markdown.js.map +1 -0
- package/dist/cjs/entries/react.js +20 -0
- package/dist/cjs/entries/react.js.map +1 -0
- package/dist/cjs/entries/slack.js +25 -0
- package/dist/cjs/entries/slack.js.map +1 -0
- package/dist/cjs/entries/text.js +12 -0
- package/dist/cjs/entries/text.js.map +1 -0
- package/dist/cjs/pack/capabilities.js +40 -0
- package/dist/cjs/pack/capabilities.js.map +1 -0
- package/dist/cjs/pack/compose.js +59 -0
- package/dist/cjs/pack/compose.js.map +1 -0
- package/dist/cjs/pack/enhancements.js +65 -0
- package/dist/cjs/pack/enhancements.js.map +1 -0
- package/dist/cjs/pack/index.js +18 -0
- package/dist/cjs/pack/index.js.map +1 -0
- package/dist/cjs/pack/primitive_pack.js +97 -0
- package/dist/cjs/pack/primitive_pack.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/render/anchors.js +167 -0
- package/dist/cjs/render/anchors.js.map +1 -0
- package/dist/cjs/render/context_view.js +54 -0
- package/dist/cjs/render/context_view.js.map +1 -0
- package/dist/cjs/render/format_display_value.js +143 -0
- package/dist/cjs/render/format_display_value.js.map +1 -0
- package/dist/cjs/render/format_number.js +46 -0
- package/dist/cjs/render/format_number.js.map +1 -0
- package/dist/cjs/render/html/enhancements.js +30 -0
- package/dist/cjs/render/html/enhancements.js.map +1 -0
- package/dist/cjs/render/html/envelope.js +218 -0
- package/dist/cjs/render/html/envelope.js.map +1 -0
- package/dist/cjs/render/html/index.js +12 -0
- package/dist/cjs/render/html/index.js.map +1 -0
- package/dist/cjs/render/index.js +25 -0
- package/dist/cjs/render/index.js.map +1 -0
- package/dist/cjs/render/layout_check.js +133 -0
- package/dist/cjs/render/layout_check.js.map +1 -0
- package/dist/cjs/render/markdown/builder.js +195 -0
- package/dist/cjs/render/markdown/builder.js.map +1 -0
- package/dist/cjs/render/markdown/envelope.js +33 -0
- package/dist/cjs/render/markdown/envelope.js.map +1 -0
- package/dist/cjs/render/markdown/format.js +208 -0
- package/dist/cjs/render/markdown/format.js.map +1 -0
- package/dist/cjs/render/markdown/index.js +15 -0
- package/dist/cjs/render/markdown/index.js.map +1 -0
- package/dist/cjs/render/measure_dom.js +61 -0
- package/dist/cjs/render/measure_dom.js.map +1 -0
- package/dist/cjs/render/payload.js +13 -0
- package/dist/cjs/render/payload.js.map +1 -0
- package/dist/cjs/render/primitive_dispatch.js +173 -0
- package/dist/cjs/render/primitive_dispatch.js.map +1 -0
- package/dist/cjs/render/react/content.js +44 -0
- package/dist/cjs/render/react/content.js.map +1 -0
- package/dist/cjs/render/react/enhancements.js +32 -0
- package/dist/cjs/render/react/enhancements.js.map +1 -0
- package/dist/cjs/render/react/index.js +15 -0
- package/dist/cjs/render/react/index.js.map +1 -0
- package/dist/cjs/render/slack/assets.js +45 -0
- package/dist/cjs/render/slack/assets.js.map +1 -0
- package/dist/cjs/render/slack/blocks.js +80 -0
- package/dist/cjs/render/slack/blocks.js.map +1 -0
- package/dist/cjs/render/slack/envelope.js +551 -0
- package/dist/cjs/render/slack/envelope.js.map +1 -0
- package/dist/cjs/render/slack/format.js +225 -0
- package/dist/cjs/render/slack/format.js.map +1 -0
- package/dist/cjs/render/slack/index.js +30 -0
- package/dist/cjs/render/slack/index.js.map +1 -0
- package/dist/cjs/render/slack/markdown_content.js +409 -0
- package/dist/cjs/render/slack/markdown_content.js.map +1 -0
- package/dist/cjs/render/text/envelope.js +21 -0
- package/dist/cjs/render/text/envelope.js.map +1 -0
- package/dist/cjs/render/text/index.js +12 -0
- package/dist/cjs/render/text/index.js.map +1 -0
- package/dist/cjs/testing/conformance.js +312 -0
- package/dist/cjs/testing/conformance.js.map +1 -0
- package/dist/cjs/testing/icon.js +248 -0
- package/dist/cjs/testing/icon.js.map +1 -0
- package/dist/cjs/testing/index.js +18 -0
- package/dist/cjs/testing/index.js.map +1 -0
- package/dist/cjs/testing/registration.js +142 -0
- package/dist/cjs/testing/registration.js.map +1 -0
- package/dist/cjs/validate/authoring_schema.js +312 -0
- package/dist/cjs/validate/authoring_schema.js.map +1 -0
- package/dist/cjs/validate/composition_schema.js +135 -0
- package/dist/cjs/validate/composition_schema.js.map +1 -0
- package/dist/cjs/validate/index.js +53 -0
- package/dist/cjs/validate/index.js.map +1 -0
- package/dist/cjs/validate/input_budget.js +156 -0
- package/dist/cjs/validate/input_budget.js.map +1 -0
- package/dist/cjs/validate/json_schema.js +72 -0
- package/dist/cjs/validate/json_schema.js.map +1 -0
- package/dist/cjs/validate/node_issues.js +65 -0
- package/dist/cjs/validate/node_issues.js.map +1 -0
- package/dist/cjs/validate/url.js +116 -0
- package/dist/cjs/validate/url.js.map +1 -0
- package/dist/cjs/validate/validation.js +165 -0
- package/dist/cjs/validate/validation.js.map +1 -0
- package/dist/cjs/validate/value_schemas.js +53 -0
- package/dist/cjs/validate/value_schemas.js.map +1 -0
- package/dist/composition/action_event.d.ts +13 -0
- package/dist/composition/action_event.d.ts.map +1 -0
- package/dist/composition/action_event.js +8 -0
- package/dist/composition/action_event.js.map +1 -0
- package/dist/composition/body_node_base.d.ts +72 -0
- package/dist/composition/body_node_base.d.ts.map +1 -0
- package/dist/composition/body_node_base.js +104 -0
- package/dist/composition/body_node_base.js.map +1 -0
- package/dist/composition/composition.d.ts +71 -0
- package/dist/composition/composition.d.ts.map +1 -0
- package/dist/composition/composition.js +8 -0
- package/dist/composition/composition.js.map +1 -0
- package/dist/composition/error.d.ts +61 -0
- package/dist/composition/error.d.ts.map +1 -0
- package/dist/composition/error.js +69 -0
- package/dist/composition/error.js.map +1 -0
- package/dist/composition/index.d.ts +11 -0
- package/dist/composition/index.d.ts.map +1 -0
- package/dist/composition/index.js +14 -0
- package/dist/composition/index.js.map +1 -0
- package/dist/composition/map_nodes.d.ts +16 -0
- package/dist/composition/map_nodes.d.ts.map +1 -0
- package/dist/composition/map_nodes.js +81 -0
- package/dist/composition/map_nodes.js.map +1 -0
- package/dist/composition/named_color.d.ts +9 -0
- package/dist/composition/named_color.d.ts.map +1 -0
- package/dist/composition/named_color.js +17 -0
- package/dist/composition/named_color.js.map +1 -0
- package/dist/composition/node.d.ts +11 -0
- package/dist/composition/node.d.ts.map +1 -0
- package/dist/composition/node.js +8 -0
- package/dist/composition/node.js.map +1 -0
- package/dist/composition/one_line.d.ts +7 -0
- package/dist/composition/one_line.d.ts.map +1 -0
- package/dist/composition/one_line.js +17 -0
- package/dist/composition/one_line.js.map +1 -0
- package/dist/composition/structured_value.d.ts +27 -0
- package/dist/composition/structured_value.d.ts.map +1 -0
- package/dist/composition/structured_value.js +18 -0
- package/dist/composition/structured_value.js.map +1 -0
- package/dist/composition/validation_error.d.ts +33 -0
- package/dist/composition/validation_error.d.ts.map +1 -0
- package/dist/composition/validation_error.js +35 -0
- package/dist/composition/validation_error.js.map +1 -0
- package/dist/define/frame.d.ts +155 -0
- package/dist/define/frame.d.ts.map +1 -0
- package/dist/define/frame.js +27 -0
- package/dist/define/frame.js.map +1 -0
- package/dist/define/index.d.ts +10 -0
- package/dist/define/index.d.ts.map +1 -0
- package/dist/define/index.js +13 -0
- package/dist/define/index.js.map +1 -0
- package/dist/define/markdown_content.d.ts +15 -0
- package/dist/define/markdown_content.d.ts.map +1 -0
- package/dist/define/markdown_content.js +9 -0
- package/dist/define/markdown_content.js.map +1 -0
- package/dist/define/primitive_example.d.ts +30 -0
- package/dist/define/primitive_example.d.ts.map +1 -0
- package/dist/define/primitive_example.js +21 -0
- package/dist/define/primitive_example.js.map +1 -0
- package/dist/define/primitive_icon.d.ts +11 -0
- package/dist/define/primitive_icon.d.ts.map +1 -0
- package/dist/define/primitive_icon.js +14 -0
- package/dist/define/primitive_icon.js.map +1 -0
- package/dist/define/primitive_module.d.ts +435 -0
- package/dist/define/primitive_module.d.ts.map +1 -0
- package/dist/define/primitive_module.js +112 -0
- package/dist/define/primitive_module.js.map +1 -0
- package/dist/define/slack_assets.d.ts +28 -0
- package/dist/define/slack_assets.d.ts.map +1 -0
- package/dist/define/slack_assets.js +8 -0
- package/dist/define/slack_assets.js.map +1 -0
- package/dist/define/slack_blocks.d.ts +234 -0
- package/dist/define/slack_blocks.d.ts.map +1 -0
- package/dist/define/slack_blocks.js +8 -0
- package/dist/define/slack_blocks.js.map +1 -0
- package/dist/define/zod_format.d.ts +33 -0
- package/dist/define/zod_format.d.ts.map +1 -0
- package/dist/define/zod_format.js +114 -0
- package/dist/define/zod_format.js.map +1 -0
- package/dist/define/zod_helpers.d.ts +10 -0
- package/dist/define/zod_helpers.d.ts.map +1 -0
- package/dist/define/zod_helpers.js +22 -0
- package/dist/define/zod_helpers.js.map +1 -0
- package/dist/entries/html.d.ts +3 -0
- package/dist/entries/html.d.ts.map +1 -0
- package/dist/entries/html.js +8 -0
- package/dist/entries/html.js.map +1 -0
- package/dist/entries/index.d.ts +6 -0
- package/dist/entries/index.d.ts.map +1 -0
- package/dist/entries/index.js +12 -0
- package/dist/entries/index.js.map +1 -0
- package/dist/entries/markdown.d.ts +3 -0
- package/dist/entries/markdown.d.ts.map +1 -0
- package/dist/entries/markdown.js +8 -0
- package/dist/entries/markdown.js.map +1 -0
- package/dist/entries/react.d.ts +5 -0
- package/dist/entries/react.d.ts.map +1 -0
- package/dist/entries/react.js +11 -0
- package/dist/entries/react.js.map +1 -0
- package/dist/entries/slack.d.ts +2 -0
- package/dist/entries/slack.d.ts.map +1 -0
- package/dist/entries/slack.js +8 -0
- package/dist/entries/slack.js.map +1 -0
- package/dist/entries/text.d.ts +2 -0
- package/dist/entries/text.d.ts.map +1 -0
- package/dist/entries/text.js +8 -0
- package/dist/entries/text.js.map +1 -0
- package/dist/pack/capabilities.d.ts +41 -0
- package/dist/pack/capabilities.d.ts.map +1 -0
- package/dist/pack/capabilities.js +36 -0
- package/dist/pack/capabilities.js.map +1 -0
- package/dist/pack/compose.d.ts +24 -0
- package/dist/pack/compose.d.ts.map +1 -0
- package/dist/pack/compose.js +55 -0
- package/dist/pack/compose.js.map +1 -0
- package/dist/pack/enhancements.d.ts +65 -0
- package/dist/pack/enhancements.d.ts.map +1 -0
- package/dist/pack/enhancements.js +59 -0
- package/dist/pack/enhancements.js.map +1 -0
- package/dist/pack/index.d.ts +5 -0
- package/dist/pack/index.d.ts.map +1 -0
- package/dist/pack/index.js +11 -0
- package/dist/pack/index.js.map +1 -0
- package/dist/pack/primitive_pack.d.ts +164 -0
- package/dist/pack/primitive_pack.d.ts.map +1 -0
- package/dist/pack/primitive_pack.js +92 -0
- package/dist/pack/primitive_pack.js.map +1 -0
- package/dist/render/anchors.d.ts +82 -0
- package/dist/render/anchors.d.ts.map +1 -0
- package/dist/render/anchors.js +153 -0
- package/dist/render/anchors.js.map +1 -0
- package/dist/render/context_view.d.ts +10 -0
- package/dist/render/context_view.d.ts.map +1 -0
- package/dist/render/context_view.js +49 -0
- package/dist/render/context_view.js.map +1 -0
- package/dist/render/format_display_value.d.ts +20 -0
- package/dist/render/format_display_value.d.ts.map +1 -0
- package/dist/render/format_display_value.js +137 -0
- package/dist/render/format_display_value.js.map +1 -0
- package/dist/render/format_number.d.ts +9 -0
- package/dist/render/format_number.d.ts.map +1 -0
- package/dist/render/format_number.js +42 -0
- package/dist/render/format_number.js.map +1 -0
- package/dist/render/html/enhancements.d.ts +10 -0
- package/dist/render/html/enhancements.d.ts.map +1 -0
- package/dist/render/html/enhancements.js +25 -0
- package/dist/render/html/enhancements.js.map +1 -0
- package/dist/render/html/envelope.d.ts +182 -0
- package/dist/render/html/envelope.d.ts.map +1 -0
- package/dist/render/html/envelope.js +214 -0
- package/dist/render/html/envelope.js.map +1 -0
- package/dist/render/html/index.d.ts +3 -0
- package/dist/render/html/index.d.ts.map +1 -0
- package/dist/render/html/index.js +8 -0
- package/dist/render/html/index.js.map +1 -0
- package/dist/render/index.d.ts +6 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +11 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/layout_check.d.ts +43 -0
- package/dist/render/layout_check.d.ts.map +1 -0
- package/dist/render/layout_check.js +129 -0
- package/dist/render/layout_check.js.map +1 -0
- package/dist/render/markdown/builder.d.ts +46 -0
- package/dist/render/markdown/builder.d.ts.map +1 -0
- package/dist/render/markdown/builder.js +190 -0
- package/dist/render/markdown/builder.js.map +1 -0
- package/dist/render/markdown/envelope.d.ts +20 -0
- package/dist/render/markdown/envelope.d.ts.map +1 -0
- package/dist/render/markdown/envelope.js +29 -0
- package/dist/render/markdown/envelope.js.map +1 -0
- package/dist/render/markdown/format.d.ts +10 -0
- package/dist/render/markdown/format.d.ts.map +1 -0
- package/dist/render/markdown/format.js +202 -0
- package/dist/render/markdown/format.js.map +1 -0
- package/dist/render/markdown/index.d.ts +3 -0
- package/dist/render/markdown/index.d.ts.map +1 -0
- package/dist/render/markdown/index.js +9 -0
- package/dist/render/markdown/index.js.map +1 -0
- package/dist/render/measure_dom.d.ts +10 -0
- package/dist/render/measure_dom.d.ts.map +1 -0
- package/dist/render/measure_dom.js +57 -0
- package/dist/render/measure_dom.js.map +1 -0
- package/dist/render/payload.d.ts +16 -0
- package/dist/render/payload.d.ts.map +1 -0
- package/dist/render/payload.js +9 -0
- package/dist/render/payload.js.map +1 -0
- package/dist/render/primitive_dispatch.d.ts +72 -0
- package/dist/render/primitive_dispatch.d.ts.map +1 -0
- package/dist/render/primitive_dispatch.js +169 -0
- package/dist/render/primitive_dispatch.js.map +1 -0
- package/dist/render/react/content.d.ts +40 -0
- package/dist/render/react/content.d.ts.map +1 -0
- package/dist/render/react/content.js +39 -0
- package/dist/render/react/content.js.map +1 -0
- package/dist/render/react/enhancements.d.ts +15 -0
- package/dist/render/react/enhancements.d.ts.map +1 -0
- package/dist/render/react/enhancements.js +28 -0
- package/dist/render/react/enhancements.js.map +1 -0
- package/dist/render/react/index.d.ts +3 -0
- package/dist/render/react/index.d.ts.map +1 -0
- package/dist/render/react/index.js +9 -0
- package/dist/render/react/index.js.map +1 -0
- package/dist/render/slack/assets.d.ts +16 -0
- package/dist/render/slack/assets.d.ts.map +1 -0
- package/dist/render/slack/assets.js +40 -0
- package/dist/render/slack/assets.js.map +1 -0
- package/dist/render/slack/blocks.d.ts +72 -0
- package/dist/render/slack/blocks.d.ts.map +1 -0
- package/dist/render/slack/blocks.js +77 -0
- package/dist/render/slack/blocks.js.map +1 -0
- package/dist/render/slack/envelope.d.ts +52 -0
- package/dist/render/slack/envelope.d.ts.map +1 -0
- package/dist/render/slack/envelope.js +547 -0
- package/dist/render/slack/envelope.js.map +1 -0
- package/dist/render/slack/format.d.ts +70 -0
- package/dist/render/slack/format.d.ts.map +1 -0
- package/dist/render/slack/format.js +209 -0
- package/dist/render/slack/format.js.map +1 -0
- package/dist/render/slack/index.d.ts +6 -0
- package/dist/render/slack/index.d.ts.map +1 -0
- package/dist/render/slack/index.js +12 -0
- package/dist/render/slack/index.js.map +1 -0
- package/dist/render/slack/markdown_content.d.ts +17 -0
- package/dist/render/slack/markdown_content.d.ts.map +1 -0
- package/dist/render/slack/markdown_content.js +404 -0
- package/dist/render/slack/markdown_content.js.map +1 -0
- package/dist/render/text/envelope.d.ts +15 -0
- package/dist/render/text/envelope.d.ts.map +1 -0
- package/dist/render/text/envelope.js +17 -0
- package/dist/render/text/envelope.js.map +1 -0
- package/dist/render/text/index.d.ts +2 -0
- package/dist/render/text/index.d.ts.map +1 -0
- package/dist/render/text/index.js +8 -0
- package/dist/render/text/index.js.map +1 -0
- package/dist/testing/conformance.d.ts +145 -0
- package/dist/testing/conformance.d.ts.map +1 -0
- package/dist/testing/conformance.js +303 -0
- package/dist/testing/conformance.js.map +1 -0
- package/dist/testing/icon.d.ts +11 -0
- package/dist/testing/icon.d.ts.map +1 -0
- package/dist/testing/icon.js +244 -0
- package/dist/testing/icon.js.map +1 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +10 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/registration.d.ts +32 -0
- package/dist/testing/registration.d.ts.map +1 -0
- package/dist/testing/registration.js +105 -0
- package/dist/testing/registration.js.map +1 -0
- package/dist/validate/authoring_schema.d.ts +33 -0
- package/dist/validate/authoring_schema.d.ts.map +1 -0
- package/dist/validate/authoring_schema.js +306 -0
- package/dist/validate/authoring_schema.js.map +1 -0
- package/dist/validate/composition_schema.d.ts +80 -0
- package/dist/validate/composition_schema.d.ts.map +1 -0
- package/dist/validate/composition_schema.js +127 -0
- package/dist/validate/composition_schema.js.map +1 -0
- package/dist/validate/index.d.ts +9 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/dist/validate/index.js +15 -0
- package/dist/validate/index.js.map +1 -0
- package/dist/validate/input_budget.d.ts +35 -0
- package/dist/validate/input_budget.d.ts.map +1 -0
- package/dist/validate/input_budget.js +151 -0
- package/dist/validate/input_budget.js.map +1 -0
- package/dist/validate/json_schema.d.ts +32 -0
- package/dist/validate/json_schema.d.ts.map +1 -0
- package/dist/validate/json_schema.js +68 -0
- package/dist/validate/json_schema.js.map +1 -0
- package/dist/validate/node_issues.d.ts +12 -0
- package/dist/validate/node_issues.d.ts.map +1 -0
- package/dist/validate/node_issues.js +61 -0
- package/dist/validate/node_issues.js.map +1 -0
- package/dist/validate/url.d.ts +50 -0
- package/dist/validate/url.d.ts.map +1 -0
- package/dist/validate/url.js +107 -0
- package/dist/validate/url.js.map +1 -0
- package/dist/validate/validation.d.ts +95 -0
- package/dist/validate/validation.d.ts.map +1 -0
- package/dist/validate/validation.js +157 -0
- package/dist/validate/validation.js.map +1 -0
- package/dist/validate/value_schemas.d.ts +53 -0
- package/dist/validate/value_schemas.d.ts.map +1 -0
- package/dist/validate/value_schemas.js +50 -0
- package/dist/validate/value_schemas.js.map +1 -0
- package/package.json +119 -5
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { ChildNodeWalker } from '../composition/body_node_base.js';
|
|
2
|
+
import type { Composition } from '../composition/composition.js';
|
|
3
|
+
import type { ValidationError } from '../composition/validation_error.js';
|
|
4
|
+
import type { AnyPrimitiveDefinition, PrimitiveNode } from '../define/primitive_module.js';
|
|
5
|
+
import type { HTMLRenderResult } from '../render/html/envelope.js';
|
|
6
|
+
import type { SlackBlock } from '../render/slack/blocks.js';
|
|
7
|
+
import type { ValidationResult } from '../validate/validation.js';
|
|
8
|
+
/**
|
|
9
|
+
* The foreign node {@link PrimitiveConformanceHarness.nestForeignChild}
|
|
10
|
+
* hands a container must render text/markdown containing this string, or the
|
|
11
|
+
* cross-pack nesting case cannot tell a dropped child from an empty one.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CONFORMANCE_FOREIGN_MARKER = "isomerConformanceForeign";
|
|
14
|
+
/** One example node, paired with the definition that published it. */
|
|
15
|
+
export interface PrimitiveConformanceExample {
|
|
16
|
+
readonly definition: AnyPrimitiveDefinition;
|
|
17
|
+
/** Always `definition.type`, lifted onto the row so `it.each` titles can read it. */
|
|
18
|
+
readonly type: string;
|
|
19
|
+
/** Index into {@link AnyPrimitiveDefinition.examples}, and half of the preview hint a failure prints. */
|
|
20
|
+
readonly exampleIndex: number;
|
|
21
|
+
/** The example's `name`, absent for a bare node. */
|
|
22
|
+
readonly exampleName?: string;
|
|
23
|
+
readonly node: PrimitiveNode;
|
|
24
|
+
}
|
|
25
|
+
/** The subset of a host's HTML render options the cases exercise. */
|
|
26
|
+
export interface PrimitiveConformanceHtmlOptions {
|
|
27
|
+
/** `'separate'` must move the stylesheet out of the markup and into `css`; the CSS cases assert against that field. */
|
|
28
|
+
readonly css?: 'inline' | 'separate';
|
|
29
|
+
/** `'readable'` must emit human-legible class names, which the CSS coverage case matches back against the emitted selectors. */
|
|
30
|
+
readonly names?: string;
|
|
31
|
+
/** Must render node anchors, as the `anchors` HTML render option does. */
|
|
32
|
+
readonly anchors?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** The subset of a host's `snapshot` render result the cases assert on. */
|
|
35
|
+
export interface PrimitiveConformanceSnapshotResult {
|
|
36
|
+
/** Must be empty for every published example. */
|
|
37
|
+
readonly validationErrors: readonly ValidationError[];
|
|
38
|
+
/** The frame's markup, stylesheet included or not. */
|
|
39
|
+
readonly html: string;
|
|
40
|
+
/** `total` is the rendered byte size, and must be positive. */
|
|
41
|
+
readonly measurement: {
|
|
42
|
+
readonly total: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** The subset of a host's Slack render result the cases assert on. */
|
|
46
|
+
export interface PrimitiveConformanceSlackResult {
|
|
47
|
+
readonly blocks: readonly SlackBlock[];
|
|
48
|
+
/** Notification fallback text. Must be non-empty. */
|
|
49
|
+
readonly text: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Pack-owned render and validation bindings. The cases cannot import a
|
|
53
|
+
* vocabulary package, so the pack closes over its dispatcher, frame, and
|
|
54
|
+
* theme when it builds this object.
|
|
55
|
+
*
|
|
56
|
+
* Unsuffixed members take a single node; the `Composition`-suffixed ones take
|
|
57
|
+
* a whole {@link Composition}. Optional members gate the cases that need
|
|
58
|
+
* them, so a pack supplies only what its surfaces can answer.
|
|
59
|
+
*/
|
|
60
|
+
export interface PrimitiveConformanceHarness {
|
|
61
|
+
/**
|
|
62
|
+
* The smallest composition that carries one node. Its `title` must be
|
|
63
|
+
* `'Conformance fixture'`, which the envelope cases look for as
|
|
64
|
+
* `CONFORMANCE FIXTURE` in text and `# Conformance fixture` in markdown.
|
|
65
|
+
*/
|
|
66
|
+
wrapComposition(node: PrimitiveNode): Composition;
|
|
67
|
+
/** Validation errors for the node on its own. Must be empty for every published example. */
|
|
68
|
+
validateNode(node: PrimitiveNode): readonly ValidationError[];
|
|
69
|
+
/** Whole-composition validation. Must be `valid` with no `errors` for a wrapped example. */
|
|
70
|
+
validateComposition(composition: Composition): ValidationResult;
|
|
71
|
+
/** Must return something other than `undefined`; the case does not mount the element. */
|
|
72
|
+
renderReact(node: PrimitiveNode): unknown;
|
|
73
|
+
/** Drives the pack's style collection for one node. Must not throw. */
|
|
74
|
+
collectStyles(node: PrimitiveNode): void;
|
|
75
|
+
/** Must return a string with non-whitespace content. */
|
|
76
|
+
renderText(node: PrimitiveNode): string;
|
|
77
|
+
/** Must return a string with non-whitespace content. */
|
|
78
|
+
renderMarkdown(node: PrimitiveNode): string;
|
|
79
|
+
/** Must return at least one block, each an object with a string `type`. */
|
|
80
|
+
renderSlack(node: PrimitiveNode): readonly SlackBlock[];
|
|
81
|
+
/** `key` is unique per example and only has to survive into the React tree. Must not throw. Omit for a pack with no `snapshot` path. */
|
|
82
|
+
renderSnapshot?(node: PrimitiveNode, key: string): unknown;
|
|
83
|
+
/** Must be finite and greater than zero, so a frame can lay the node out unrendered. Omit for a pack with no `snapshot` path. */
|
|
84
|
+
estimateSnapshotHeight?(node: PrimitiveNode): number;
|
|
85
|
+
/**
|
|
86
|
+
* Set `false` for a pack whose frame is a fixed size, so its primitives are
|
|
87
|
+
* not required to report a positive `metrics.snapshotHeight`. Skips the
|
|
88
|
+
* positive-finite height assertion.
|
|
89
|
+
*/
|
|
90
|
+
sizesFromNodeHeights?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* For a container example, returns `container` with one of its children
|
|
93
|
+
* replaced by a node from a pack the harness composed in only for this
|
|
94
|
+
* check — never one `container`'s own pack registers. That node's `text`
|
|
95
|
+
* and `markdown` renderers must emit {@link CONFORMANCE_FOREIGN_MARKER}.
|
|
96
|
+
* Omit to skip the cross-pack nesting case.
|
|
97
|
+
*/
|
|
98
|
+
nestForeignChild?(container: PrimitiveNode): PrimitiveNode;
|
|
99
|
+
/**
|
|
100
|
+
* Must honor {@link PrimitiveConformanceHtmlOptions}. Cases assert the
|
|
101
|
+
* markup wraps the body in a `<section>`, that `measurement.js` is zero, and
|
|
102
|
+
* that `validationErrors` is empty. Omit to skip the HTML cases.
|
|
103
|
+
*/
|
|
104
|
+
renderHTML?(composition: Composition, options?: PrimitiveConformanceHtmlOptions): HTMLRenderResult;
|
|
105
|
+
/**
|
|
106
|
+
* The child walker over every definition the harness renders with. Set it
|
|
107
|
+
* once every `react` renderer spreads `nodeAnchor` on its root; the anchor
|
|
108
|
+
* case then asserts each node renders one.
|
|
109
|
+
*/
|
|
110
|
+
anchorWalk?: ChildNodeWalker;
|
|
111
|
+
/** Must throw when `css` references a `var(--name)` it never declares. Omit to skip the CSS variable case. */
|
|
112
|
+
assertVarRefsHaveDeclarations?(css: string): void;
|
|
113
|
+
/** Whole-composition text render, title envelope included. */
|
|
114
|
+
renderTextComposition(composition: Composition): string;
|
|
115
|
+
/** Whole-composition markdown render, title heading included. */
|
|
116
|
+
renderMarkdownComposition(composition: Composition): string;
|
|
117
|
+
/** Must lead with a `plain_text` header block carrying the composition title. */
|
|
118
|
+
renderSlackComposition(composition: Composition): PrimitiveConformanceSlackResult;
|
|
119
|
+
/** Must resolve to non-empty markup with no validation errors. Omit for a pack with no frame. */
|
|
120
|
+
renderSnapshotComposition?(composition: Composition): Promise<PrimitiveConformanceSnapshotResult>;
|
|
121
|
+
}
|
|
122
|
+
/** One assertion, run once per example. */
|
|
123
|
+
export interface PrimitiveConformanceCase {
|
|
124
|
+
readonly name: string;
|
|
125
|
+
/** Signals failure by throwing. May be async, so a pack must await it. */
|
|
126
|
+
readonly run: (example: PrimitiveConformanceExample, harness: PrimitiveConformanceHarness) => void | Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
/** Every definition's examples, flattened to one row each. */
|
|
129
|
+
export declare const examplesFromDefinitions: (definitions: readonly AnyPrimitiveDefinition[]) => readonly PrimitiveConformanceExample[];
|
|
130
|
+
/** Every example crossed with every case, shaped for `it.each`. */
|
|
131
|
+
export declare const primitiveConformanceRows: (definitions: readonly AnyPrimitiveDefinition[]) => readonly (PrimitiveConformanceExample & PrimitiveConformanceCase)[];
|
|
132
|
+
/**
|
|
133
|
+
* Asserts the inventory itself holds up: the pack has examples, every
|
|
134
|
+
* definition contributes one, `catalog.name` and example names are non-empty,
|
|
135
|
+
* example names are unique within their definition, each example's `type` matches its definition, and
|
|
136
|
+
* `catalog.example` is within the input budget and parses or matches a
|
|
137
|
+
* published example.
|
|
138
|
+
*/
|
|
139
|
+
export declare const runPrimitiveInventoryConformance: (definitions: readonly AnyPrimitiveDefinition[]) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Every assertion a primitive owes its callers, for a pack to drive with
|
|
142
|
+
* `it.each`.
|
|
143
|
+
*/
|
|
144
|
+
export declare const primitiveConformanceCases: readonly PrimitiveConformanceCase[];
|
|
145
|
+
//# sourceMappingURL=conformance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../src/testing/conformance.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,4BA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AqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC;IACxD,iEAAiE;IACjE,yBAAyB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC;IAC5D,iFAAiF;IACjF,sBAAsB,CACpB,WAAW,EAAE,WAAW,GACvB,+BAA+B,CAAC;IACnC,iGAAiG;IACjG,yBAAyB,CAAC,CACxB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,kCAAkC,CAAC,CAAC;CAChD;AAED,2CAA2C;AAC3C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,QAAQ,CAAC,GAAG,EAAE,CACZ,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,2BAA2B,KACjC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,GAClC,aAAa,SAAS,sBAAsB,EAAE,KAC7C,SAAS,2BAA2B,EASpC,CAAC;AAEJ,mEAAmE;AACnE,eAAO,MAAM,wBAAwB,GACnC,aAAa,SAAS,sBAAsB,EAAE,KAC7C,SAAS,CAAC,2BAA2B,GAAG,wBAAwB,CAAC,EAMjE,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,GAC3C,aAAa,SAAS,sBAAsB,EAAE,KAC7C,IAsDF,CAAC;AAqCF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,wBAAwB,EA4NxE,CAAC"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
// The behaviour every primitive definition owes its callers, expressed once.
|
|
8
|
+
//
|
|
9
|
+
// Framework-agnostic on purpose: only `node:assert/strict` and Node builtins,
|
|
10
|
+
// so this ships on a public entry without dragging vitest into a vocabulary
|
|
11
|
+
// package's dependency set. Each pack drives the array with `it.each`, so a
|
|
12
|
+
// second vocabulary costs one package and one test file.
|
|
13
|
+
import assert from 'node:assert/strict';
|
|
14
|
+
import { exampleNodes, primitiveExamples } from '../define/primitive_example.js';
|
|
15
|
+
import { anchoredNodes, anchorValue, NODE_ANCHOR_ATTRIBUTE, nodeType, } from '../render/anchors.js';
|
|
16
|
+
import { checkInputBudget } from '../validate/input_budget.js';
|
|
17
|
+
/**
|
|
18
|
+
* The foreign node {@link PrimitiveConformanceHarness.nestForeignChild}
|
|
19
|
+
* hands a container must render text/markdown containing this string, or the
|
|
20
|
+
* cross-pack nesting case cannot tell a dropped child from an empty one.
|
|
21
|
+
*/
|
|
22
|
+
export const CONFORMANCE_FOREIGN_MARKER = 'isomerConformanceForeign';
|
|
23
|
+
/** Every definition's examples, flattened to one row each. */
|
|
24
|
+
export const examplesFromDefinitions = (definitions) => definitions.flatMap((definition) => primitiveExamples(definition).map(({ name, node }, exampleIndex) => ({
|
|
25
|
+
definition,
|
|
26
|
+
type: definition.type,
|
|
27
|
+
exampleIndex,
|
|
28
|
+
...(name === undefined ? {} : { exampleName: name }),
|
|
29
|
+
node,
|
|
30
|
+
})));
|
|
31
|
+
/** Every example crossed with every case, shaped for `it.each`. */
|
|
32
|
+
export const primitiveConformanceRows = (definitions) => examplesFromDefinitions(definitions).flatMap((example) => primitiveConformanceCases.map((conformanceCase) => ({
|
|
33
|
+
...example,
|
|
34
|
+
...conformanceCase,
|
|
35
|
+
})));
|
|
36
|
+
/**
|
|
37
|
+
* Asserts the inventory itself holds up: the pack has examples, every
|
|
38
|
+
* definition contributes one, `catalog.name` and example names are non-empty,
|
|
39
|
+
* example names are unique within their definition, each example's `type` matches its definition, and
|
|
40
|
+
* `catalog.example` is within the input budget and parses or matches a
|
|
41
|
+
* published example.
|
|
42
|
+
*/
|
|
43
|
+
export const runPrimitiveInventoryConformance = (definitions) => {
|
|
44
|
+
const examples = examplesFromDefinitions(definitions);
|
|
45
|
+
assert.ok(examples.length > 0, 'expected at least one primitive example');
|
|
46
|
+
for (const definition of definitions) {
|
|
47
|
+
assert.ok(definition.examples.length > 0, `${definition.type} primitive must expose at least one example`);
|
|
48
|
+
const { name: catalogName } = definition.catalog;
|
|
49
|
+
assert.ok(catalogName === undefined || catalogName.trim().length > 0, `${definition.type} catalog.name must be non-empty when present`);
|
|
50
|
+
const names = new Set();
|
|
51
|
+
for (const { name } of primitiveExamples(definition)) {
|
|
52
|
+
if (name === undefined) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
assert.ok(name.trim().length > 0, `${definition.type} example names must be non-empty`);
|
|
56
|
+
assert.ok(!names.has(name), `${definition.type} has two examples named ${JSON.stringify(name)}`);
|
|
57
|
+
names.add(name);
|
|
58
|
+
}
|
|
59
|
+
const checked = checkInputBudget(definition.catalog.example);
|
|
60
|
+
if (!checked.valid) {
|
|
61
|
+
assert.fail(`${definition.type} catalog.example must be within the input budget: ${checked.error.message}`);
|
|
62
|
+
}
|
|
63
|
+
const catalogExample = checked.value;
|
|
64
|
+
const matchesPublished = exampleNodes(definition).some((node) => {
|
|
65
|
+
const published = checkInputBudget(node);
|
|
66
|
+
return (published.valid &&
|
|
67
|
+
JSON.stringify(published.value) === JSON.stringify(catalogExample));
|
|
68
|
+
});
|
|
69
|
+
if (matchesPublished) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const parsed = definition.schema.safeParse(catalogExample);
|
|
73
|
+
assert.ok(parsed.success, `${definition.type} catalog.example must parse against its schema or match a published example`);
|
|
74
|
+
}
|
|
75
|
+
for (const { type, node } of examples) {
|
|
76
|
+
assert.equal(node.type, type);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const previewHint = ({ type, exampleIndex, exampleName, }) => `Failing example: \`${type}\` definition, examples[${exampleIndex}]` +
|
|
80
|
+
`${exampleName === undefined ? '' : ` (${JSON.stringify(exampleName)})`}.`;
|
|
81
|
+
const renderedClassNames = (html) => {
|
|
82
|
+
const classNames = new Set();
|
|
83
|
+
for (const match of html.matchAll(/\bclass="([^"]+)"/g)) {
|
|
84
|
+
match[1]
|
|
85
|
+
.split(/\s+/)
|
|
86
|
+
.filter(Boolean)
|
|
87
|
+
.forEach((className) => classNames.add(className));
|
|
88
|
+
}
|
|
89
|
+
return [...classNames].sort();
|
|
90
|
+
};
|
|
91
|
+
/** The node anchor values in serialized `html`, in document order. */
|
|
92
|
+
const renderedAnchors = (html) => {
|
|
93
|
+
const attribute = new RegExp(`\\s${NODE_ANCHOR_ATTRIBUTE}="([^"]*)"`);
|
|
94
|
+
// Only opening tags: the serializer escapes `<`, `>`, and `"` in text and attribute values.
|
|
95
|
+
return [...html.matchAll(/<[a-zA-Z][^>]*>/g)].flatMap(([tag]) => {
|
|
96
|
+
const [, value] = attribute.exec(tag) ?? [];
|
|
97
|
+
return value === undefined ? [] : [value];
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const cssEscapeClass = (className) => className.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '\\$1');
|
|
101
|
+
const cssHasClassSelector = (css, className) => new RegExp(`\\.${cssEscapeClass(className)}(?![\\w-])`).test(css);
|
|
102
|
+
/**
|
|
103
|
+
* Every assertion a primitive owes its callers, for a pack to drive with
|
|
104
|
+
* `it.each`.
|
|
105
|
+
*/
|
|
106
|
+
export const primitiveConformanceCases = [
|
|
107
|
+
{
|
|
108
|
+
name: 'validates as a primitive node and inside a composition',
|
|
109
|
+
run: (example, harness) => {
|
|
110
|
+
const { node } = example;
|
|
111
|
+
const hint = previewHint(example);
|
|
112
|
+
const primitiveErrors = [...harness.validateNode(node)];
|
|
113
|
+
assert.deepEqual(primitiveErrors, [], hint);
|
|
114
|
+
const result = harness.validateComposition(harness.wrapComposition(node));
|
|
115
|
+
assert.equal(result.valid, true, hint);
|
|
116
|
+
assert.deepEqual(result.errors, [], hint);
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'renders through React without throwing',
|
|
121
|
+
run: ({ node }, harness) => {
|
|
122
|
+
const rendered = harness.renderReact(node);
|
|
123
|
+
assert.notEqual(rendered, undefined);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'collects styles without throwing',
|
|
128
|
+
run: ({ node }, harness) => {
|
|
129
|
+
assert.doesNotThrow(() => harness.collectStyles(node));
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'a container recurses through scope for a node from another pack',
|
|
134
|
+
run: ({ definition, node }, harness) => {
|
|
135
|
+
if (!definition.children || !harness.nestForeignChild) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const nested = harness.nestForeignChild(node);
|
|
139
|
+
assert.notEqual(harness.renderReact(nested), undefined);
|
|
140
|
+
assert.ok(harness.renderText(nested).includes(CONFORMANCE_FOREIGN_MARKER));
|
|
141
|
+
assert.ok(harness.renderMarkdown(nested).includes(CONFORMANCE_FOREIGN_MARKER));
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'renders through plain text with non-empty output',
|
|
146
|
+
run: ({ node }, harness) => {
|
|
147
|
+
const text = harness.renderText(node);
|
|
148
|
+
assert.equal(typeof text, 'string');
|
|
149
|
+
assert.ok(text.trim().length > 0);
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'renders through markdown with non-empty output',
|
|
154
|
+
run: ({ node }, harness) => {
|
|
155
|
+
const markdown = harness.renderMarkdown(node);
|
|
156
|
+
assert.equal(typeof markdown, 'string');
|
|
157
|
+
assert.ok(markdown.trim().length > 0);
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'renders through Slack dispatch returning at least one block',
|
|
162
|
+
run: ({ node }, harness) => {
|
|
163
|
+
const blocks = harness.renderSlack(node);
|
|
164
|
+
assert.ok(blocks.length > 0);
|
|
165
|
+
for (const block of blocks) {
|
|
166
|
+
assert.equal(typeof block, 'object');
|
|
167
|
+
assert.equal(typeof block.type, 'string');
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'renders through snapshot primitive dispatch without throwing',
|
|
173
|
+
run: ({ type, exampleIndex, node }, harness) => {
|
|
174
|
+
if (!harness.renderSnapshot) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
assert.doesNotThrow(() => harness.renderSnapshot?.(node, `conformance-${type}-${exampleIndex}`));
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'reports a positive finite snapshot height estimate',
|
|
182
|
+
run: ({ node }, harness) => {
|
|
183
|
+
if (harness.sizesFromNodeHeights === false ||
|
|
184
|
+
!harness.estimateSnapshotHeight) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const height = harness.estimateSnapshotHeight(node);
|
|
188
|
+
assert.equal(Number.isFinite(height), true);
|
|
189
|
+
assert.ok(height > 0);
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: 'renders through renderHTML wrapped in a minimal composition',
|
|
194
|
+
run: ({ node }, harness) => {
|
|
195
|
+
if (!harness.renderHTML) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const result = harness.renderHTML(harness.wrapComposition(node));
|
|
199
|
+
assert.deepEqual(result.validationErrors, []);
|
|
200
|
+
assert.ok(result.html.includes('<section'));
|
|
201
|
+
assert.equal(result.measurement.js, 0);
|
|
202
|
+
assert.ok(result.measurement.total > 0);
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'renders no node anchors unless asked',
|
|
207
|
+
run: ({ node }, harness) => {
|
|
208
|
+
if (!harness.renderHTML) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const { body } = harness.renderHTML(harness.wrapComposition(node));
|
|
212
|
+
assert.deepEqual(renderedAnchors(body), []);
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'renders a node anchor on every node when asked',
|
|
217
|
+
run: (example, harness) => {
|
|
218
|
+
if (!harness.renderHTML || !harness.anchorWalk) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const composition = harness.wrapComposition(example.node);
|
|
222
|
+
const { body } = harness.renderHTML(composition, { anchors: true });
|
|
223
|
+
const expected = anchoredNodes(composition.body, harness.anchorWalk).flatMap((anchored) => {
|
|
224
|
+
const anchoredType = nodeType(anchored);
|
|
225
|
+
return anchoredType === undefined ? [] : [anchorValue(anchoredType)];
|
|
226
|
+
});
|
|
227
|
+
assert.deepEqual(renderedAnchors(body), expected, `Expected one anchor per node, in walker order. ${previewHint(example)}`);
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'emits CSS where every var(...) reference has a matching declaration',
|
|
232
|
+
run: ({ node }, harness) => {
|
|
233
|
+
if (!harness.renderHTML || !harness.assertVarRefsHaveDeclarations) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const result = harness.renderHTML(harness.wrapComposition(node), {
|
|
237
|
+
css: 'separate',
|
|
238
|
+
});
|
|
239
|
+
harness.assertVarRefsHaveDeclarations(result.css);
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'reaches every rendered readable class in compact CSS collection',
|
|
244
|
+
run: (example, harness) => {
|
|
245
|
+
if (!harness.renderHTML) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const { type, exampleIndex, node } = example;
|
|
249
|
+
const result = harness.renderHTML(harness.wrapComposition(node), {
|
|
250
|
+
css: 'separate',
|
|
251
|
+
names: 'readable',
|
|
252
|
+
});
|
|
253
|
+
const missing = renderedClassNames(result.body).filter((className) => !cssHasClassSelector(result.css, className));
|
|
254
|
+
const hint = `Missing CSS for ${type} example #${exampleIndex}: ` +
|
|
255
|
+
`${missing.join(', ') || '(none)'}. ` +
|
|
256
|
+
previewHint(example);
|
|
257
|
+
assert.deepEqual(missing, [], hint);
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'renders through renderText wrapped in a minimal composition',
|
|
262
|
+
run: ({ node }, harness) => {
|
|
263
|
+
const text = harness.renderTextComposition(harness.wrapComposition(node));
|
|
264
|
+
assert.ok(text.length > 0);
|
|
265
|
+
assert.ok(text.includes('CONFORMANCE FIXTURE'));
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: 'renders through renderMarkdown wrapped in a minimal composition',
|
|
270
|
+
run: ({ node }, harness) => {
|
|
271
|
+
const markdown = harness.renderMarkdownComposition(harness.wrapComposition(node));
|
|
272
|
+
assert.ok(markdown.length > 0);
|
|
273
|
+
assert.ok(markdown.includes('# Conformance fixture'));
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'renders through renderSlack wrapped in a minimal composition',
|
|
278
|
+
run: ({ node }, harness) => {
|
|
279
|
+
const result = harness.renderSlackComposition(harness.wrapComposition(node));
|
|
280
|
+
assert.ok(result.blocks.length > 0);
|
|
281
|
+
assert.ok(result.text.length > 0);
|
|
282
|
+
const first = result.blocks[0];
|
|
283
|
+
assert.ok(first);
|
|
284
|
+
if (first.type !== 'header') {
|
|
285
|
+
assert.fail(`expected a header block, got ${first.type}`);
|
|
286
|
+
}
|
|
287
|
+
assert.equal(first.text.type, 'plain_text');
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: 'renders a snapshot wrapped in a minimal composition',
|
|
292
|
+
run: async ({ node }, harness) => {
|
|
293
|
+
if (!harness.renderSnapshotComposition) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const result = await harness.renderSnapshotComposition(harness.wrapComposition(node));
|
|
297
|
+
assert.deepEqual(result.validationErrors, []);
|
|
298
|
+
assert.ok(result.html.trim().length > 0);
|
|
299
|
+
assert.ok(result.measurement.total > 0);
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
];
|
|
303
|
+
//# sourceMappingURL=conformance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conformance.js","sourceRoot":"","sources":["../../src/testing/conformance.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,4EAA4E;AAC5E,yDAAyD;AAEzD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAKxC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAK9E,OAAO,EACL,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAkIrE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,WAA8C,EACN,EAAE,CAC1C,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CACjC,iBAAiB,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC;IACnE,UAAU;IACV,IAAI,EAAE,UAAU,CAAC,IAAI;IACrB,YAAY;IACZ,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACpD,IAAI;CACL,CAAC,CAAC,CACJ,CAAC;AA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AAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC;gBACvC,OAAO;YACT,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,yBAAyB,CACpD,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAC9B,CAAC;YACF,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YAC9C,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACzC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC;KACF;CACF,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\n// The behaviour every primitive definition owes its callers, expressed once.\n//\n// Framework-agnostic on purpose: only `node:assert/strict` and Node builtins,\n// so this ships on a public entry without dragging vitest into a vocabulary\n// package's dependency set. Each pack drives the array with `it.each`, so a\n// second vocabulary costs one package and one test file.\n\nimport assert from 'node:assert/strict';\n\nimport type { ChildNodeWalker } from '../composition/body_node_base';\nimport type { Composition } from '../composition/composition';\nimport type { ValidationError } from '../composition/validation_error';\nimport { exampleNodes, primitiveExamples } from '../define/primitive_example';\nimport type {\n AnyPrimitiveDefinition,\n PrimitiveNode,\n} from '../define/primitive_module';\nimport {\n anchoredNodes,\n anchorValue,\n NODE_ANCHOR_ATTRIBUTE,\n nodeType,\n} from '../render/anchors';\nimport type { HTMLRenderResult } from '../render/html/envelope';\nimport type { SlackBlock } from '../render/slack/blocks';\nimport { checkInputBudget } from '../validate/input_budget';\nimport type { ValidationResult } from '../validate/validation';\n\n/**\n * The foreign node {@link PrimitiveConformanceHarness.nestForeignChild}\n * hands a container must render text/markdown containing this string, or the\n * cross-pack nesting case cannot tell a dropped child from an empty one.\n */\nexport const CONFORMANCE_FOREIGN_MARKER = 'isomerConformanceForeign';\n\n/** One example node, paired with the definition that published it. */\nexport interface PrimitiveConformanceExample {\n readonly definition: AnyPrimitiveDefinition;\n /** Always `definition.type`, lifted onto the row so `it.each` titles can read it. */\n readonly type: string;\n /** Index into {@link AnyPrimitiveDefinition.examples}, and half of the preview hint a failure prints. */\n readonly exampleIndex: number;\n /** The example's `name`, absent for a bare node. */\n readonly exampleName?: string;\n readonly node: PrimitiveNode;\n}\n\n/** The subset of a host's HTML render options the cases exercise. */\nexport interface PrimitiveConformanceHtmlOptions {\n /** `'separate'` must move the stylesheet out of the markup and into `css`; the CSS cases assert against that field. */\n readonly css?: 'inline' | 'separate';\n /** `'readable'` must emit human-legible class names, which the CSS coverage case matches back against the emitted selectors. */\n readonly names?: string;\n /** Must render node anchors, as the `anchors` HTML render option does. */\n readonly anchors?: boolean;\n}\n\n/** The subset of a host's `snapshot` render result the cases assert on. */\nexport interface PrimitiveConformanceSnapshotResult {\n /** Must be empty for every published example. */\n readonly validationErrors: readonly ValidationError[];\n /** The frame's markup, stylesheet included or not. */\n readonly html: string;\n /** `total` is the rendered byte size, and must be positive. */\n readonly measurement: { readonly total: number };\n}\n\n/** The subset of a host's Slack render result the cases assert on. */\nexport interface PrimitiveConformanceSlackResult {\n readonly blocks: readonly SlackBlock[];\n /** Notification fallback text. Must be non-empty. */\n readonly text: string;\n}\n\n/**\n * Pack-owned render and validation bindings. The cases cannot import a\n * vocabulary package, so the pack closes over its dispatcher, frame, and\n * theme when it builds this object.\n *\n * Unsuffixed members take a single node; the `Composition`-suffixed ones take\n * a whole {@link Composition}. Optional members gate the cases that need\n * them, so a pack supplies only what its surfaces can answer.\n */\nexport interface PrimitiveConformanceHarness {\n /**\n * The smallest composition that carries one node. Its `title` must be\n * `'Conformance fixture'`, which the envelope cases look for as\n * `CONFORMANCE FIXTURE` in text and `# Conformance fixture` in markdown.\n */\n wrapComposition(node: PrimitiveNode): Composition;\n /** Validation errors for the node on its own. Must be empty for every published example. */\n validateNode(node: PrimitiveNode): readonly ValidationError[];\n /** Whole-composition validation. Must be `valid` with no `errors` for a wrapped example. */\n validateComposition(composition: Composition): ValidationResult;\n /** Must return something other than `undefined`; the case does not mount the element. */\n renderReact(node: PrimitiveNode): unknown;\n /** Drives the pack's style collection for one node. Must not throw. */\n collectStyles(node: PrimitiveNode): void;\n /** Must return a string with non-whitespace content. */\n renderText(node: PrimitiveNode): string;\n /** Must return a string with non-whitespace content. */\n renderMarkdown(node: PrimitiveNode): string;\n /** Must return at least one block, each an object with a string `type`. */\n renderSlack(node: PrimitiveNode): readonly SlackBlock[];\n /** `key` is unique per example and only has to survive into the React tree. Must not throw. Omit for a pack with no `snapshot` path. */\n renderSnapshot?(node: PrimitiveNode, key: string): unknown;\n /** Must be finite and greater than zero, so a frame can lay the node out unrendered. Omit for a pack with no `snapshot` path. */\n estimateSnapshotHeight?(node: PrimitiveNode): number;\n /**\n * Set `false` for a pack whose frame is a fixed size, so its primitives are\n * not required to report a positive `metrics.snapshotHeight`. Skips the\n * positive-finite height assertion.\n */\n sizesFromNodeHeights?: boolean;\n /**\n * For a container example, returns `container` with one of its children\n * replaced by a node from a pack the harness composed in only for this\n * check — never one `container`'s own pack registers. That node's `text`\n * and `markdown` renderers must emit {@link CONFORMANCE_FOREIGN_MARKER}.\n * Omit to skip the cross-pack nesting case.\n */\n nestForeignChild?(container: PrimitiveNode): PrimitiveNode;\n /**\n * Must honor {@link PrimitiveConformanceHtmlOptions}. Cases assert the\n * markup wraps the body in a `<section>`, that `measurement.js` is zero, and\n * that `validationErrors` is empty. Omit to skip the HTML cases.\n */\n renderHTML?(\n composition: Composition,\n options?: PrimitiveConformanceHtmlOptions\n ): HTMLRenderResult;\n /**\n * The child walker over every definition the harness renders with. Set it\n * once every `react` renderer spreads `nodeAnchor` on its root; the anchor\n * case then asserts each node renders one.\n */\n anchorWalk?: ChildNodeWalker;\n /** Must throw when `css` references a `var(--name)` it never declares. Omit to skip the CSS variable case. */\n assertVarRefsHaveDeclarations?(css: string): void;\n /** Whole-composition text render, title envelope included. */\n renderTextComposition(composition: Composition): string;\n /** Whole-composition markdown render, title heading included. */\n renderMarkdownComposition(composition: Composition): string;\n /** Must lead with a `plain_text` header block carrying the composition title. */\n renderSlackComposition(\n composition: Composition\n ): PrimitiveConformanceSlackResult;\n /** Must resolve to non-empty markup with no validation errors. Omit for a pack with no frame. */\n renderSnapshotComposition?(\n composition: Composition\n ): Promise<PrimitiveConformanceSnapshotResult>;\n}\n\n/** One assertion, run once per example. */\nexport interface PrimitiveConformanceCase {\n readonly name: string;\n /** Signals failure by throwing. May be async, so a pack must await it. */\n readonly run: (\n example: PrimitiveConformanceExample,\n harness: PrimitiveConformanceHarness\n ) => void | Promise<void>;\n}\n\n/** Every definition's examples, flattened to one row each. */\nexport const examplesFromDefinitions = (\n definitions: readonly AnyPrimitiveDefinition[]\n): readonly PrimitiveConformanceExample[] =>\n definitions.flatMap((definition) =>\n primitiveExamples(definition).map(({ name, node }, exampleIndex) => ({\n definition,\n type: definition.type,\n exampleIndex,\n ...(name === undefined ? {} : { exampleName: name }),\n node,\n }))\n );\n\n/** Every example crossed with every case, shaped for `it.each`. */\nexport const primitiveConformanceRows = (\n definitions: readonly AnyPrimitiveDefinition[]\n): readonly (PrimitiveConformanceExample & PrimitiveConformanceCase)[] =>\n examplesFromDefinitions(definitions).flatMap((example) =>\n primitiveConformanceCases.map((conformanceCase) => ({\n ...example,\n ...conformanceCase,\n }))\n );\n\n/**\n * Asserts the inventory itself holds up: the pack has examples, every\n * definition contributes one, `catalog.name` and example names are non-empty,\n * example names are unique within their definition, each example's `type` matches its definition, and\n * `catalog.example` is within the input budget and parses or matches a\n * published example.\n */\nexport const runPrimitiveInventoryConformance = (\n definitions: readonly AnyPrimitiveDefinition[]\n): void => {\n const examples = examplesFromDefinitions(definitions);\n assert.ok(examples.length > 0, 'expected at least one primitive example');\n for (const definition of definitions) {\n assert.ok(\n definition.examples.length > 0,\n `${definition.type} primitive must expose at least one example`\n );\n const { name: catalogName } = definition.catalog;\n assert.ok(\n catalogName === undefined || catalogName.trim().length > 0,\n `${definition.type} catalog.name must be non-empty when present`\n );\n const names = new Set<string>();\n for (const { name } of primitiveExamples(definition)) {\n if (name === undefined) {\n continue;\n }\n assert.ok(\n name.trim().length > 0,\n `${definition.type} example names must be non-empty`\n );\n assert.ok(\n !names.has(name),\n `${definition.type} has two examples named ${JSON.stringify(name)}`\n );\n names.add(name);\n }\n const checked = checkInputBudget(definition.catalog.example);\n if (!checked.valid) {\n assert.fail(\n `${definition.type} catalog.example must be within the input budget: ${checked.error.message}`\n );\n }\n const catalogExample = checked.value;\n const matchesPublished = exampleNodes(definition).some((node) => {\n const published = checkInputBudget(node);\n return (\n published.valid &&\n JSON.stringify(published.value) === JSON.stringify(catalogExample)\n );\n });\n if (matchesPublished) {\n continue;\n }\n const parsed = definition.schema.safeParse(catalogExample);\n assert.ok(\n parsed.success,\n `${definition.type} catalog.example must parse against its schema or match a published example`\n );\n }\n for (const { type, node } of examples) {\n assert.equal(node.type, type);\n }\n};\n\nconst previewHint = ({\n type,\n exampleIndex,\n exampleName,\n}: PrimitiveConformanceExample): string =>\n `Failing example: \\`${type}\\` definition, examples[${exampleIndex}]` +\n `${exampleName === undefined ? '' : ` (${JSON.stringify(exampleName)})`}.`;\n\nconst renderedClassNames = (html: string): string[] => {\n const classNames = new Set<string>();\n for (const match of html.matchAll(/\\bclass=\"([^\"]+)\"/g)) {\n match[1]!\n .split(/\\s+/)\n .filter(Boolean)\n .forEach((className) => classNames.add(className));\n }\n return [...classNames].sort();\n};\n\n/** The node anchor values in serialized `html`, in document order. */\nconst renderedAnchors = (html: string): string[] => {\n const attribute = new RegExp(`\\\\s${NODE_ANCHOR_ATTRIBUTE}=\"([^\"]*)\"`);\n // Only opening tags: the serializer escapes `<`, `>`, and `\"` in text and attribute values.\n return [...html.matchAll(/<[a-zA-Z][^>]*>/g)].flatMap(([tag]) => {\n const [, value] = attribute.exec(tag) ?? [];\n return value === undefined ? [] : [value];\n });\n};\n\nconst cssEscapeClass = (className: string): string =>\n className.replace(/([!\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~])/g, '\\\\$1');\n\nconst cssHasClassSelector = (css: string, className: string): boolean =>\n new RegExp(`\\\\.${cssEscapeClass(className)}(?![\\\\w-])`).test(css);\n\n/**\n * Every assertion a primitive owes its callers, for a pack to drive with\n * `it.each`.\n */\nexport const primitiveConformanceCases: readonly PrimitiveConformanceCase[] = [\n {\n name: 'validates as a primitive node and inside a composition',\n run: (example, harness) => {\n const { node } = example;\n const hint = previewHint(example);\n const primitiveErrors = [...harness.validateNode(node)];\n assert.deepEqual(primitiveErrors, [], hint);\n const result = harness.validateComposition(harness.wrapComposition(node));\n assert.equal(result.valid, true, hint);\n assert.deepEqual(result.errors, [], hint);\n },\n },\n {\n name: 'renders through React without throwing',\n run: ({ node }, harness) => {\n const rendered = harness.renderReact(node);\n assert.notEqual(rendered, undefined);\n },\n },\n {\n name: 'collects styles without throwing',\n run: ({ node }, harness) => {\n assert.doesNotThrow(() => harness.collectStyles(node));\n },\n },\n {\n name: 'a container recurses through scope for a node from another pack',\n run: ({ definition, node }, harness) => {\n if (!definition.children || !harness.nestForeignChild) {\n return;\n }\n const nested = harness.nestForeignChild(node);\n assert.notEqual(harness.renderReact(nested), undefined);\n assert.ok(\n harness.renderText(nested).includes(CONFORMANCE_FOREIGN_MARKER)\n );\n assert.ok(\n harness.renderMarkdown(nested).includes(CONFORMANCE_FOREIGN_MARKER)\n );\n },\n },\n {\n name: 'renders through plain text with non-empty output',\n run: ({ node }, harness) => {\n const text = harness.renderText(node);\n assert.equal(typeof text, 'string');\n assert.ok(text.trim().length > 0);\n },\n },\n {\n name: 'renders through markdown with non-empty output',\n run: ({ node }, harness) => {\n const markdown = harness.renderMarkdown(node);\n assert.equal(typeof markdown, 'string');\n assert.ok(markdown.trim().length > 0);\n },\n },\n {\n name: 'renders through Slack dispatch returning at least one block',\n run: ({ node }, harness) => {\n const blocks = harness.renderSlack(node);\n assert.ok(blocks.length > 0);\n for (const block of blocks) {\n assert.equal(typeof block, 'object');\n assert.equal(typeof block.type, 'string');\n }\n },\n },\n {\n name: 'renders through snapshot primitive dispatch without throwing',\n run: ({ type, exampleIndex, node }, harness) => {\n if (!harness.renderSnapshot) {\n return;\n }\n assert.doesNotThrow(() =>\n harness.renderSnapshot?.(node, `conformance-${type}-${exampleIndex}`)\n );\n },\n },\n {\n name: 'reports a positive finite snapshot height estimate',\n run: ({ node }, harness) => {\n if (\n harness.sizesFromNodeHeights === false ||\n !harness.estimateSnapshotHeight\n ) {\n return;\n }\n const height = harness.estimateSnapshotHeight(node);\n assert.equal(Number.isFinite(height), true);\n assert.ok(height > 0);\n },\n },\n {\n name: 'renders through renderHTML wrapped in a minimal composition',\n run: ({ node }, harness) => {\n if (!harness.renderHTML) {\n return;\n }\n const result = harness.renderHTML(harness.wrapComposition(node));\n assert.deepEqual(result.validationErrors, []);\n assert.ok(result.html.includes('<section'));\n assert.equal(result.measurement.js, 0);\n assert.ok(result.measurement.total > 0);\n },\n },\n {\n name: 'renders no node anchors unless asked',\n run: ({ node }, harness) => {\n if (!harness.renderHTML) {\n return;\n }\n const { body } = harness.renderHTML(harness.wrapComposition(node));\n assert.deepEqual(renderedAnchors(body), []);\n },\n },\n {\n name: 'renders a node anchor on every node when asked',\n run: (example, harness) => {\n if (!harness.renderHTML || !harness.anchorWalk) {\n return;\n }\n const composition = harness.wrapComposition(example.node);\n const { body } = harness.renderHTML(composition, { anchors: true });\n const expected = anchoredNodes(\n composition.body,\n harness.anchorWalk\n ).flatMap((anchored) => {\n const anchoredType = nodeType(anchored);\n return anchoredType === undefined ? [] : [anchorValue(anchoredType)];\n });\n assert.deepEqual(\n renderedAnchors(body),\n expected,\n `Expected one anchor per node, in walker order. ${previewHint(example)}`\n );\n },\n },\n {\n name: 'emits CSS where every var(...) reference has a matching declaration',\n run: ({ node }, harness) => {\n if (!harness.renderHTML || !harness.assertVarRefsHaveDeclarations) {\n return;\n }\n const result = harness.renderHTML(harness.wrapComposition(node), {\n css: 'separate',\n });\n harness.assertVarRefsHaveDeclarations(result.css);\n },\n },\n {\n name: 'reaches every rendered readable class in compact CSS collection',\n run: (example, harness) => {\n if (!harness.renderHTML) {\n return;\n }\n const { type, exampleIndex, node } = example;\n const result = harness.renderHTML(harness.wrapComposition(node), {\n css: 'separate',\n names: 'readable',\n });\n const missing = renderedClassNames(result.body).filter(\n (className) => !cssHasClassSelector(result.css, className)\n );\n const hint =\n `Missing CSS for ${type} example #${exampleIndex}: ` +\n `${missing.join(', ') || '(none)'}. ` +\n previewHint(example);\n assert.deepEqual(missing, [], hint);\n },\n },\n {\n name: 'renders through renderText wrapped in a minimal composition',\n run: ({ node }, harness) => {\n const text = harness.renderTextComposition(harness.wrapComposition(node));\n assert.ok(text.length > 0);\n assert.ok(text.includes('CONFORMANCE FIXTURE'));\n },\n },\n {\n name: 'renders through renderMarkdown wrapped in a minimal composition',\n run: ({ node }, harness) => {\n const markdown = harness.renderMarkdownComposition(\n harness.wrapComposition(node)\n );\n assert.ok(markdown.length > 0);\n assert.ok(markdown.includes('# Conformance fixture'));\n },\n },\n {\n name: 'renders through renderSlack wrapped in a minimal composition',\n run: ({ node }, harness) => {\n const result = harness.renderSlackComposition(\n harness.wrapComposition(node)\n );\n assert.ok(result.blocks.length > 0);\n assert.ok(result.text.length > 0);\n const first = result.blocks[0];\n assert.ok(first);\n if (first.type !== 'header') {\n assert.fail(`expected a header block, got ${first.type}`);\n }\n assert.equal(first.text.type, 'plain_text');\n },\n },\n {\n name: 'renders a snapshot wrapped in a minimal composition',\n run: async ({ node }, harness) => {\n if (!harness.renderSnapshotComposition) {\n return;\n }\n const result = await harness.renderSnapshotComposition(\n harness.wrapComposition(node)\n );\n assert.deepEqual(result.validationErrors, []);\n assert.ok(result.html.trim().length > 0);\n assert.ok(result.measurement.total > 0);\n },\n },\n];\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type PrimitivePack } from '../pack/primitive_pack.js';
|
|
2
|
+
/**
|
|
3
|
+
* Fails when any icon in `pack` breaks the rules a host relies on to inline it: a single `<svg viewBox="0 0 16 16">` root, allowlisted shape elements and geometry or paint attributes, and paint limited to `none`, `currentColor`, or `var(--isomer-icon-*)` with an optional `currentColor` or hex fallback.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* assertPackIconsValid(slidesPack);
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare const assertPackIconsValid: ({ icons, primitives, }: Pick<PrimitivePack, "icons" | "primitives">) => void;
|
|
11
|
+
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/testing/icon.ts"],"names":[],"mappings":"AASA,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA2PzE;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,wBAGlC,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,YAAY,CAAC,KAAG,IAUhD,CAAC"}
|