@elastic/isomer-sdk 0.2.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/NOTICE.txt +0 -286
- package/THIRD_PARTY_LICENSES.md +1 -885
- package/dist/author/authored_fields.d.ts +37 -12
- package/dist/author/authored_fields.d.ts.map +1 -1
- package/dist/author/authored_fields.js +45 -69
- package/dist/author/authored_fields.js.map +1 -1
- package/dist/author/authoring_input.d.ts.map +1 -1
- package/dist/author/authoring_input.js +12 -6
- package/dist/author/authoring_input.js.map +1 -1
- package/dist/author/authoring_model.d.ts +8 -2
- package/dist/author/authoring_model.d.ts.map +1 -1
- package/dist/author/authoring_model.js +67 -23
- package/dist/author/authoring_model.js.map +1 -1
- package/dist/author/declarations.d.ts.map +1 -1
- package/dist/author/declarations.js +45 -34
- package/dist/author/declarations.js.map +1 -1
- package/dist/author/index.d.ts +2 -1
- package/dist/author/index.d.ts.map +1 -1
- package/dist/author/index.js +2 -1
- package/dist/author/index.js.map +1 -1
- package/dist/author/jsx_shim.d.ts +49 -30
- package/dist/author/jsx_shim.d.ts.map +1 -1
- package/dist/author/jsx_shim.js +131 -40
- package/dist/author/jsx_shim.js.map +1 -1
- package/dist/author/print_jsx.d.ts +19 -0
- package/dist/author/print_jsx.d.ts.map +1 -0
- package/dist/author/print_jsx.js +372 -0
- package/dist/author/print_jsx.js.map +1 -0
- package/dist/author/prompt.d.ts +2 -2
- package/dist/author/prompt.d.ts.map +1 -1
- package/dist/author/prompt.js +7 -2
- package/dist/author/prompt.js.map +1 -1
- package/dist/author/schema_to_typescript.d.ts.map +1 -1
- package/dist/author/schema_to_typescript.js +6 -3
- package/dist/author/schema_to_typescript.js.map +1 -1
- package/dist/cjs/author/authored_fields.js +47 -70
- package/dist/cjs/author/authored_fields.js.map +1 -1
- package/dist/cjs/author/authoring_input.js +12 -6
- package/dist/cjs/author/authoring_input.js.map +1 -1
- package/dist/cjs/author/authoring_model.js +69 -24
- package/dist/cjs/author/authoring_model.js.map +1 -1
- package/dist/cjs/author/declarations.js +44 -33
- package/dist/cjs/author/declarations.js.map +1 -1
- package/dist/cjs/author/index.js +5 -1
- package/dist/cjs/author/index.js.map +1 -1
- package/dist/cjs/author/jsx_shim.js +130 -39
- package/dist/cjs/author/jsx_shim.js.map +1 -1
- package/dist/cjs/author/print_jsx.js +378 -0
- package/dist/cjs/author/print_jsx.js.map +1 -0
- package/dist/cjs/author/prompt.js +7 -2
- package/dist/cjs/author/prompt.js.map +1 -1
- package/dist/cjs/author/schema_to_typescript.js +6 -3
- package/dist/cjs/author/schema_to_typescript.js.map +1 -1
- package/dist/cjs/composition/error.js +2 -0
- package/dist/cjs/composition/error.js.map +1 -1
- package/dist/cjs/composition/structured_value.js.map +1 -1
- package/dist/cjs/define/index.js.map +1 -1
- package/dist/cjs/define/primitive_module.js +10 -4
- package/dist/cjs/define/primitive_module.js.map +1 -1
- package/dist/cjs/define/slack_blocks.js.map +1 -1
- package/dist/cjs/entries/index.js +5 -2
- package/dist/cjs/entries/index.js.map +1 -1
- package/dist/cjs/entries/markdown.js +3 -1
- package/dist/cjs/entries/markdown.js.map +1 -1
- package/dist/cjs/entries/react.js +2 -1
- package/dist/cjs/entries/react.js.map +1 -1
- package/dist/cjs/entries/slack.js +5 -1
- package/dist/cjs/entries/slack.js.map +1 -1
- package/dist/cjs/pack/enhancements.js.map +1 -1
- package/dist/cjs/pack/index.js +2 -1
- package/dist/cjs/pack/index.js.map +1 -1
- package/dist/cjs/pack/primitive_pack.js +14 -4
- package/dist/cjs/pack/primitive_pack.js.map +1 -1
- package/dist/cjs/render/format_number.js +2 -1
- package/dist/cjs/render/format_number.js.map +1 -1
- package/dist/cjs/render/html/envelope.js +12 -6
- package/dist/cjs/render/html/envelope.js.map +1 -1
- package/dist/cjs/render/markdown/blocks.js +82 -0
- package/dist/cjs/render/markdown/blocks.js.map +1 -0
- package/dist/cjs/render/markdown/builder.js +6 -2
- package/dist/cjs/render/markdown/builder.js.map +1 -1
- package/dist/cjs/render/markdown/format.js +46 -24
- package/dist/cjs/render/markdown/format.js.map +1 -1
- package/dist/cjs/render/markdown/host_tags.js +67 -0
- package/dist/cjs/render/markdown/host_tags.js.map +1 -0
- package/dist/cjs/render/markdown/index.js +5 -1
- package/dist/cjs/render/markdown/index.js.map +1 -1
- package/dist/cjs/render/markdown/split.js +325 -0
- package/dist/cjs/render/markdown/split.js.map +1 -0
- package/dist/cjs/render/primitive_dispatch.js +36 -6
- package/dist/cjs/render/primitive_dispatch.js.map +1 -1
- package/dist/cjs/render/react/content.js +3 -1
- package/dist/cjs/render/react/content.js.map +1 -1
- package/dist/cjs/render/react/index.js +3 -1
- package/dist/cjs/render/react/index.js.map +1 -1
- package/dist/cjs/render/react/markdown_content.js +143 -0
- package/dist/cjs/render/react/markdown_content.js.map +1 -0
- package/dist/cjs/render/slack/blocks.js +7 -0
- package/dist/cjs/render/slack/blocks.js.map +1 -1
- package/dist/cjs/render/slack/container.js +62 -0
- package/dist/cjs/render/slack/container.js.map +1 -0
- package/dist/cjs/render/slack/envelope.js +70 -14
- package/dist/cjs/render/slack/envelope.js.map +1 -1
- package/dist/cjs/render/slack/format.js +56 -6
- package/dist/cjs/render/slack/format.js.map +1 -1
- package/dist/cjs/render/slack/index.js +7 -1
- package/dist/cjs/render/slack/index.js.map +1 -1
- package/dist/cjs/render/slack/markdown_content.js +36 -77
- package/dist/cjs/render/slack/markdown_content.js.map +1 -1
- package/dist/cjs/render/slack/unmodeled.js +38 -0
- package/dist/cjs/render/slack/unmodeled.js.map +1 -0
- package/dist/cjs/testing/conformance.js +15 -1
- package/dist/cjs/testing/conformance.js.map +1 -1
- package/dist/cjs/testing/index.js +2 -1
- package/dist/cjs/testing/index.js.map +1 -1
- package/dist/cjs/validate/json_schema.js +10 -3
- package/dist/cjs/validate/json_schema.js.map +1 -1
- package/dist/cjs/validate/url.js +2 -1
- package/dist/cjs/validate/url.js.map +1 -1
- package/dist/composition/error.d.ts +2 -0
- package/dist/composition/error.d.ts.map +1 -1
- package/dist/composition/error.js +2 -0
- package/dist/composition/error.js.map +1 -1
- package/dist/composition/structured_value.d.ts +3 -3
- package/dist/composition/structured_value.d.ts.map +1 -1
- package/dist/composition/structured_value.js.map +1 -1
- package/dist/define/index.d.ts +1 -1
- package/dist/define/index.d.ts.map +1 -1
- package/dist/define/index.js.map +1 -1
- package/dist/define/primitive_module.d.ts +14 -5
- package/dist/define/primitive_module.d.ts.map +1 -1
- package/dist/define/primitive_module.js +10 -4
- package/dist/define/primitive_module.js.map +1 -1
- package/dist/define/slack_blocks.d.ts +31 -1
- package/dist/define/slack_blocks.d.ts.map +1 -1
- package/dist/define/slack_blocks.js.map +1 -1
- package/dist/entries/index.d.ts +2 -2
- package/dist/entries/index.d.ts.map +1 -1
- package/dist/entries/index.js +2 -2
- package/dist/entries/index.js.map +1 -1
- package/dist/entries/markdown.d.ts +1 -1
- package/dist/entries/markdown.d.ts.map +1 -1
- package/dist/entries/markdown.js +1 -1
- package/dist/entries/markdown.js.map +1 -1
- package/dist/entries/react.d.ts +1 -1
- package/dist/entries/react.d.ts.map +1 -1
- package/dist/entries/react.js +1 -1
- package/dist/entries/react.js.map +1 -1
- package/dist/entries/slack.d.ts +1 -1
- package/dist/entries/slack.d.ts.map +1 -1
- package/dist/entries/slack.js +1 -1
- package/dist/entries/slack.js.map +1 -1
- package/dist/pack/enhancements.d.ts +4 -0
- package/dist/pack/enhancements.d.ts.map +1 -1
- package/dist/pack/enhancements.js.map +1 -1
- package/dist/pack/index.d.ts +1 -1
- package/dist/pack/index.d.ts.map +1 -1
- package/dist/pack/index.js +1 -1
- package/dist/pack/index.js.map +1 -1
- package/dist/pack/primitive_pack.d.ts +3 -1
- package/dist/pack/primitive_pack.d.ts.map +1 -1
- package/dist/pack/primitive_pack.js +13 -3
- package/dist/pack/primitive_pack.js.map +1 -1
- package/dist/render/format_number.d.ts.map +1 -1
- package/dist/render/format_number.js +2 -1
- package/dist/render/format_number.js.map +1 -1
- package/dist/render/html/envelope.js +12 -6
- package/dist/render/html/envelope.js.map +1 -1
- package/dist/render/markdown/blocks.d.ts +6 -0
- package/dist/render/markdown/blocks.d.ts.map +1 -0
- package/dist/render/markdown/blocks.js +77 -0
- package/dist/render/markdown/blocks.js.map +1 -0
- package/dist/render/markdown/builder.d.ts +3 -0
- package/dist/render/markdown/builder.d.ts.map +1 -1
- package/dist/render/markdown/builder.js +3 -1
- package/dist/render/markdown/builder.js.map +1 -1
- package/dist/render/markdown/format.d.ts +2 -0
- package/dist/render/markdown/format.d.ts.map +1 -1
- package/dist/render/markdown/format.js +42 -22
- package/dist/render/markdown/format.js.map +1 -1
- package/dist/render/markdown/host_tags.d.ts +14 -0
- package/dist/render/markdown/host_tags.d.ts.map +1 -0
- package/dist/render/markdown/host_tags.js +63 -0
- package/dist/render/markdown/host_tags.js.map +1 -0
- package/dist/render/markdown/index.d.ts +2 -0
- package/dist/render/markdown/index.d.ts.map +1 -1
- package/dist/render/markdown/index.js +2 -0
- package/dist/render/markdown/index.js.map +1 -1
- package/dist/render/markdown/split.d.ts +32 -0
- package/dist/render/markdown/split.d.ts.map +1 -0
- package/dist/render/markdown/split.js +321 -0
- package/dist/render/markdown/split.js.map +1 -0
- package/dist/render/primitive_dispatch.d.ts +4 -2
- package/dist/render/primitive_dispatch.d.ts.map +1 -1
- package/dist/render/primitive_dispatch.js +36 -6
- package/dist/render/primitive_dispatch.js.map +1 -1
- package/dist/render/react/content.d.ts +1 -1
- package/dist/render/react/content.d.ts.map +1 -1
- package/dist/render/react/content.js +3 -1
- package/dist/render/react/content.js.map +1 -1
- package/dist/render/react/index.d.ts +1 -0
- package/dist/render/react/index.d.ts.map +1 -1
- package/dist/render/react/index.js +1 -0
- package/dist/render/react/index.js.map +1 -1
- package/dist/render/react/markdown_content.d.ts +9 -0
- package/dist/render/react/markdown_content.d.ts.map +1 -0
- package/dist/render/react/markdown_content.js +139 -0
- package/dist/render/react/markdown_content.js.map +1 -0
- package/dist/render/slack/blocks.d.ts +8 -1
- package/dist/render/slack/blocks.d.ts.map +1 -1
- package/dist/render/slack/blocks.js +7 -0
- package/dist/render/slack/blocks.js.map +1 -1
- package/dist/render/slack/container.d.ts +25 -0
- package/dist/render/slack/container.d.ts.map +1 -0
- package/dist/render/slack/container.js +55 -0
- package/dist/render/slack/container.js.map +1 -0
- package/dist/render/slack/envelope.d.ts +6 -4
- package/dist/render/slack/envelope.d.ts.map +1 -1
- package/dist/render/slack/envelope.js +71 -15
- package/dist/render/slack/envelope.js.map +1 -1
- package/dist/render/slack/format.d.ts +15 -3
- package/dist/render/slack/format.d.ts.map +1 -1
- package/dist/render/slack/format.js +54 -5
- package/dist/render/slack/format.js.map +1 -1
- package/dist/render/slack/index.d.ts +4 -2
- package/dist/render/slack/index.d.ts.map +1 -1
- package/dist/render/slack/index.js +2 -0
- package/dist/render/slack/index.js.map +1 -1
- package/dist/render/slack/markdown_content.d.ts +3 -2
- package/dist/render/slack/markdown_content.d.ts.map +1 -1
- package/dist/render/slack/markdown_content.js +27 -68
- package/dist/render/slack/markdown_content.js.map +1 -1
- package/dist/render/slack/unmodeled.d.ts +16 -0
- package/dist/render/slack/unmodeled.d.ts.map +1 -0
- package/dist/render/slack/unmodeled.js +32 -0
- package/dist/render/slack/unmodeled.js.map +1 -0
- package/dist/testing/conformance.d.ts +3 -1
- package/dist/testing/conformance.d.ts.map +1 -1
- package/dist/testing/conformance.js +14 -0
- package/dist/testing/conformance.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/validate/json_schema.d.ts.map +1 -1
- package/dist/validate/json_schema.js +10 -3
- package/dist/validate/json_schema.js.map +1 -1
- package/dist/validate/url.d.ts.map +1 -1
- package/dist/validate/url.js +2 -1
- package/dist/validate/url.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack_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AAe,EAAE,kBAAkB,CAAA;CAAE,CACxE,CAAC;AAEJ,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,wBAAwB,GAAG,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack_blocks.js","sourceRoot":"","sources":["../../src/define/slack_blocks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","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// Slack surface output types for SurfaceMap. Not wire format.\n//\n// Message-surface Block Kit only (channel/DM posts). Field names and shapes\n// match Slack's JSON so output can go to `chat.postMessage`. Fields are\n// commented only where this subset departs from the published contract, or\n// where Slack's behavior is not evident from the name.\n//\n// References:\n// https://api.slack.com/reference/block-kit/blocks\n// https://api.slack.com/reference/block-kit/composition-objects\n// https://api.slack.com/reference/block-kit/block-elements\n\nexport interface SlackPlainTextObject {\n type: 'plain_text';\n text: string;\n emoji?: boolean;\n}\n\nexport interface SlackMrkdwnTextObject {\n type: 'mrkdwn';\n text: string;\n /** When true, Slack skips auto-linking URLs, channels, and users. Defaults to false. */\n verbatim?: boolean;\n}\n\nexport type SlackTextObject = SlackPlainTextObject | SlackMrkdwnTextObject;\n\nexport type SlackHeaderLevel = 1 | 2 | 3 | 4;\n\nexport interface SlackHeaderBlock {\n type: 'header';\n block_id?: string;\n text: SlackPlainTextObject;\n /** H1–H4 sizing. Accepted on message, modal, and Home tab surfaces. */\n level?: SlackHeaderLevel;\n}\n\nexport interface SlackSectionBlock {\n type: 'section';\n block_id?: string;\n text?: SlackTextObject;\n fields?: SlackMrkdwnTextObject[];\n accessory?: SlackSectionAccessory;\n}\n\nexport interface SlackDividerBlock {\n type: 'divider';\n block_id?: string;\n}\n\n/**\n * Inline image used inside `context` blocks and as a `section` accessory.\n * Distinct from the block-level {@link SlackImageBlock}.\n */\nexport interface SlackImageElement {\n type: 'image';\n image_url: string;\n alt_text: string;\n}\n\nexport interface SlackContextBlock {\n type: 'context';\n block_id?: string;\n elements: Array<SlackTextObject | SlackImageElement>;\n}\n\nexport interface SlackButtonElement {\n type: 'button';\n text: SlackPlainTextObject;\n url?: string;\n value?: string;\n action_id?: string;\n style?: 'primary' | 'danger';\n}\n\n/**\n * Reference to a file already uploaded to Slack.\n *\n * `id` and `url` are Slack's published fields. `ref` is not: a render cannot\n * upload, so it emits a placeholder the host swaps for Slack's file id once\n * the upload lands. See `SlackAssetCollector`.\n */\nexport interface SlackFileReference {\n id?: string;\n url?: string;\n ref?: string;\n}\n\n/**\n * Block-level image. `image_url` requires a publicly hosted URL; `slack_file`\n * references a file uploaded to Slack first, which is the only VPN-safe path.\n */\nexport interface SlackImageBlock {\n type: 'image';\n block_id?: string;\n alt_text: string;\n image_url?: string;\n slack_file?: SlackFileReference;\n title?: SlackPlainTextObject;\n}\n\n/** `video` block, matching Slack's JSON contract exactly. */\nexport interface SlackVideoBlock {\n type: 'video';\n block_id?: string;\n title: SlackPlainTextObject;\n title_url?: string;\n video_url: string;\n thumbnail_url: string;\n alt_text: string;\n description?: SlackPlainTextObject;\n author_name?: string;\n provider_name?: string;\n provider_icon_url?: string;\n}\n\nexport interface SlackRichTextStyle {\n bold?: boolean;\n italic?: boolean;\n strike?: boolean;\n code?: boolean;\n}\n\nexport interface SlackRichTextText {\n type: 'text';\n text: string;\n style?: SlackRichTextStyle;\n}\n\nexport interface SlackRichTextLink {\n type: 'link';\n url: string;\n text?: string;\n style?: SlackRichTextStyle;\n}\n\nexport type SlackTagColor =\n | 'gray'\n | 'brown'\n | 'purple'\n | 'indigo'\n | 'blue'\n | 'green'\n | 'yellow'\n | 'orange'\n | 'red';\n\nexport interface SlackRichTextTag {\n type: 'tag';\n text: string;\n color?: SlackTagColor;\n style?: SlackRichTextStyle;\n}\n\nexport type SlackRichTextInline =\n SlackRichTextText | SlackRichTextLink | SlackRichTextTag;\n\nexport interface SlackRichTextSection {\n type: 'rich_text_section';\n elements: SlackRichTextInline[];\n}\n\nexport interface SlackRichTextList {\n type: 'rich_text_list';\n style: 'bullet' | 'ordered';\n indent?: number;\n /** Added to an ordered list's first number, which is otherwise 1. */\n offset?: number;\n border?: number;\n elements: SlackRichTextSection[];\n}\n\nexport interface SlackRichTextPreformatted {\n type: 'rich_text_preformatted';\n border?: number;\n elements: SlackRichTextInline[];\n}\n\nexport interface SlackRichTextQuote {\n type: 'rich_text_quote';\n border?: number;\n elements: SlackRichTextInline[];\n}\n\nexport type SlackRichTextBlockElement =\n | SlackRichTextSection\n | SlackRichTextList\n | SlackRichTextPreformatted\n | SlackRichTextQuote;\n\nexport interface SlackRichTextBlock {\n type: 'rich_text';\n block_id?: string;\n elements: SlackRichTextBlockElement[];\n}\n\n/** The option shape shared by every menu, select, checkbox, and radio element. */\nexport interface SlackOptionObject {\n text: SlackTextObject;\n value: string;\n description?: SlackPlainTextObject;\n /** Only honored inside an `overflow` element. */\n url?: string;\n}\n\nexport interface SlackOptionGroup {\n label: SlackPlainTextObject;\n options: SlackOptionObject[];\n}\n\nexport interface SlackOverflowElement {\n type: 'overflow';\n action_id: string;\n options: SlackOptionObject[];\n}\n\nexport interface SlackStaticSelectElement {\n type: 'static_select';\n action_id: string;\n placeholder?: SlackPlainTextObject;\n options?: SlackOptionObject[];\n option_groups?: SlackOptionGroup[];\n initial_option?: SlackOptionObject;\n}\n\nexport interface SlackMultiStaticSelectElement {\n type: 'multi_static_select';\n action_id: string;\n placeholder?: SlackPlainTextObject;\n options: SlackOptionObject[];\n initial_options?: SlackOptionObject[];\n max_selected_items?: number;\n}\n\nexport interface SlackRadioButtonsElement {\n type: 'radio_buttons';\n action_id: string;\n options: SlackOptionObject[];\n initial_option?: SlackOptionObject;\n}\n\nexport interface SlackCheckboxesElement {\n type: 'checkboxes';\n action_id: string;\n options: SlackOptionObject[];\n initial_options?: SlackOptionObject[];\n}\n\n/** Elements Slack permits inside an `actions` block. */\nexport type SlackActionElement =\n | SlackButtonElement\n | SlackOverflowElement\n | SlackStaticSelectElement\n | SlackMultiStaticSelectElement\n | SlackRadioButtonsElement\n | SlackCheckboxesElement;\n\n/** Elements Slack permits as a `section.accessory`. */\nexport type SlackSectionAccessory =\n | SlackButtonElement\n | SlackImageElement\n | SlackOverflowElement\n | SlackStaticSelectElement\n | SlackMultiStaticSelectElement\n | SlackRadioButtonsElement\n | SlackCheckboxesElement;\n\nexport interface SlackActionsBlock {\n type: 'actions';\n block_id?: string;\n elements: SlackActionElement[];\n}\n\n/** A plain table cell. Strings and numbers use this; see {@link SlackTableCell}. */\nexport interface SlackRawTextElement {\n type: 'raw_text';\n text: string;\n}\n\n/**\n * One table cell. Badge and toned values need the `rich_text` form so a `tag`\n * or bold run can sit inside the grid.\n */\nexport type SlackTableCell = SlackRawTextElement | SlackRichTextBlock;\n\n/**\n * Per-column behavior, positional: entry N configures column N.\n *\n * Trailing columns without an entry keep Slack's defaults (left-aligned, no\n * wrapping), and a `null` entry skips a column.\n */\nexport interface SlackTableColumnSetting {\n align?: 'left' | 'center' | 'right';\n is_wrapped?: boolean;\n}\n\n/**\n * Native `table` block, whose first row renders as the header.\n *\n * Cells, rows, and columns are capped by Slack; see `SLACK_LIMITS`.\n * https://docs.slack.dev/reference/block-kit/blocks/table-block\n */\nexport interface SlackTableBlock {\n type: 'table';\n block_id?: string;\n rows: SlackTableCell[][];\n column_settings?: Array<SlackTableColumnSetting | null>;\n}\n\n/**
|
|
1
|
+
{"version":3,"file":"slack_blocks.js","sourceRoot":"","sources":["../../src/define/slack_blocks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","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// Slack surface output types for SurfaceMap. Not wire format.\n//\n// Message-surface Block Kit only (channel/DM posts). Field names and shapes\n// match Slack's JSON so output can go to `chat.postMessage`. Fields are\n// commented only where this subset departs from the published contract, or\n// where Slack's behavior is not evident from the name.\n//\n// References:\n// https://api.slack.com/reference/block-kit/blocks\n// https://api.slack.com/reference/block-kit/composition-objects\n// https://api.slack.com/reference/block-kit/block-elements\n\nexport interface SlackPlainTextObject {\n type: 'plain_text';\n text: string;\n emoji?: boolean;\n}\n\nexport interface SlackMrkdwnTextObject {\n type: 'mrkdwn';\n text: string;\n /** When true, Slack skips auto-linking URLs, channels, and users. Defaults to false. */\n verbatim?: boolean;\n}\n\nexport type SlackTextObject = SlackPlainTextObject | SlackMrkdwnTextObject;\n\nexport type SlackHeaderLevel = 1 | 2 | 3 | 4;\n\nexport interface SlackHeaderBlock {\n type: 'header';\n block_id?: string;\n text: SlackPlainTextObject;\n /** H1–H4 sizing. Accepted on message, modal, and Home tab surfaces. */\n level?: SlackHeaderLevel;\n}\n\nexport interface SlackSectionBlock {\n type: 'section';\n block_id?: string;\n text?: SlackTextObject;\n fields?: SlackMrkdwnTextObject[];\n accessory?: SlackSectionAccessory;\n}\n\nexport interface SlackDividerBlock {\n type: 'divider';\n block_id?: string;\n}\n\n/**\n * Inline image used inside `context` blocks and as a `section` accessory.\n * Distinct from the block-level {@link SlackImageBlock}.\n */\nexport interface SlackImageElement {\n type: 'image';\n image_url: string;\n alt_text: string;\n}\n\nexport interface SlackContextBlock {\n type: 'context';\n block_id?: string;\n elements: Array<SlackTextObject | SlackImageElement>;\n}\n\nexport interface SlackButtonElement {\n type: 'button';\n text: SlackPlainTextObject;\n url?: string;\n value?: string;\n action_id?: string;\n style?: 'primary' | 'danger';\n}\n\n/**\n * Reference to a file already uploaded to Slack.\n *\n * `id` and `url` are Slack's published fields. `ref` is not: a render cannot\n * upload, so it emits a placeholder the host swaps for Slack's file id once\n * the upload lands. See `SlackAssetCollector`.\n */\nexport interface SlackFileReference {\n id?: string;\n url?: string;\n ref?: string;\n}\n\n/**\n * Block-level image. `image_url` requires a publicly hosted URL; `slack_file`\n * references a file uploaded to Slack first, which is the only VPN-safe path.\n */\nexport interface SlackImageBlock {\n type: 'image';\n block_id?: string;\n alt_text: string;\n image_url?: string;\n slack_file?: SlackFileReference;\n title?: SlackPlainTextObject;\n}\n\n/** `video` block, matching Slack's JSON contract exactly. */\nexport interface SlackVideoBlock {\n type: 'video';\n block_id?: string;\n title: SlackPlainTextObject;\n title_url?: string;\n video_url: string;\n thumbnail_url: string;\n alt_text: string;\n description?: SlackPlainTextObject;\n author_name?: string;\n provider_name?: string;\n provider_icon_url?: string;\n}\n\nexport interface SlackRichTextStyle {\n bold?: boolean;\n italic?: boolean;\n strike?: boolean;\n code?: boolean;\n}\n\nexport interface SlackRichTextText {\n type: 'text';\n text: string;\n style?: SlackRichTextStyle;\n}\n\nexport interface SlackRichTextLink {\n type: 'link';\n url: string;\n text?: string;\n style?: SlackRichTextStyle;\n}\n\nexport type SlackTagColor =\n | 'gray'\n | 'brown'\n | 'purple'\n | 'indigo'\n | 'blue'\n | 'green'\n | 'yellow'\n | 'orange'\n | 'red';\n\nexport interface SlackRichTextTag {\n type: 'tag';\n text: string;\n color?: SlackTagColor;\n style?: SlackRichTextStyle;\n}\n\nexport type SlackRichTextInline =\n SlackRichTextText | SlackRichTextLink | SlackRichTextTag;\n\nexport interface SlackRichTextSection {\n type: 'rich_text_section';\n elements: SlackRichTextInline[];\n}\n\nexport interface SlackRichTextList {\n type: 'rich_text_list';\n style: 'bullet' | 'ordered';\n indent?: number;\n /** Added to an ordered list's first number, which is otherwise 1. */\n offset?: number;\n border?: number;\n elements: SlackRichTextSection[];\n}\n\nexport interface SlackRichTextPreformatted {\n type: 'rich_text_preformatted';\n border?: number;\n elements: SlackRichTextInline[];\n}\n\nexport interface SlackRichTextQuote {\n type: 'rich_text_quote';\n border?: number;\n elements: SlackRichTextInline[];\n}\n\nexport type SlackRichTextBlockElement =\n | SlackRichTextSection\n | SlackRichTextList\n | SlackRichTextPreformatted\n | SlackRichTextQuote;\n\nexport interface SlackRichTextBlock {\n type: 'rich_text';\n block_id?: string;\n elements: SlackRichTextBlockElement[];\n}\n\n/** The option shape shared by every menu, select, checkbox, and radio element. */\nexport interface SlackOptionObject {\n text: SlackTextObject;\n value: string;\n description?: SlackPlainTextObject;\n /** Only honored inside an `overflow` element. */\n url?: string;\n}\n\nexport interface SlackOptionGroup {\n label: SlackPlainTextObject;\n options: SlackOptionObject[];\n}\n\nexport interface SlackOverflowElement {\n type: 'overflow';\n action_id: string;\n options: SlackOptionObject[];\n}\n\nexport interface SlackStaticSelectElement {\n type: 'static_select';\n action_id: string;\n placeholder?: SlackPlainTextObject;\n options?: SlackOptionObject[];\n option_groups?: SlackOptionGroup[];\n initial_option?: SlackOptionObject;\n}\n\nexport interface SlackMultiStaticSelectElement {\n type: 'multi_static_select';\n action_id: string;\n placeholder?: SlackPlainTextObject;\n options: SlackOptionObject[];\n initial_options?: SlackOptionObject[];\n max_selected_items?: number;\n}\n\nexport interface SlackRadioButtonsElement {\n type: 'radio_buttons';\n action_id: string;\n options: SlackOptionObject[];\n initial_option?: SlackOptionObject;\n}\n\nexport interface SlackCheckboxesElement {\n type: 'checkboxes';\n action_id: string;\n options: SlackOptionObject[];\n initial_options?: SlackOptionObject[];\n}\n\n/** Elements Slack permits inside an `actions` block. */\nexport type SlackActionElement =\n | SlackButtonElement\n | SlackOverflowElement\n | SlackStaticSelectElement\n | SlackMultiStaticSelectElement\n | SlackRadioButtonsElement\n | SlackCheckboxesElement;\n\n/** Elements Slack permits as a `section.accessory`. */\nexport type SlackSectionAccessory =\n | SlackButtonElement\n | SlackImageElement\n | SlackOverflowElement\n | SlackStaticSelectElement\n | SlackMultiStaticSelectElement\n | SlackRadioButtonsElement\n | SlackCheckboxesElement;\n\nexport interface SlackActionsBlock {\n type: 'actions';\n block_id?: string;\n elements: SlackActionElement[];\n}\n\n/** A plain table cell. Strings and numbers use this; see {@link SlackTableCell}. */\nexport interface SlackRawTextElement {\n type: 'raw_text';\n text: string;\n}\n\n/**\n * One table cell. Badge and toned values need the `rich_text` form so a `tag`\n * or bold run can sit inside the grid.\n */\nexport type SlackTableCell = SlackRawTextElement | SlackRichTextBlock;\n\n/**\n * Per-column behavior, positional: entry N configures column N.\n *\n * Trailing columns without an entry keep Slack's defaults (left-aligned, no\n * wrapping), and a `null` entry skips a column.\n */\nexport interface SlackTableColumnSetting {\n align?: 'left' | 'center' | 'right';\n is_wrapped?: boolean;\n}\n\n/**\n * Native `table` block, whose first row renders as the header.\n *\n * Cells, rows, and columns are capped by Slack; see `SLACK_LIMITS`.\n * https://docs.slack.dev/reference/block-kit/blocks/table-block\n */\nexport interface SlackTableBlock {\n type: 'table';\n block_id?: string;\n rows: SlackTableCell[][];\n column_settings?: Array<SlackTableColumnSetting | null>;\n}\n\n/** Blocks a {@link SlackContainerBlock} holds. Slack also accepts `file` and `input`, which this subset does not model. */\nexport type SlackContainerChildBlock =\n | SlackHeaderBlock\n | SlackSectionBlock\n | SlackDividerBlock\n | SlackImageBlock\n | SlackVideoBlock\n | SlackContextBlock\n | SlackActionsBlock\n | SlackRichTextBlock\n | SlackTableBlock;\n\ninterface SlackContainerFields {\n type: 'container';\n block_id?: string;\n subtitle?: SlackTextObject;\n icon?: SlackImageElement;\n /** Between 1 and `SLACK_LIMITS.containerChildBlocks`; Slack rejects a nested `container`. */\n child_blocks: SlackContainerChildBlock[];\n width?: 'narrow' | 'standard' | 'wide' | 'full';\n is_collapsible?: boolean;\n /** Only honored when `is_collapsible` is set. */\n default_collapsed?: boolean;\n /** Only honored when the container is not collapsible. */\n has_header_divider?: boolean;\n}\n\n/**\n * Titled group of child blocks, optionally collapsible. Slack shows\n * `rich_text_title` over `title` when both are set.\n *\n * https://docs.slack.dev/reference/block-kit/blocks/container-block\n */\nexport type SlackContainerBlock = SlackContainerFields &\n (\n | { title: SlackPlainTextObject; rich_text_title?: SlackRichTextBlock }\n | { title?: SlackPlainTextObject; rich_text_title: SlackRichTextBlock }\n );\n\n/** Every block this renderer emits, and what a `slack` renderer returns. */\nexport type SlackBlock = SlackContainerChildBlock | SlackContainerBlock;\n"]}
|
package/dist/entries/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { type ActionEventRef, type BodyNodeBase, type ChildNodeRef, type ChildNodeWalker, type Composition, type CompositionMeta, type DisplayValue, type IsomerErrorCode, type NamedColor, type NamedColorPalette, type PrimitiveNode, type RenderTheme, type StructuredValue, type StructuredValueFormat, type SurfaceName, type ValidationError, ALL_NAMED_COLORS, BODY_NODE_SURFACES, ISOMER_ERROR_CODES, STRUCTURED_VALUE_FORMATS, SURFACE_NAMES, CompositionValidationError, createChildNodeWalker, formatValidationError, IsomerError, isVisibleOnSurface, mapCompositionNodes, someBodyNode, } from '../composition/index.js';
|
|
2
2
|
export { type AnyPrimitiveDefinition, type BoundFrame, type DefaultPackTypes, type ExampleNode, type Frame, type FrameBody, type FrameComposition, type FrameDispatcher, type FrameHeader, type FrameViewport, type NormalizedPrimitiveExample, type OptionalSurface, type PackTypes, type PrimitiveCatalogEntry, type PrimitiveChildRef, type PrimitiveDefinition, type PrimitiveExample, type PrimitiveIcon, type PrimitiveMetrics, type PrimitiveRenderContext, type PrimitiveSchema, type PrimitiveStyleCollectionContext, type PrimitiveStyleCollector, type ReactContextArg, type Renderer, type Renderers, type RenderScope, type StyledRenderContext, type StyleHandle, type SurfaceMap, type ThemePair, type ThemeTokenPath, type WithNodeFields, ICON_VARS, OPTIONAL_SURFACES, bindFrame, definePrimitive, definePrimitiveFor, exampleNodes, formatZodIssues, primitiveExamples, requiredString, unresolvedBodyNodeSchema, z, } from '../define/index.js';
|
|
3
|
-
export { type AnyPrimitivePack, type CapabilitySources, type ComposedPacks, type EnhancementDefinition, type HostCapabilities, type PackAuthoringOptions, type PackStyleAdapter, type PrimitiveGroup, type PrimitivePack, type PrimitivePackInput, type SurfaceSupport, composePacks, definePrimitivePack, describeCapabilities, scopeScript, } from '../pack/index.js';
|
|
3
|
+
export { type AnyPrimitivePack, type CapabilitySources, type ComposedPacks, type EnhancementDefinition, type HostCapabilities, type PackAuthoringOptions, type PackStyleAdapter, type PrimitiveGroup, type PrimitivePack, type PrimitivePackInput, type SurfaceSupport, UNCATEGORIZED_GROUP_TITLE, composePacks, definePrimitivePack, describeCapabilities, scopeScript, } from '../pack/index.js';
|
|
4
4
|
export { type FormatDisplayValueOptions, type LayoutBox, type LayoutFinding, type LayoutRect, type PayloadMeasurement, type PrimitiveDispatcher, type PrimitiveDispatcherOptions, LAYOUT_ROOM_ATTRIBUTE, NODE_ANCHOR_ATTRIBUTE, checkLayout, createPrimitiveDispatcher, formatDisplayValue, isStructuredValue, layoutRoom, nodeAnchor, rawDisplayValue, withNodeAnchors, withoutAnchors, } from '../render/index.js';
|
|
5
|
-
export { type AuthoringJsonSchemaOptions, type CheckedComposition, type CheckedValidationResult, type CompositionJsonSchemaOptions, type CompositionSchemaOptions, type CompositionValidatorOptions, type InputBudget, type InputBudgetCheck, type ParsedComposition, type UrlSchemaOptions, type ValidationErrorMode, type ValidationResult, type ValidationWarning, ASSET_URL_MESSAGE, ASSET_URL_RULE, BLOCKED_HREF, MAX_INPUT_CHARACTERS, MAX_INPUT_DEPTH, MAX_INPUT_VALUES, NAVIGATION_HREF_MESSAGE, NAVIGATION_HREF_RULE, assetUrl, authoringSchemaSubset, buildAuthoringJsonSchema, buildCompositionJsonSchema, checkInputBudget, compositionToRender, createCompositionParser, createCompositionValidator, displayValueSchema, getCompositionSchemaForDefinitions, isInputRefusal, namedColorSchema, navigationHref, renderThemeSchema, sanitizeAssetUrl, sanitizeNavigationHref, structuredValueSchema, warningsForSurface, } from '../validate/index.js';
|
|
5
|
+
export { type AuthoringJsonSchemaOptions, type CheckedComposition, type CheckedValidationResult, type CompositionJsonSchemaOptions, type CompositionSchemaOptions, type CompositionValidatorOptions, type InputBudget, type InputBudgetCheck, type ParsedComposition, type UrlSchemaOptions, type ValidationErrorMode, type ValidationResult, type ValidationWarning, ASSET_URL_MESSAGE, ASSET_URL_RULE, BLOCKED_HREF, MAX_INPUT_CHARACTERS, MAX_INPUT_DEPTH, MAX_INPUT_VALUES, NAVIGATION_HREF_MESSAGE, NAVIGATION_HREF_RULE, assetUrl, authoringSchemaSubset, buildAuthoringJsonSchema, buildCompositionJsonSchema, checkInputBudget, compositionToRender, createCompositionParser, createCompositionValidator, displayValueSchema, getCompositionSchemaForDefinitions, isInputRefusal, namedColorSchema, navigationHref, renderThemeSchema, sanitizeAssetUrl, sanitizeNavigationHref, sanitizeParsedAssetUrl, sanitizeParsedNavigationHref, structuredValueSchema, warningsForSurface, } from '../validate/index.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entries/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,eA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,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,kCAAkC,EAClC,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entries/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,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,EACrB,WAAW,EACX,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,kCAAkC,EAClC,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC"}
|
package/dist/entries/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { ALL_NAMED_COLORS, BODY_NODE_SURFACES, ISOMER_ERROR_CODES, STRUCTURED_VALUE_FORMATS, SURFACE_NAMES, CompositionValidationError, createChildNodeWalker, formatValidationError, IsomerError, isVisibleOnSurface, mapCompositionNodes, someBodyNode, } from '../composition/index.js';
|
|
8
8
|
export { ICON_VARS, OPTIONAL_SURFACES, bindFrame, definePrimitive, definePrimitiveFor, exampleNodes, formatZodIssues, primitiveExamples, requiredString, unresolvedBodyNodeSchema, z, } from '../define/index.js';
|
|
9
|
-
export { composePacks, definePrimitivePack, describeCapabilities, scopeScript, } from '../pack/index.js';
|
|
9
|
+
export { UNCATEGORIZED_GROUP_TITLE, composePacks, definePrimitivePack, describeCapabilities, scopeScript, } from '../pack/index.js';
|
|
10
10
|
export { LAYOUT_ROOM_ATTRIBUTE, NODE_ANCHOR_ATTRIBUTE, checkLayout, createPrimitiveDispatcher, formatDisplayValue, isStructuredValue, layoutRoom, nodeAnchor, rawDisplayValue, withNodeAnchors, withoutAnchors, } from '../render/index.js';
|
|
11
|
-
export { ASSET_URL_MESSAGE, ASSET_URL_RULE, BLOCKED_HREF, MAX_INPUT_CHARACTERS, MAX_INPUT_DEPTH, MAX_INPUT_VALUES, NAVIGATION_HREF_MESSAGE, NAVIGATION_HREF_RULE, assetUrl, authoringSchemaSubset, buildAuthoringJsonSchema, buildCompositionJsonSchema, checkInputBudget, compositionToRender, createCompositionParser, createCompositionValidator, displayValueSchema, getCompositionSchemaForDefinitions, isInputRefusal, namedColorSchema, navigationHref, renderThemeSchema, sanitizeAssetUrl, sanitizeNavigationHref, structuredValueSchema, warningsForSurface, } from '../validate/index.js';
|
|
11
|
+
export { ASSET_URL_MESSAGE, ASSET_URL_RULE, BLOCKED_HREF, MAX_INPUT_CHARACTERS, MAX_INPUT_DEPTH, MAX_INPUT_VALUES, NAVIGATION_HREF_MESSAGE, NAVIGATION_HREF_RULE, assetUrl, authoringSchemaSubset, buildAuthoringJsonSchema, buildCompositionJsonSchema, checkInputBudget, compositionToRender, createCompositionParser, createCompositionValidator, displayValueSchema, getCompositionSchemaForDefinitions, isInputRefusal, namedColorSchema, navigationHref, renderThemeSchema, sanitizeAssetUrl, sanitizeNavigationHref, sanitizeParsedAssetUrl, sanitizeParsedNavigationHref, structuredValueSchema, warningsForSurface, } from '../validate/index.js';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entries/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAiBL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAkCL,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,CAAC,GACF,MAAM,WAAW,CAAC;AACnB,OAAO,EAYL,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAQL,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAcL,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,kCAAkC,EAClC,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport {\n type ActionEventRef,\n type BodyNodeBase,\n type ChildNodeRef,\n type ChildNodeWalker,\n type Composition,\n type CompositionMeta,\n type DisplayValue,\n type IsomerErrorCode,\n type NamedColor,\n type NamedColorPalette,\n type PrimitiveNode,\n type RenderTheme,\n type StructuredValue,\n type StructuredValueFormat,\n type SurfaceName,\n type ValidationError,\n ALL_NAMED_COLORS,\n BODY_NODE_SURFACES,\n ISOMER_ERROR_CODES,\n STRUCTURED_VALUE_FORMATS,\n SURFACE_NAMES,\n CompositionValidationError,\n createChildNodeWalker,\n formatValidationError,\n IsomerError,\n isVisibleOnSurface,\n mapCompositionNodes,\n someBodyNode,\n} from '../composition';\nexport {\n type AnyPrimitiveDefinition,\n type BoundFrame,\n type DefaultPackTypes,\n type ExampleNode,\n type Frame,\n type FrameBody,\n type FrameComposition,\n type FrameDispatcher,\n type FrameHeader,\n type FrameViewport,\n type NormalizedPrimitiveExample,\n type OptionalSurface,\n type PackTypes,\n type PrimitiveCatalogEntry,\n type PrimitiveChildRef,\n type PrimitiveDefinition,\n type PrimitiveExample,\n type PrimitiveIcon,\n type PrimitiveMetrics,\n type PrimitiveRenderContext,\n type PrimitiveSchema,\n type PrimitiveStyleCollectionContext,\n type PrimitiveStyleCollector,\n type ReactContextArg,\n type Renderer,\n type Renderers,\n type RenderScope,\n type StyledRenderContext,\n type StyleHandle,\n type SurfaceMap,\n type ThemePair,\n type ThemeTokenPath,\n type WithNodeFields,\n ICON_VARS,\n OPTIONAL_SURFACES,\n bindFrame,\n definePrimitive,\n definePrimitiveFor,\n exampleNodes,\n formatZodIssues,\n primitiveExamples,\n requiredString,\n unresolvedBodyNodeSchema,\n z,\n} from '../define';\nexport {\n type AnyPrimitivePack,\n type CapabilitySources,\n type ComposedPacks,\n type EnhancementDefinition,\n type HostCapabilities,\n type PackAuthoringOptions,\n type PackStyleAdapter,\n type PrimitiveGroup,\n type PrimitivePack,\n type PrimitivePackInput,\n type SurfaceSupport,\n composePacks,\n definePrimitivePack,\n describeCapabilities,\n scopeScript,\n} from '../pack';\nexport {\n type FormatDisplayValueOptions,\n type LayoutBox,\n type LayoutFinding,\n type LayoutRect,\n type PayloadMeasurement,\n type PrimitiveDispatcher,\n type PrimitiveDispatcherOptions,\n LAYOUT_ROOM_ATTRIBUTE,\n NODE_ANCHOR_ATTRIBUTE,\n checkLayout,\n createPrimitiveDispatcher,\n formatDisplayValue,\n isStructuredValue,\n layoutRoom,\n nodeAnchor,\n rawDisplayValue,\n withNodeAnchors,\n withoutAnchors,\n} from '../render';\nexport {\n type AuthoringJsonSchemaOptions,\n type CheckedComposition,\n type CheckedValidationResult,\n type CompositionJsonSchemaOptions,\n type CompositionSchemaOptions,\n type CompositionValidatorOptions,\n type InputBudget,\n type InputBudgetCheck,\n type ParsedComposition,\n type UrlSchemaOptions,\n type ValidationErrorMode,\n type ValidationResult,\n type ValidationWarning,\n ASSET_URL_MESSAGE,\n ASSET_URL_RULE,\n BLOCKED_HREF,\n MAX_INPUT_CHARACTERS,\n MAX_INPUT_DEPTH,\n MAX_INPUT_VALUES,\n NAVIGATION_HREF_MESSAGE,\n NAVIGATION_HREF_RULE,\n assetUrl,\n authoringSchemaSubset,\n buildAuthoringJsonSchema,\n buildCompositionJsonSchema,\n checkInputBudget,\n compositionToRender,\n createCompositionParser,\n createCompositionValidator,\n displayValueSchema,\n getCompositionSchemaForDefinitions,\n isInputRefusal,\n namedColorSchema,\n navigationHref,\n renderThemeSchema,\n sanitizeAssetUrl,\n sanitizeNavigationHref,\n structuredValueSchema,\n warningsForSurface,\n} from '../validate';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entries/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAiBL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAkCL,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,CAAC,GACF,MAAM,WAAW,CAAC;AACnB,OAAO,EAYL,yBAAyB,EACzB,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAQL,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAcL,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,kCAAkC,EAClC,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport {\n type ActionEventRef,\n type BodyNodeBase,\n type ChildNodeRef,\n type ChildNodeWalker,\n type Composition,\n type CompositionMeta,\n type DisplayValue,\n type IsomerErrorCode,\n type NamedColor,\n type NamedColorPalette,\n type PrimitiveNode,\n type RenderTheme,\n type StructuredValue,\n type StructuredValueFormat,\n type SurfaceName,\n type ValidationError,\n ALL_NAMED_COLORS,\n BODY_NODE_SURFACES,\n ISOMER_ERROR_CODES,\n STRUCTURED_VALUE_FORMATS,\n SURFACE_NAMES,\n CompositionValidationError,\n createChildNodeWalker,\n formatValidationError,\n IsomerError,\n isVisibleOnSurface,\n mapCompositionNodes,\n someBodyNode,\n} from '../composition';\nexport {\n type AnyPrimitiveDefinition,\n type BoundFrame,\n type DefaultPackTypes,\n type ExampleNode,\n type Frame,\n type FrameBody,\n type FrameComposition,\n type FrameDispatcher,\n type FrameHeader,\n type FrameViewport,\n type NormalizedPrimitiveExample,\n type OptionalSurface,\n type PackTypes,\n type PrimitiveCatalogEntry,\n type PrimitiveChildRef,\n type PrimitiveDefinition,\n type PrimitiveExample,\n type PrimitiveIcon,\n type PrimitiveMetrics,\n type PrimitiveRenderContext,\n type PrimitiveSchema,\n type PrimitiveStyleCollectionContext,\n type PrimitiveStyleCollector,\n type ReactContextArg,\n type Renderer,\n type Renderers,\n type RenderScope,\n type StyledRenderContext,\n type StyleHandle,\n type SurfaceMap,\n type ThemePair,\n type ThemeTokenPath,\n type WithNodeFields,\n ICON_VARS,\n OPTIONAL_SURFACES,\n bindFrame,\n definePrimitive,\n definePrimitiveFor,\n exampleNodes,\n formatZodIssues,\n primitiveExamples,\n requiredString,\n unresolvedBodyNodeSchema,\n z,\n} from '../define';\nexport {\n type AnyPrimitivePack,\n type CapabilitySources,\n type ComposedPacks,\n type EnhancementDefinition,\n type HostCapabilities,\n type PackAuthoringOptions,\n type PackStyleAdapter,\n type PrimitiveGroup,\n type PrimitivePack,\n type PrimitivePackInput,\n type SurfaceSupport,\n UNCATEGORIZED_GROUP_TITLE,\n composePacks,\n definePrimitivePack,\n describeCapabilities,\n scopeScript,\n} from '../pack';\nexport {\n type FormatDisplayValueOptions,\n type LayoutBox,\n type LayoutFinding,\n type LayoutRect,\n type PayloadMeasurement,\n type PrimitiveDispatcher,\n type PrimitiveDispatcherOptions,\n LAYOUT_ROOM_ATTRIBUTE,\n NODE_ANCHOR_ATTRIBUTE,\n checkLayout,\n createPrimitiveDispatcher,\n formatDisplayValue,\n isStructuredValue,\n layoutRoom,\n nodeAnchor,\n rawDisplayValue,\n withNodeAnchors,\n withoutAnchors,\n} from '../render';\nexport {\n type AuthoringJsonSchemaOptions,\n type CheckedComposition,\n type CheckedValidationResult,\n type CompositionJsonSchemaOptions,\n type CompositionSchemaOptions,\n type CompositionValidatorOptions,\n type InputBudget,\n type InputBudgetCheck,\n type ParsedComposition,\n type UrlSchemaOptions,\n type ValidationErrorMode,\n type ValidationResult,\n type ValidationWarning,\n ASSET_URL_MESSAGE,\n ASSET_URL_RULE,\n BLOCKED_HREF,\n MAX_INPUT_CHARACTERS,\n MAX_INPUT_DEPTH,\n MAX_INPUT_VALUES,\n NAVIGATION_HREF_MESSAGE,\n NAVIGATION_HREF_RULE,\n assetUrl,\n authoringSchemaSubset,\n buildAuthoringJsonSchema,\n buildCompositionJsonSchema,\n checkInputBudget,\n compositionToRender,\n createCompositionParser,\n createCompositionValidator,\n displayValueSchema,\n getCompositionSchemaForDefinitions,\n isInputRefusal,\n namedColorSchema,\n navigationHref,\n renderThemeSchema,\n sanitizeAssetUrl,\n sanitizeNavigationHref,\n sanitizeParsedAssetUrl,\n sanitizeParsedNavigationHref,\n structuredValueSchema,\n warningsForSurface,\n} from '../validate';\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { type MarkdownBlock, type MarkdownContent, type MarkdownInline, type MarkdownInlineInput, } from '../define/index.js';
|
|
2
|
-
export { type MarkdownEnvelopeDispatcher, type MarkdownEnvelopeOptions, md, renderMarkdownEnvelope, serializeMarkdown, } from '../render/markdown/index.js';
|
|
2
|
+
export { type AuthoredMarkdownSegment, type MarkdownEnvelopeDispatcher, type MarkdownEnvelopeOptions, type SplitAuthoredMarkdownOptions, exceedsParseBudget, md, renderMarkdownEnvelope, serializeMarkdown, splitAuthoredMarkdown, } from '../render/markdown/index.js';
|
|
3
3
|
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/entries/markdown.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,EAAE,EACF,sBAAsB,EACtB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/entries/markdown.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,kBAAkB,EAClB,EAAE,EACF,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC"}
|
package/dist/entries/markdown.js
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
5
|
* 2.0.
|
|
6
6
|
*/
|
|
7
|
-
export { md, renderMarkdownEnvelope, serializeMarkdown, } from '../render/markdown/index.js';
|
|
7
|
+
export { exceedsParseBudget, md, renderMarkdownEnvelope, serializeMarkdown, splitAuthoredMarkdown, } from '../render/markdown/index.js';
|
|
8
8
|
//# sourceMappingURL=markdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/entries/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/entries/markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,EAKL,kBAAkB,EAClB,EAAE,EACF,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport {\n type MarkdownBlock,\n type MarkdownContent,\n type MarkdownInline,\n type MarkdownInlineInput,\n} from '../define';\n\nexport {\n type AuthoredMarkdownSegment,\n type MarkdownEnvelopeDispatcher,\n type MarkdownEnvelopeOptions,\n type SplitAuthoredMarkdownOptions,\n exceedsParseBudget,\n md,\n renderMarkdownEnvelope,\n serializeMarkdown,\n splitAuthoredMarkdown,\n} from '../render/markdown';\n"]}
|
package/dist/entries/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { runEnhancementScript } from '../pack/enhancements.js';
|
|
2
2
|
export { findNodeElementPairs } from '../render/anchors.js';
|
|
3
3
|
export { measureDom } from '../render/measure_dom.js';
|
|
4
|
-
export { type CompositionWrapperOptions, type ReactContentDispatcher, type ReactContentOptions, applyEnhancements, renderCompositionContent, wrapCompositionContent, } from '../render/react/index.js';
|
|
4
|
+
export { type CompositionWrapperOptions, type ReactContentDispatcher, type ReactContentOptions, applyEnhancements, renderCompositionContent, renderMarkdownContent, wrapCompositionContent, } from '../render/react/index.js';
|
|
5
5
|
//# sourceMappingURL=react.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/entries/react.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/entries/react.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC"}
|
package/dist/entries/react.js
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
export { runEnhancementScript } from '../pack/enhancements.js';
|
|
8
8
|
export { findNodeElementPairs } from '../render/anchors.js';
|
|
9
9
|
export { measureDom } from '../render/measure_dom.js';
|
|
10
|
-
export { applyEnhancements, renderCompositionContent, wrapCompositionContent, } from '../render/react/index.js';
|
|
10
|
+
export { applyEnhancements, renderCompositionContent, renderMarkdownContent, wrapCompositionContent, } from '../render/react/index.js';
|
|
11
11
|
//# sourceMappingURL=react.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/entries/react.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAIL,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport { runEnhancementScript } from '../pack/enhancements';\nexport { findNodeElementPairs } from '../render/anchors';\nexport { measureDom } from '../render/measure_dom';\nexport {\n type CompositionWrapperOptions,\n type ReactContentDispatcher,\n type ReactContentOptions,\n applyEnhancements,\n renderCompositionContent,\n wrapCompositionContent,\n} from '../render/react';\n"]}
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/entries/react.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAIL,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport { runEnhancementScript } from '../pack/enhancements';\nexport { findNodeElementPairs } from '../render/anchors';\nexport { measureDom } from '../render/measure_dom';\nexport {\n type CompositionWrapperOptions,\n type ReactContentDispatcher,\n type ReactContentOptions,\n applyEnhancements,\n renderCompositionContent,\n renderMarkdownContent,\n wrapCompositionContent,\n} from '../render/react';\n"]}
|
package/dist/entries/slack.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { type SlackActionElement, type SlackActionsBlock, type SlackAssetCollector, type SlackAssetRequest, type SlackBlock, type SlackButtonElement, type SlackCheckboxesElement, type SlackContextBlock, type SlackDividerBlock, type SlackEnvelopeDispatcher, type SlackEnvelopeOptions, type SlackEnvelopeResult, type SlackFileReference, type SlackHeaderBlock, type SlackHeaderLevel, type SlackImageBlock, type SlackImageElement, type SlackMrkdwnTextObject, type SlackMultiStaticSelectElement, type SlackOptionGroup, type SlackOptionObject, type SlackOverflowElement, type SlackPlainTextObject, type SlackRadioButtonsElement, type SlackRawTextElement, type SlackRichTextBlock, type SlackRichTextBlockElement, type SlackRichTextInline, type SlackRichTextLink, type SlackRichTextList, type SlackRichTextPreformatted, type SlackRichTextQuote, type SlackRichTextSection, type SlackRichTextStyle, type SlackRichTextTag, type SlackRichTextText, type SlackSectionAccessory, type SlackSectionBlock, type SlackStaticSelectElement, type SlackTableBlock, type SlackTableCell, type SlackTableColumnSetting, type SlackTagColor, type SlackTextObject, type SlackVideoBlock, SLACK_LIMITS, bold, clampSlackText, code, codeBlock, createSlackAssetCollector, escapeMrkdwn, isSlackReachableImageUrl, italic, link, markdownContentToSlackBlocks, renderSlackEnvelope, slackLinkUrl, strike, } from '../render/slack/index.js';
|
|
1
|
+
export { type SlackActionElement, type SlackActionsBlock, type SlackAssetCollector, type SlackAssetRequest, type SlackBlock, type SlackButtonElement, type SlackCheckboxesElement, type SlackContainerBlock, type SlackContainerChildBlock, type SlackContainerOptions, type SlackContextBlock, type SlackDividerBlock, type SlackEnvelopeDispatcher, type SlackEnvelopeOptions, type SlackEnvelopeResult, type SlackFileReference, type SlackHeaderBlock, type SlackHeaderLevel, type SlackImageBlock, type SlackImageElement, type SlackLinkOptions, type SlackMrkdwnTextObject, type SlackMultiStaticSelectElement, type SlackOptionGroup, type SlackOptionObject, type SlackOverflowElement, type SlackPlainTextObject, type SlackRadioButtonsElement, type SlackRawTextElement, type SlackRichTextBlock, type SlackRichTextBlockElement, type SlackRichTextInline, type SlackRichTextLink, type SlackRichTextList, type SlackRichTextPreformatted, type SlackRichTextQuote, type SlackRichTextSection, type SlackRichTextStyle, type SlackRichTextTag, type SlackRichTextText, type SlackSectionAccessory, type SlackSectionBlock, type SlackStaticSelectElement, type SlackTableBlock, type SlackTableCell, type SlackTableColumnSetting, type SlackTagColor, type SlackTextObject, type SlackVideoBlock, SLACK_LIMITS, bold, clampSlackText, code, codeBlock, createSlackAssetCollector, escapeMrkdwn, isModeledSlackBlockType, isSlackReachableImageUrl, isUnmodeledSlackBlock, italic, link, markdownContentToSlackBlocks, renderSlackEnvelope, slackContainer, slackLinkUrl, strike, unmodeledSlackBlock, } from '../render/slack/index.js';
|
|
2
2
|
//# sourceMappingURL=slack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack.d.ts","sourceRoot":"","sources":["../../src/entries/slack.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,aAAa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KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,YAAY,EACZ,IAAI,EACJ,cAAc,EACd,IAAI,EACJ,SAAS,EACT,yBAAyB,EACzB,YAAY,EACZ,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,EACN,IAAI,EACJ,4BAA4B,EAC5B,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,MAAM,EACN,mBAAmB,GACpB,MAAM,iBAAiB,CAAC"}
|
package/dist/entries/slack.js
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
5
|
* 2.0.
|
|
6
6
|
*/
|
|
7
|
-
export { SLACK_LIMITS, bold, clampSlackText, code, codeBlock, createSlackAssetCollector, escapeMrkdwn, isSlackReachableImageUrl, italic, link, markdownContentToSlackBlocks, renderSlackEnvelope, slackLinkUrl, strike, } from '../render/slack/index.js';
|
|
7
|
+
export { SLACK_LIMITS, bold, clampSlackText, code, codeBlock, createSlackAssetCollector, escapeMrkdwn, isModeledSlackBlockType, isSlackReachableImageUrl, isUnmodeledSlackBlock, italic, link, markdownContentToSlackBlocks, renderSlackEnvelope, slackContainer, slackLinkUrl, strike, unmodeledSlackBlock, } from '../render/slack/index.js';
|
|
8
8
|
//# sourceMappingURL=slack.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack.js","sourceRoot":"","sources":["../../src/entries/slack.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"slack.js","sourceRoot":"","sources":["../../src/entries/slack.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAkDL,YAAY,EACZ,IAAI,EACJ,cAAc,EACd,IAAI,EACJ,SAAS,EACT,yBAAyB,EACzB,YAAY,EACZ,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,EACN,IAAI,EACJ,4BAA4B,EAC5B,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,MAAM,EACN,mBAAmB,GACpB,MAAM,iBAAiB,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport {\n type SlackActionElement,\n type SlackActionsBlock,\n type SlackAssetCollector,\n type SlackAssetRequest,\n type SlackBlock,\n type SlackButtonElement,\n type SlackCheckboxesElement,\n type SlackContainerBlock,\n type SlackContainerChildBlock,\n type SlackContainerOptions,\n type SlackContextBlock,\n type SlackDividerBlock,\n type SlackEnvelopeDispatcher,\n type SlackEnvelopeOptions,\n type SlackEnvelopeResult,\n type SlackFileReference,\n type SlackHeaderBlock,\n type SlackHeaderLevel,\n type SlackImageBlock,\n type SlackImageElement,\n type SlackLinkOptions,\n type SlackMrkdwnTextObject,\n type SlackMultiStaticSelectElement,\n type SlackOptionGroup,\n type SlackOptionObject,\n type SlackOverflowElement,\n type SlackPlainTextObject,\n type SlackRadioButtonsElement,\n type SlackRawTextElement,\n type SlackRichTextBlock,\n type SlackRichTextBlockElement,\n type SlackRichTextInline,\n type SlackRichTextLink,\n type SlackRichTextList,\n type SlackRichTextPreformatted,\n type SlackRichTextQuote,\n type SlackRichTextSection,\n type SlackRichTextStyle,\n type SlackRichTextTag,\n type SlackRichTextText,\n type SlackSectionAccessory,\n type SlackSectionBlock,\n type SlackStaticSelectElement,\n type SlackTableBlock,\n type SlackTableCell,\n type SlackTableColumnSetting,\n type SlackTagColor,\n type SlackTextObject,\n type SlackVideoBlock,\n SLACK_LIMITS,\n bold,\n clampSlackText,\n code,\n codeBlock,\n createSlackAssetCollector,\n escapeMrkdwn,\n isModeledSlackBlockType,\n isSlackReachableImageUrl,\n isUnmodeledSlackBlock,\n italic,\n link,\n markdownContentToSlackBlocks,\n renderSlackEnvelope,\n slackContainer,\n slackLinkUrl,\n strike,\n unmodeledSlackBlock,\n} from '../render/slack';\n"]}
|
|
@@ -10,6 +10,10 @@ import type { PrimitiveNode } from '../composition/node.js';
|
|
|
10
10
|
export interface EnhancementDefinition {
|
|
11
11
|
/** What a renderer tests for via `context.enhancements`. Unique across a runtime's packs. */
|
|
12
12
|
id: string;
|
|
13
|
+
/** Short label for hosts; when omitted, use {@link EnhancementDefinition.id}. */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** What enabling the enhancement does, for host UI and authoring material. */
|
|
16
|
+
description?: string;
|
|
13
17
|
/**
|
|
14
18
|
* Whether this composition has anything for the enhancement to act on.
|
|
15
19
|
* Gating on content rather than the opt-in alone is what keeps a composition
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enhancements.d.ts","sourceRoot":"","sources":["../../src/pack/enhancements.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,6FAA6F;IAC7F,EAAE,EAAE,MAAM,CAAC;IACX;;;;;;;OAOG;IACH,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,aAAa,EAAE,EAAE,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC;IAC9E;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2GAA2G;IAC3G,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,SAAS,aAAa,EAAE,EAC9B,MAAM,eAAe,EACrB,aAAa,SAAS,qBAAqB,EAAE,EAC7C,YAAY,SAAS,MAAM,EAAE,KAC5B,qBAAqB,EAcvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MAAoC,C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@
|
|
|
1
|
-
{"version":3,"file":"enhancements.js","sourceRoot":"","sources":["../../src/pack/enhancements.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"enhancements.js","sourceRoot":"","sources":["../../src/pack/enhancements.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA4CnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,IAA8B,EAC9B,IAAqB,EACrB,WAA6C,EAC7C,SAA6B,EACJ,EAAE;IAC3B,MAAM,MAAM,GAAG,SAAS,IAAI,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;QACvC,IACE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACtB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACtC,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,EACjC,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,aAAa,IAAI,SAAS,CAAC;AAEhF,iEAAiE;AACjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAE9D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAU,EAAE,IAAa,EAAQ,EAAE;IACtE,6EAA6E;IAC7E,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,WAAW,CACnB,0BAA0B,EAC1B,uFAAuF,CACxF,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,aAAa,CAAC,UAAU,yBAAyB,GAAG,CAAC,EAAE,CAAC;QAC/D,OAAO,CAAC,IAAI,CACV,mHAAmH,CACpH,CAAC;IACJ,CAAC;IACD,IAAI,EAAE,EAAE,CAAC;QACP,6GAA6G;QAC7G,MAAM,GAAG,GAAG,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAA4B,CAAC;QAChE,GAAG,CAAC,IAAI,CAAC,CAAC;IACZ,CAAC;AACH,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 { ChildNodeWalker } from '../composition/body_node_base';\nimport { IsomerError } from '../composition/error';\nimport type { PrimitiveNode } from '../composition/node';\n\n/**\n * A progressive enhancement any vocabulary pack may declare.\n *\n * Ids are open strings rather than a closed union so a second pack can\n * register one without editing a shared type. Duplicate ids across packs in\n * one runtime are rejected at construction.\n */\nexport interface EnhancementDefinition {\n /** What a renderer tests for via `context.enhancements`. Unique across a runtime's packs. */\n id: string;\n /** Short label for hosts; when omitted, use {@link EnhancementDefinition.id}. */\n name?: string;\n /** What enabling the enhancement does, for host UI and authoring material. */\n description?: string;\n /**\n * Whether this composition has anything for the enhancement to act on.\n * Gating on content rather than the opt-in alone is what keeps a composition\n * with no matching node from shipping the script.\n *\n * `walk` is the composition's child walker, so a match nested inside a\n * container from another pack is still found.\n */\n appliesTo: (body: readonly PrimitiveNode[], walk: ChildNodeWalker) => boolean;\n /**\n * A function body with `root: Element`, the render's `.isomer` section, in\n * scope. It runs in its own function, so a top-level `const` or `return`\n * cannot reach another enhancement. Absent when the host drives the\n * enhancement itself.\n *\n * It must not look for its root through `document.currentScript`, which is\n * `null` inside a shadow root. It must address markup through `data-*`\n * attributes rather than class names: class names are minified per render,\n * and a selector written against one is a contract nothing checks. An event\n * meant for the host sets `composed: true` as well as `bubbles: true`, or it\n * stops at a shadow boundary.\n */\n script?: string;\n /** Renders node anchors when resolved, for an enhancement that finds nodes with `findNodeElementPairs`. */\n anchors?: true;\n}\n\n/**\n * The `definitions` that apply to `body`, the first of each id, limited to\n * `requested` ids when given. The HTML and React surfaces both resolve through\n * it, so the two cannot disagree on which enhancements a render carries.\n */\nexport const resolveEnhancements = (\n body: readonly PrimitiveNode[],\n walk: ChildNodeWalker,\n definitions: readonly EnhancementDefinition[],\n requested?: readonly string[]\n): EnhancementDefinition[] => {\n const wanted = requested && new Set(requested);\n const ids = new Set<string>();\n return definitions.filter((definition) => {\n if (\n ids.has(definition.id) ||\n (wanted && !wanted.has(definition.id)) ||\n !definition.appliesTo(body, walk)\n ) {\n return false;\n }\n ids.add(definition.id);\n return true;\n });\n};\n\n/**\n * Wraps one script body in its own function, so its `const`s and a top-level\n * `return` stay its own. Anything that joins script bodies scopes each first.\n */\nexport const scopeScript = (body: string): string => `(() => {\\n${body}\\n})();`;\n\n/** Marks the `<script>` a `scripts: 'embedded'` render emits. */\nexport const EMBEDDED_SCRIPT_ATTRIBUTE = 'data-isomer-script';\n\n/**\n * Runs a `scripts: 'host'` render's `js` against the\n * `.isomer` section the host inserted.\n *\n * Needed wherever the HTML is inserted by the host rather than parsed with the\n * page, including every shadow root: such a `<script>` never runs, and one\n * that did would find no `document.currentScript`.\n *\n * Compiles with `new Function`, so a strict Content-Security-Policy must allow\n * `'unsafe-eval'`. A host that cannot should render with `scripts: 'embedded'`\n * into light DOM.\n */\nexport const runEnhancementScript = (js: string, root: Element): void => {\n // Guards untyped callers; typed ones already handled `querySelector`'s null.\n if (!root) {\n throw new IsomerError(\n 'ENHANCEMENT_ROOT_MISSING',\n 'runEnhancementScript: no root element; pass the `.isomer` section the render produced'\n );\n }\n if (root.querySelector(`script[${EMBEDDED_SCRIPT_ATTRIBUTE}]`)) {\n console.warn(\n \"isomer: this HTML was rendered with scripts: 'embedded'; render with scripts: 'host' so its enhancements run once\"\n );\n }\n if (js) {\n // eslint-disable-next-line @typescript-eslint/no-implied-eval -- compiling the render's script is the point.\n const run = new Function('root', js) as (root: Element) => void;\n run(root);\n }\n};\n"]}
|
package/dist/pack/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { type CapabilitySources, type HostCapabilities, type SurfaceSupport, describeCapabilities, } from './capabilities.js';
|
|
2
2
|
export { type ComposedPacks, composePacks } from './compose.js';
|
|
3
3
|
export { type EnhancementDefinition, scopeScript } from './enhancements.js';
|
|
4
|
-
export { type AnyPrimitivePack, type PackAuthoringOptions, type PackStyleAdapter, type PrimitiveGroup, type PrimitivePack, type PrimitivePackInput, definePrimitivePack, } from './primitive_pack.js';
|
|
4
|
+
export { type AnyPrimitivePack, type PackAuthoringOptions, type PackStyleAdapter, type PrimitiveGroup, type PrimitivePack, type PrimitivePackInput, UNCATEGORIZED_GROUP_TITLE, definePrimitivePack, } from './primitive_pack.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/pack/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pack/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,KAAK,qBAAqB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pack/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,KAAK,qBAAqB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC"}
|
package/dist/pack/index.js
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
export { describeCapabilities, } from './capabilities.js';
|
|
8
8
|
export { composePacks } from './compose.js';
|
|
9
9
|
export { scopeScript } from './enhancements.js';
|
|
10
|
-
export { definePrimitivePack, } from './primitive_pack.js';
|
|
10
|
+
export { UNCATEGORIZED_GROUP_TITLE, definePrimitivePack, } from './primitive_pack.js';
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/dist/pack/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pack/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAIL,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAsB,YAAY,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAA8B,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAOL,mBAAmB,GACpB,MAAM,kBAAkB,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport {\n type CapabilitySources,\n type HostCapabilities,\n type SurfaceSupport,\n describeCapabilities,\n} from './capabilities';\nexport { type ComposedPacks, composePacks } from './compose';\nexport { type EnhancementDefinition, scopeScript } from './enhancements';\nexport {\n type AnyPrimitivePack,\n type PackAuthoringOptions,\n type PackStyleAdapter,\n type PrimitiveGroup,\n type PrimitivePack,\n type PrimitivePackInput,\n definePrimitivePack,\n} from './primitive_pack';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pack/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAIL,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAsB,YAAY,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAA8B,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAOL,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC","sourcesContent":["/*\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\nexport {\n type CapabilitySources,\n type HostCapabilities,\n type SurfaceSupport,\n describeCapabilities,\n} from './capabilities';\nexport { type ComposedPacks, composePacks } from './compose';\nexport { type EnhancementDefinition, scopeScript } from './enhancements';\nexport {\n type AnyPrimitivePack,\n type PackAuthoringOptions,\n type PackStyleAdapter,\n type PrimitiveGroup,\n type PrimitivePack,\n type PrimitivePackInput,\n UNCATEGORIZED_GROUP_TITLE,\n definePrimitivePack,\n} from './primitive_pack';\n"]}
|
|
@@ -14,7 +14,7 @@ export interface PackAuthoringOptions {
|
|
|
14
14
|
describe?: Readonly<Record<string, string>>;
|
|
15
15
|
/** `$defId.property` paths to drop, from this pack's own primitives. */
|
|
16
16
|
omitProperties?: readonly string[];
|
|
17
|
-
/** Headings an index catalog sorts this pack's primitives under, in order. */
|
|
17
|
+
/** Headings an index catalog sorts this pack's primitives under, in order. A type in none is listed under {@link UNCATEGORIZED_GROUP_TITLE}. */
|
|
18
18
|
groups?: readonly PrimitiveGroup[];
|
|
19
19
|
}
|
|
20
20
|
/** A titled set of primitive types, listed together in an index catalog. */
|
|
@@ -22,6 +22,8 @@ export interface PrimitiveGroup {
|
|
|
22
22
|
title: string;
|
|
23
23
|
types: readonly string[];
|
|
24
24
|
}
|
|
25
|
+
/** The index heading for primitives in no group. A pack cannot declare a group with this title. */
|
|
26
|
+
export declare const UNCATEGORIZED_GROUP_TITLE = "Uncategorized";
|
|
25
27
|
/**
|
|
26
28
|
* The HTML style-adapter hooks a pack may declare. Typed loosely here so `pack/` does not import `render/`.
|
|
27
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive_pack.d.ts","sourceRoot":"","sources":["../../src/pack/primitive_pack.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EACf,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,wEAAwE;IACxE,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,
|
|
1
|
+
{"version":3,"file":"primitive_pack.d.ts","sourceRoot":"","sources":["../../src/pack/primitive_pack.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,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CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAEpD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,GAAG,OAAO,EAClD,OAAO,kBAAkB,KACxB,aAAa,CAAC,MAAM,CAoCtB,CAAC;AAEF,yGAAyG;AACzG,eAAO,MAAM,WAAW,GACtB,YAAY,SAAS,sBAAsB,EAAE,KAC5C,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAQxC,CAAC"}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
// primitive in it implements. Additive: a runtime composes any number of packs,
|
|
9
9
|
// and nothing about a pack decides how a composition is framed.
|
|
10
10
|
import { IsomerError } from '../composition/error.js';
|
|
11
|
+
/** The index heading for primitives in no group. A pack cannot declare a group with this title. */
|
|
12
|
+
export const UNCATEGORIZED_GROUP_TITLE = 'Uncategorized';
|
|
11
13
|
/**
|
|
12
14
|
* Builds a {@link PrimitivePack}.
|
|
13
15
|
*
|
|
@@ -22,7 +24,7 @@ export const definePrimitivePack = (input) => {
|
|
|
22
24
|
assertUniquePrimitiveTypes(input.id, input.primitives);
|
|
23
25
|
assertUniqueEnhancementIds(input.id, input.enhancements ?? []);
|
|
24
26
|
const types = new Set(input.primitives.map((definition) => definition.type));
|
|
25
|
-
|
|
27
|
+
assertValidGroups(input.id, input.authoring?.groups ?? [], types);
|
|
26
28
|
for (const type of input.slackAssetTypes ?? []) {
|
|
27
29
|
if (!types.has(type)) {
|
|
28
30
|
throw new IsomerError('UNKNOWN_PRIMITIVE_TYPE', `primitive pack "${input.id}": slackAssetTypes names primitive type "${type}", which the pack does not register`);
|
|
@@ -64,10 +66,18 @@ const assertUniquePrimitiveTypes = (id, primitives) => {
|
|
|
64
66
|
seen.add(type);
|
|
65
67
|
}
|
|
66
68
|
};
|
|
67
|
-
/** Throws if a group names a type outside `types`, or
|
|
68
|
-
const
|
|
69
|
+
/** Throws if a group repeats or reserves a title, names a type outside `types`, or shares a type with another. */
|
|
70
|
+
const assertValidGroups = (id, groups, types) => {
|
|
71
|
+
const titles = new Set();
|
|
69
72
|
const grouped = new Set();
|
|
70
73
|
for (const { title, types: members } of groups) {
|
|
74
|
+
if (title === UNCATEGORIZED_GROUP_TITLE) {
|
|
75
|
+
throw new IsomerError('INVALID_PACK_GROUPS', `primitive pack "${id}": group title "${title}" is reserved for primitives in no group`);
|
|
76
|
+
}
|
|
77
|
+
if (titles.has(title)) {
|
|
78
|
+
throw new IsomerError('INVALID_PACK_GROUPS', `primitive pack "${id}": group title "${title}" is used twice`);
|
|
79
|
+
}
|
|
80
|
+
titles.add(title);
|
|
71
81
|
for (const type of members) {
|
|
72
82
|
if (!types.has(type)) {
|
|
73
83
|
throw new IsomerError('UNKNOWN_PRIMITIVE_TYPE', `primitive pack "${id}": group "${title}" names primitive type "${type}", which the pack does not register`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive_pack.js","sourceRoot":"","sources":["../../src/pack/primitive_pack.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6EAA6E;AAC7E,gFAAgF;AAChF,gEAAgE;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAsKnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAyB,EACF,EAAE;IACzB,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,WAAW,CACnB,YAAY,EACZ,mBAAmB,KAAK,CAAC,EAAE,uCAAuC,CACnE,CAAC;IACJ,CAAC;IACD,0BAA0B,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACvD,0BAA0B,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,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I,CAAC,EAAE,CAAC;gBACrB,MAAM,IAAI,WAAW,CACnB,wBAAwB,EACxB,mBAAmB,EAAE,aAAa,KAAK,2BAA2B,IAAI,qCAAqC,CAC5G,CAAC;YACJ,CAAC;YACD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtB,MAAM,IAAI,WAAW,CACnB,0BAA0B,EAC1B,mBAAmB,EAAE,sBAAsB,IAAI,oBAAoB,CACpE,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,mEAAmE;AACnE,MAAM,0BAA0B,GAAG,CACjC,EAAU,EACV,YAA8C,EACxC,EAAE;IACR,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,UAAU,IAAI,YAAY,EAAE,CAAC;QACtC,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,WAAW,CACnB,uBAAuB,EACvB,mBAAmB,EAAE,mBAAmB,UAAU,CAAC,EAAE,oBAAoB,CAC1E,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;AACH,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// A primitive pack as a value: a vocabulary, and the optional surfaces every\n// primitive in it implements. Additive: a runtime composes any number of packs,\n// and nothing about a pack decides how a composition is framed.\n\nimport { IsomerError } from '../composition/error';\nimport type { PrimitiveIcon } from '../define/primitive_icon';\nimport type {\n AnyPrimitiveDefinition,\n OptionalSurface,\n StyleHandle,\n} from '../define/primitive_module';\n\nimport type { EnhancementDefinition } from './enhancements';\n\n/**\n * The authoring-schema material a pack contributes for its own primitives.\n *\n * A subset of `AuthoringJsonSchemaOptions`: `$id`, `title`, `description`, and\n * `composition` describe the whole authoring schema a runtime builds, which is\n * a host decision, not a pack one. `pack/` does not import `validate/` for\n * this, so the shape is declared here rather than reused by reference.\n */\nexport interface PackAuthoringOptions {\n /** `$def` id to `description`, for this pack's own primitives. */\n describe?: Readonly<Record<string, string>>;\n /** `$defId.property` paths to drop, from this pack's own primitives. */\n omitProperties?: readonly string[];\n /** Headings an index catalog sorts this pack's primitives under, in order. */\n groups?: readonly PrimitiveGroup[];\n}\n\n/** A titled set of primitive types, listed together in an index catalog. */\nexport interface PrimitiveGroup {\n title: string;\n types: readonly string[];\n}\n\n/**\n * The HTML style-adapter hooks a pack may declare. Typed loosely here so `pack/` does not import `render/`.\n */\nexport type PackStyleAdapter = {\n /** See {@link PrimitivePackInput.styleCollector}. */\n styleCollector?: string;\n /** The hooks of `HTMLStyleAdapter` from `./html`, erased: a fresh collector per render, the context renderers receive, and the stylesheet the collector produced. */\n createCollector: (...args: never[]) => object;\n createRenderContext: (...args: never[]) => unknown;\n renderStyles: (...args: never[]) => string;\n /**\n * Whether `handle` belongs to this adapter's stylesheet. Required for a runtime to combine several packs' CSS: without it their handles cannot be routed and the host must pick one adapter.\n */\n ownsHandle?: (handle: StyleHandle) => boolean;\n};\n\n/** What a pack author passes to {@link definePrimitivePack}. */\nexport interface PrimitivePackInput {\n /** Stable identifier, used in capability reports and error messages. */\n id: string;\n /**\n * The optional surfaces this pack's primitives implement.\n *\n * Only `slack`, and it stays optional per primitive: the dispatcher converts\n * the mandatory markdown to Block Kit, so declaring it reports an intent\n * rather than imposing a requirement. Omit it entirely for a pack that\n * renders Slack through that fallback.\n */\n surfaces?: readonly OptionalSurface[];\n /** This pack's vocabulary. Node types must be unique within it, or construction throws. */\n primitives: readonly AnyPrimitiveDefinition[];\n /**\n * Progressive enhancements this pack's primitives can apply, by id.\n *\n * Declared by the pack because an enhancement is a fact about its\n * vocabulary — a sortable table, a copyable code block — and a host\n * composing packs it did not write cannot be expected to know the ids.\n * The runtime flattens these across packs; duplicate ids are rejected.\n */\n enhancements?: readonly EnhancementDefinition[];\n /**\n * Types that render as a self-contained picture rather than as text.\n *\n * A channel that cannot draw them inline uploads an image instead: the Slack\n * dispatcher swaps such a node for an `image` block and an upload request, so\n * a chart arrives as a PNG rather than as a markdown approximation of one.\n *\n * Declared by the pack because it is a fact about the vocabulary, and a host\n * composing packs it did not write cannot be expected to know it.\n */\n slackAssetTypes?: readonly string[];\n /**\n * Default HTML style adapter for this pack. A runtime that omits\n * `styleAdapter` runs the packs' own adapters, combined when more than one\n * pack declares one and each answers `ownsHandle`. Pass `styleAdapter` on\n * the runtime to replace them all.\n */\n styleAdapter?: PackStyleAdapter;\n /**\n * Names the collector shape this pack's `collectStyles` hooks mutate, so a\n * runtime can reject a pack paired with an adapter of a different tag.\n * Defaults to `styleAdapter.styleCollector`; a pack with neither opts out of\n * the check.\n */\n styleCollector?: string;\n /**\n * This pack's own contribution to the runtime's authoring JSON Schema.\n *\n * Merged across every composed pack, so a host does not hand-merge each\n * pack's `describe`/`omitProperties` into one options object itself. The\n * runtime-level `authoring` option is merged in last and wins on conflict.\n */\n authoring?: PackAuthoringOptions;\n}\n\n/**\n * A pack as the runtime sees it.\n *\n * `TTheme` is the palette this pack's `react` renderers read as `env.theme`\n * when drawn through the `snapshot` surface — a *lower bound* on whatever theme\n * the runtime holding it supplies. It is carried by\n * {@link PrimitivePack.__theme} rather than by any real field, because\n * `primitives` is erased to `AnyPrimitiveDefinition[]` and a heterogeneous\n * inventory has no single node type to be generic over.\n *\n * The bound is declared, not derived: nothing checks it against what the\n * renderers actually read. State it at the definition as\n * `definePrimitivePack<T>(input)`.\n * Bare `PrimitivePack` requires nothing and fits any runtime; a slot that must\n * hold packs of every palette is typed {@link AnyPrimitivePack}.\n */\nexport interface PrimitivePack<TTheme = unknown> {\n /** Unique among the packs a runtime composes, and used in error messages. */\n readonly id: string;\n /** See {@link PrimitivePackInput.surfaces}. */\n readonly surfaces: readonly OptionalSurface[];\n /** See {@link PrimitivePackInput.primitives}. */\n readonly primitives: readonly AnyPrimitiveDefinition[];\n /** Node types this pack owns, for duplicate detection across packs. */\n readonly types: ReadonlySet<string>;\n /**\n * Each primitive's `icon` by type, for the primitives that declare one, so a host listing them need not walk `primitives`.\n *\n * A frozen null-prototype dictionary: an absent type reads `undefined`, even `constructor`. Absent on a pack built by an SDK that predates icons; {@link iconsByType} derives it from `primitives`.\n */\n readonly icons?: Readonly<Record<string, PrimitiveIcon>>;\n /** See {@link PrimitivePackInput.enhancements}. */\n readonly enhancements: readonly EnhancementDefinition[];\n /** See {@link PrimitivePackInput.slackAssetTypes}. */\n readonly slackAssetTypes: ReadonlySet<string>;\n /** See {@link PrimitivePackInput.styleAdapter}. */\n readonly styleAdapter?: PackStyleAdapter;\n /** See {@link PrimitivePackInput.styleCollector}. */\n readonly styleCollector?: string;\n /** See {@link PrimitivePackInput.authoring}. */\n readonly authoring?: PackAuthoringOptions;\n /**\n * Phantom: never present at runtime, never read.\n *\n * A property rather than a method so `strictFunctionTypes` checks it\n * contravariantly. A method signature is bivariant, which would let a pack\n * needing richer tokens sit in a slot supplying fewer and then read a field\n * nothing supplies — the exact failure this marker exists to prevent.\n */\n readonly __theme?: (theme: TTheme) => void;\n}\n\n/**\n * A pack of any palette, for storage positions: `never` is assignable to every\n * requirement, so a slot typed this way holds every pack.\n */\nexport type AnyPrimitivePack = PrimitivePack<never>;\n\n/**\n * Builds a {@link PrimitivePack}.\n *\n * `TTheme` is the palette a frame must supply for this pack's nodes to be drawn\n * on the `snapshot` surface: `definePrimitivePack<CoreTokens>(input)`. Omitted, it is\n * `unknown`, which requires nothing.\n */\nexport const definePrimitivePack = <TTheme = unknown>(\n input: PrimitivePackInput\n): PrimitivePack<TTheme> => {\n if (input.primitives.length === 0) {\n throw new IsomerError(\n 'EMPTY_PACK',\n `primitive pack \"${input.id}\": at least one primitive is required`\n );\n }\n assertUniquePrimitiveTypes(input.id, input.primitives);\n assertUniqueEnhancementIds(input.id, input.enhancements ?? []);\n const types = new Set(input.primitives.map((definition) => definition.type));\n assertGroupedOnce(input.id, input.authoring?.groups ?? [], types);\n for (const type of input.slackAssetTypes ?? []) {\n if (!types.has(type)) {\n throw new IsomerError(\n 'UNKNOWN_PRIMITIVE_TYPE',\n `primitive pack \"${input.id}\": slackAssetTypes names primitive type \"${type}\", which the pack does not register`\n );\n }\n }\n const styleCollector =\n input.styleCollector ?? input.styleAdapter?.styleCollector;\n\n return {\n id: input.id,\n surfaces: input.surfaces ?? [],\n primitives: input.primitives,\n types,\n icons: iconsByType(input.primitives),\n enhancements: input.enhancements ?? [],\n slackAssetTypes: new Set(input.slackAssetTypes ?? []),\n ...(input.styleAdapter !== undefined\n ? { styleAdapter: input.styleAdapter }\n : {}),\n ...(styleCollector !== undefined ? { styleCollector } : {}),\n ...(input.authoring !== undefined ? { authoring: input.authoring } : {}),\n };\n};\n\n/** Each definition's `icon` by type, null-prototype so a type such as `__proto__` is an ordinary key. */\nexport const iconsByType = (\n primitives: readonly AnyPrimitiveDefinition[]\n): Readonly<Record<string, PrimitiveIcon>> => {\n const icons = Object.create(null) as Record<string, PrimitiveIcon>;\n for (const { type, icon } of primitives) {\n if (icon !== undefined) {\n icons[type] = icon;\n }\n }\n return Object.freeze(icons);\n};\n\n/** Throws if `primitives` repeats a type. */\nconst assertUniquePrimitiveTypes = (\n id: string,\n primitives: readonly AnyPrimitiveDefinition[]\n): void => {\n const seen = new Set<string>();\n for (const { type } of primitives) {\n if (seen.has(type)) {\n throw new IsomerError(\n 'DUPLICATE_PRIMITIVE_TYPE',\n `primitive pack \"${id}\": primitive type \"${type}\" registered twice`\n );\n }\n seen.add(type);\n }\n};\n\n/** Throws if a group names a type outside `types`, or two groups share a type. */\nconst assertGroupedOnce = (\n id: string,\n groups: readonly PrimitiveGroup[],\n types: ReadonlySet<string>\n): void => {\n const grouped = new Set<string>();\n for (const { title, types: members } of groups) {\n for (const type of members) {\n if (!types.has(type)) {\n throw new IsomerError(\n 'UNKNOWN_PRIMITIVE_TYPE',\n `primitive pack \"${id}\": group \"${title}\" names primitive type \"${type}\", which the pack does not register`\n );\n }\n if (grouped.has(type)) {\n throw new IsomerError(\n 'DUPLICATE_PRIMITIVE_TYPE',\n `primitive pack \"${id}\": primitive type \"${type}\" is in two groups`\n );\n }\n grouped.add(type);\n }\n }\n};\n\n/** Throws if this pack registers the same enhancement id twice. */\nconst assertUniqueEnhancementIds = (\n id: string,\n enhancements: readonly EnhancementDefinition[]\n): void => {\n const seen = new Set<string>();\n for (const definition of enhancements) {\n if (seen.has(definition.id)) {\n throw new IsomerError(\n 'DUPLICATE_ENHANCEMENT',\n `primitive pack \"${id}\": enhancement \"${definition.id}\" registered twice`\n );\n }\n seen.add(definition.id);\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"primitive_pack.js","sourceRoot":"","sources":["../../src/pack/primitive_pack.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6EAA6E;AAC7E,gFAAgF;AAChF,gEAAgE;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAiCnD,mGAAmG;AACnG,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAC;AAuIzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAyB,EACF,EAAE;IACzB,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,WAAW,CACnB,YAAY,EACZ,mBAAmB,KAAK,CAAC,EAAE,uCAAuC,CACnE,CAAC;IACJ,CAAC;IACD,0BAA0B,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACvD,0BAA0B,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IAC/D,MAAM,KAAK,GAA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;IAC1B,CAAC;AACH,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// A primitive pack as a value: a vocabulary, and the optional surfaces every\n// primitive in it implements. Additive: a runtime composes any number of packs,\n// and nothing about a pack decides how a composition is framed.\n\nimport { IsomerError } from '../composition/error';\nimport type { PrimitiveIcon } from '../define/primitive_icon';\nimport type {\n AnyPrimitiveDefinition,\n OptionalSurface,\n StyleHandle,\n} from '../define/primitive_module';\n\nimport type { EnhancementDefinition } from './enhancements';\n\n/**\n * The authoring-schema material a pack contributes for its own primitives.\n *\n * A subset of `AuthoringJsonSchemaOptions`: `$id`, `title`, `description`, and\n * `composition` describe the whole authoring schema a runtime builds, which is\n * a host decision, not a pack one. `pack/` does not import `validate/` for\n * this, so the shape is declared here rather than reused by reference.\n */\nexport interface PackAuthoringOptions {\n /** `$def` id to `description`, for this pack's own primitives. */\n describe?: Readonly<Record<string, string>>;\n /** `$defId.property` paths to drop, from this pack's own primitives. */\n omitProperties?: readonly string[];\n /** Headings an index catalog sorts this pack's primitives under, in order. A type in none is listed under {@link UNCATEGORIZED_GROUP_TITLE}. */\n groups?: readonly PrimitiveGroup[];\n}\n\n/** A titled set of primitive types, listed together in an index catalog. */\nexport interface PrimitiveGroup {\n title: string;\n types: readonly string[];\n}\n\n/** The index heading for primitives in no group. A pack cannot declare a group with this title. */\nexport const UNCATEGORIZED_GROUP_TITLE = 'Uncategorized';\n\n/**\n * The HTML style-adapter hooks a pack may declare. Typed loosely here so `pack/` does not import `render/`.\n */\nexport type PackStyleAdapter = {\n /** See {@link PrimitivePackInput.styleCollector}. */\n styleCollector?: string;\n /** The hooks of `HTMLStyleAdapter` from `./html`, erased: a fresh collector per render, the context renderers receive, and the stylesheet the collector produced. */\n createCollector: (...args: never[]) => object;\n createRenderContext: (...args: never[]) => unknown;\n renderStyles: (...args: never[]) => string;\n /**\n * Whether `handle` belongs to this adapter's stylesheet. Required for a runtime to combine several packs' CSS: without it their handles cannot be routed and the host must pick one adapter.\n */\n ownsHandle?: (handle: StyleHandle) => boolean;\n};\n\n/** What a pack author passes to {@link definePrimitivePack}. */\nexport interface PrimitivePackInput {\n /** Stable identifier, used in capability reports and error messages. */\n id: string;\n /**\n * The optional surfaces this pack's primitives implement.\n *\n * Only `slack`, and it stays optional per primitive: the dispatcher converts\n * the mandatory markdown to Block Kit, so declaring it reports an intent\n * rather than imposing a requirement. Omit it entirely for a pack that\n * renders Slack through that fallback.\n */\n surfaces?: readonly OptionalSurface[];\n /** This pack's vocabulary. Node types must be unique within it, or construction throws. */\n primitives: readonly AnyPrimitiveDefinition[];\n /**\n * Progressive enhancements this pack's primitives can apply, by id.\n *\n * Declared by the pack because an enhancement is a fact about its\n * vocabulary — a sortable table, a copyable code block — and a host\n * composing packs it did not write cannot be expected to know the ids.\n * The runtime flattens these across packs; duplicate ids are rejected.\n */\n enhancements?: readonly EnhancementDefinition[];\n /**\n * Types that render as a self-contained picture rather than as text.\n *\n * A channel that cannot draw them inline uploads an image instead: the Slack\n * dispatcher swaps such a node for an `image` block and an upload request, so\n * a chart arrives as a PNG rather than as a markdown approximation of one.\n *\n * Declared by the pack because it is a fact about the vocabulary, and a host\n * composing packs it did not write cannot be expected to know it.\n */\n slackAssetTypes?: readonly string[];\n /**\n * Default HTML style adapter for this pack. A runtime that omits\n * `styleAdapter` runs the packs' own adapters, combined when more than one\n * pack declares one and each answers `ownsHandle`. Pass `styleAdapter` on\n * the runtime to replace them all.\n */\n styleAdapter?: PackStyleAdapter;\n /**\n * Names the collector shape this pack's `collectStyles` hooks mutate, so a\n * runtime can reject a pack paired with an adapter of a different tag.\n * Defaults to `styleAdapter.styleCollector`; a pack with neither opts out of\n * the check.\n */\n styleCollector?: string;\n /**\n * This pack's own contribution to the runtime's authoring JSON Schema.\n *\n * Merged across every composed pack, so a host does not hand-merge each\n * pack's `describe`/`omitProperties` into one options object itself. The\n * runtime-level `authoring` option is merged in last and wins on conflict.\n */\n authoring?: PackAuthoringOptions;\n}\n\n/**\n * A pack as the runtime sees it.\n *\n * `TTheme` is the palette this pack's `react` renderers read as `env.theme`\n * when drawn through the `snapshot` surface — a *lower bound* on whatever theme\n * the runtime holding it supplies. It is carried by\n * {@link PrimitivePack.__theme} rather than by any real field, because\n * `primitives` is erased to `AnyPrimitiveDefinition[]` and a heterogeneous\n * inventory has no single node type to be generic over.\n *\n * The bound is declared, not derived: nothing checks it against what the\n * renderers actually read. State it at the definition as\n * `definePrimitivePack<T>(input)`.\n * Bare `PrimitivePack` requires nothing and fits any runtime; a slot that must\n * hold packs of every palette is typed {@link AnyPrimitivePack}.\n */\nexport interface PrimitivePack<TTheme = unknown> {\n /** Unique among the packs a runtime composes, and used in error messages. */\n readonly id: string;\n /** See {@link PrimitivePackInput.surfaces}. */\n readonly surfaces: readonly OptionalSurface[];\n /** See {@link PrimitivePackInput.primitives}. */\n readonly primitives: readonly AnyPrimitiveDefinition[];\n /** Node types this pack owns, for duplicate detection across packs. */\n readonly types: ReadonlySet<string>;\n /**\n * Each primitive's `icon` by type, for the primitives that declare one, so a host listing them need not walk `primitives`.\n *\n * A frozen null-prototype dictionary: an absent type reads `undefined`, even `constructor`. Absent on a pack built by an SDK that predates icons; {@link iconsByType} derives it from `primitives`.\n */\n readonly icons?: Readonly<Record<string, PrimitiveIcon>>;\n /** See {@link PrimitivePackInput.enhancements}. */\n readonly enhancements: readonly EnhancementDefinition[];\n /** See {@link PrimitivePackInput.slackAssetTypes}. */\n readonly slackAssetTypes: ReadonlySet<string>;\n /** See {@link PrimitivePackInput.styleAdapter}. */\n readonly styleAdapter?: PackStyleAdapter;\n /** See {@link PrimitivePackInput.styleCollector}. */\n readonly styleCollector?: string;\n /** See {@link PrimitivePackInput.authoring}. */\n readonly authoring?: PackAuthoringOptions;\n /**\n * Phantom: never present at runtime, never read.\n *\n * A property rather than a method so `strictFunctionTypes` checks it\n * contravariantly. A method signature is bivariant, which would let a pack\n * needing richer tokens sit in a slot supplying fewer and then read a field\n * nothing supplies — the exact failure this marker exists to prevent.\n */\n readonly __theme?: (theme: TTheme) => void;\n}\n\n/**\n * A pack of any palette, for storage positions: `never` is assignable to every\n * requirement, so a slot typed this way holds every pack.\n */\nexport type AnyPrimitivePack = PrimitivePack<never>;\n\n/**\n * Builds a {@link PrimitivePack}.\n *\n * `TTheme` is the palette a frame must supply for this pack's nodes to be drawn\n * on the `snapshot` surface: `definePrimitivePack<CoreTokens>(input)`. Omitted, it is\n * `unknown`, which requires nothing.\n */\nexport const definePrimitivePack = <TTheme = unknown>(\n input: PrimitivePackInput\n): PrimitivePack<TTheme> => {\n if (input.primitives.length === 0) {\n throw new IsomerError(\n 'EMPTY_PACK',\n `primitive pack \"${input.id}\": at least one primitive is required`\n );\n }\n assertUniquePrimitiveTypes(input.id, input.primitives);\n assertUniqueEnhancementIds(input.id, input.enhancements ?? []);\n const types = new Set(input.primitives.map((definition) => definition.type));\n assertValidGroups(input.id, input.authoring?.groups ?? [], types);\n for (const type of input.slackAssetTypes ?? []) {\n if (!types.has(type)) {\n throw new IsomerError(\n 'UNKNOWN_PRIMITIVE_TYPE',\n `primitive pack \"${input.id}\": slackAssetTypes names primitive type \"${type}\", which the pack does not register`\n );\n }\n }\n const styleCollector =\n input.styleCollector ?? input.styleAdapter?.styleCollector;\n\n return {\n id: input.id,\n surfaces: input.surfaces ?? [],\n primitives: input.primitives,\n types,\n icons: iconsByType(input.primitives),\n enhancements: input.enhancements ?? [],\n slackAssetTypes: new Set(input.slackAssetTypes ?? []),\n ...(input.styleAdapter !== undefined\n ? { styleAdapter: input.styleAdapter }\n : {}),\n ...(styleCollector !== undefined ? { styleCollector } : {}),\n ...(input.authoring !== undefined ? { authoring: input.authoring } : {}),\n };\n};\n\n/** Each definition's `icon` by type, null-prototype so a type such as `__proto__` is an ordinary key. */\nexport const iconsByType = (\n primitives: readonly AnyPrimitiveDefinition[]\n): Readonly<Record<string, PrimitiveIcon>> => {\n const icons = Object.create(null) as Record<string, PrimitiveIcon>;\n for (const { type, icon } of primitives) {\n if (icon !== undefined) {\n icons[type] = icon;\n }\n }\n return Object.freeze(icons);\n};\n\n/** Throws if `primitives` repeats a type. */\nconst assertUniquePrimitiveTypes = (\n id: string,\n primitives: readonly AnyPrimitiveDefinition[]\n): void => {\n const seen = new Set<string>();\n for (const { type } of primitives) {\n if (seen.has(type)) {\n throw new IsomerError(\n 'DUPLICATE_PRIMITIVE_TYPE',\n `primitive pack \"${id}\": primitive type \"${type}\" registered twice`\n );\n }\n seen.add(type);\n }\n};\n\n/** Throws if a group repeats or reserves a title, names a type outside `types`, or shares a type with another. */\nconst assertValidGroups = (\n id: string,\n groups: readonly PrimitiveGroup[],\n types: ReadonlySet<string>\n): void => {\n const titles = new Set<string>();\n const grouped = new Set<string>();\n for (const { title, types: members } of groups) {\n if (title === UNCATEGORIZED_GROUP_TITLE) {\n throw new IsomerError(\n 'INVALID_PACK_GROUPS',\n `primitive pack \"${id}\": group title \"${title}\" is reserved for primitives in no group`\n );\n }\n if (titles.has(title)) {\n throw new IsomerError(\n 'INVALID_PACK_GROUPS',\n `primitive pack \"${id}\": group title \"${title}\" is used twice`\n );\n }\n titles.add(title);\n for (const type of members) {\n if (!types.has(type)) {\n throw new IsomerError(\n 'UNKNOWN_PRIMITIVE_TYPE',\n `primitive pack \"${id}\": group \"${title}\" names primitive type \"${type}\", which the pack does not register`\n );\n }\n if (grouped.has(type)) {\n throw new IsomerError(\n 'DUPLICATE_PRIMITIVE_TYPE',\n `primitive pack \"${id}\": primitive type \"${type}\" is in two groups`\n );\n }\n grouped.add(type);\n }\n }\n};\n\n/** Throws if this pack registers the same enhancement id twice. */\nconst assertUniqueEnhancementIds = (\n id: string,\n enhancements: readonly EnhancementDefinition[]\n): void => {\n const seen = new Set<string>();\n for (const definition of enhancements) {\n if (seen.has(definition.id)) {\n throw new IsomerError(\n 'DUPLICATE_ENHANCEMENT',\n `primitive pack \"${id}\": enhancement \"${definition.id}\" registered twice`\n );\n }\n seen.add(definition.id);\n }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format_number.d.ts","sourceRoot":"","sources":["../../src/render/format_number.ts"],"names":[],"mappings":"AAyBA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,MAAM,EACb,aAAS,EACT,kBAAa,KACZ,
|
|
1
|
+
{"version":3,"file":"format_number.d.ts","sourceRoot":"","sources":["../../src/render/format_number.ts"],"names":[],"mappings":"AAyBA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,MAAM,EACb,aAAS,EACT,kBAAa,KACZ,MAiBF,CAAC"}
|
|
@@ -28,8 +28,9 @@ const trimDecimal = (value, precision) => Number.isInteger(value)
|
|
|
28
28
|
export const formatCompactNumber = (value, unit = '', precision = 1) => {
|
|
29
29
|
const abs = Math.abs(value);
|
|
30
30
|
let index = TIERS.findIndex(({ size }) => abs >= size);
|
|
31
|
-
if (index === -1)
|
|
31
|
+
if (index === -1) {
|
|
32
32
|
index = TIERS.length - 1;
|
|
33
|
+
}
|
|
33
34
|
// A value that rounds up to the tier's next power, `999.96k`, reads as `1m`.
|
|
34
35
|
if (index > 0 &&
|
|
35
36
|
Math.abs(Number((value / TIERS[index].size).toFixed(precision))) >= 1_000) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format_number.js","sourceRoot":"","sources":["../../src/render/format_number.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+EAA+E;AAC/E,6EAA6E;AAC7E,2BAA2B;AAE3B,MAAM,KAAK,GAAG;IACZ,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,EAAE;IACxC,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;IACpC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE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AE,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,EAAE,CAAC;AAC7E,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// Compact numeric formatting, shared by anything that has to fit a number into\n// a small space — chart axis labels, a `compact` structured display value, a\n// text-surface trend line.\n\nconst TIERS = [\n { size: 1_000_000_000_000, suffix: 't' },\n { size: 1_000_000_000, suffix: 'b' },\n { size: 1_000_000, suffix: 'm' },\n { size: 1_000, suffix: 'k' },\n { size: 1, suffix: '' },\n] as const;\n\n// Rounded to `precision` decimals, trailing zeros dropped.\nconst trimDecimal = (value: number, precision: number): string =>\n Number.isInteger(value)\n ? String(value)\n : String(Number(value.toFixed(precision)));\n\n/**\n * `1_284` to `1.3k`, `18_200_000` to `18.2m`, through `b` and `t`, with an\n * optional unit appended. `precision` is the decimals kept, `1` by default.\n *\n * `%` joins without a space because \"99.2 %\" reads wrong; every other unit gets\n * one.\n */\nexport const formatCompactNumber = (\n value: number,\n unit = '',\n precision = 1\n): string => {\n const abs = Math.abs(value);\n let index = TIERS.findIndex(({ size }) => abs >= size);\n if (index === -1) {\n index = TIERS.length - 1;\n }\n // A value that rounds up to the tier's next power, `999.96k`, reads as `1m`.\n if (\n index > 0 &&\n Math.abs(Number((value / TIERS[index]!.size).toFixed(precision))) >= 1_000\n ) {\n index -= 1;\n }\n const { size, suffix } = TIERS[index]!;\n const scaled = `${trimDecimal(value / size, precision)}${suffix}`;\n\n return unit === '' ? scaled : `${scaled}${unit === '%' ? '' : ' '}${unit}`;\n};\n"]}
|