@atlaskit/adf-schema 28.1.5 → 28.1.7
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/CHANGELOG.md +13 -0
- package/index.ts +275 -0
- package/package.json +6 -23
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockQuote-with-attrs.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockQuote-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockQuote-with-marks.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockQuote-without-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/blockquote-with-list-inside.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bodied-extension-with-nested-bodiedExtension.json +28 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bodied-extension-without-content.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bodied-extension-without-extensionKey.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bodied-extension-without-extensionType.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-with-attrs.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-with-marks.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-with-not-listItem-content.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/bulletList-without-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-em.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-strike.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-strong.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-subsup.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-and-underline.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/code-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/codeBlock-with-non-text.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/codeBlock-with-strong.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/codeBlock-with-unknown-attribute.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/codeBlock-with-unsupported-marks.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/decision-with-blockquote.json +31 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/decisionList-with-empty-decision.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/decisionList-with-no-decision.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/doc-with-attrs.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/doc-with-marks.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/doc-without-content.json +4 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/doc-without-version.json +4 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/em-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-as-top-level-node.json +12 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-with-content.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-with-empty-attrs.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-with-marks.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-with-unknown-attr.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/emoji-without-attrs.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/expand-nested-with-marks.json +60 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/expand-with-breakout-inside-of-layout.json +50 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/extension-with-content.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/extension-with-empty-local-id.json +16 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/extension-without-extensionKey.json +12 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/extension-without-extensionType.json +12 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/hardBreak-with-marks.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/hardBreak-with-wrong-text.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-invalid-level-attr.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-non-text-block.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-non-text-inline.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-unknown-attrs.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-with-unsupported-mark.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/heading-without-attrs.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/inlineExtension-with-content.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/inlineExtension-without-extensionKey.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/inlineExtension-without-extensionType.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/layoutSection-with-missing-layoutColumn.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/layoutSection-with-one-column.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/layoutSection-with-overflow-width.json +37 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/layoutSection-with-two-columns-and-breakout-code-block.json +38 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/link-with-empty-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/link-with-unknown-attr.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/link-without-attrs.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/list-with-blockquote.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/listItem-with-attrs.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/listItem-with-empty-content.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/listItem-with-list-as-first-child.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/listItem-with-marks.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-as-top-level-node.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-empty-attrs.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-invalid-alt-text.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-invalid-occurrence-key-attr.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-marks.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-with-unknown-attr.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-without-attrs.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-without-id-attr.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/media-without-type-attr.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaGroup-with-attrs.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaGroup-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaGroup-with-marks.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaGroup-without-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaInline-with-subsup-mark.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-empty-attrs.json +11 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-invalid-caption.json +46 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-invalid-layout-attr.json +38 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-negative-width.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-overflow-width.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mediaSingle-with-zero-width.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mention-with-extra-attrs.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mention-with-invalid-user-type.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mention-with-marks.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mention-without-attrs.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/mono-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/orderedList-with-extra-attrs.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/orderedList-with-marks.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/orderedList-without-content.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-blockquote.json +25 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-codeBlock.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-empty-attrs.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-marks.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-panel.json +25 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-with-unknown-attr.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/panel-without-attrs.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/paragraph-with-text-with-unknown-mark.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/paragraph-with-top-level-content.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/paragraph-with-unsupported-marks.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/placeholder-with-content.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/placeholder-with-empty-attrs.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/rule-with-attrs.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/rule-with-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/rule-with-marks.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/status-with-extra-attr.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/status-without-attrs.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/status-without-color-attr.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/status-without-text-attr.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/strike-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/strong-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/subsup-with-extra-attrs.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/subsup-with-invalid-type-attr.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/subsup-without-attrs.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/subsup-without-type-attr.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-with-breakout-code-block.json +33 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-with-fragment-mark-with-empty-local-id.json +41 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-with-fragment-mark-without-local-id.json +40 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-with-nested-table.json +50 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-without-cells.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/table-without-rows.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/task-with-blockquote.json +31 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/task-with-invalid-state.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/taskItem-with-nested-taskItem.json +70 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/taskList-with-empty-task.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/taskList-with-no-task.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/taskList-with-taskList-as-first-child.json +48 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/text-empty.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/textColor-with-extra-attrs.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/textColor-with-invalid-color-attr.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/textColor-without-attrs.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/textColor-without-color-attr.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/invalid/underline-with-attrs.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/annotation.json +28 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/blockQuote-with-content.json +16 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-Extension-with-rich-body.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-extension-with-empty-content.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-extension-with-media-link.json +41 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-extension-with-nested-extension.json +33 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodied-extension-with-parameters.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bodiedExtension-with-data-consumer-mark.json +47 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/bulletList-with-content.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-empty-attrs.json +11 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-breakout-mark.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-empty-marks.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-language.json +482 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-multiple-text.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-text.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/codeBlock-with-unknown-language.json +13 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/decision-with-mention.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/decisionList-with-decision.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/doc-with-all-content.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/doc-with-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/doc-with-empty-content.json +5 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/embed-card.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/emoji-with-fallback.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/emoji-with-variation.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/emoji.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/expand-with-embed-card.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/expand-with-marks.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/expand-with-nestedExpand.json +136 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/expand.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-data-consumer-mark.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-empty-marks.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-local-id.json +16 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-named-fragment-mark.json +25 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/extension-with-parameters.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/hardBreak-empty-attrs.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/hardBreak-with-text.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/hardBreak.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-code-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-content.json +78 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-em-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-empty-content.json +78 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-empty-marks.json +14 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-link-text.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-strike-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-strong-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-subsup-text.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-supported-mark.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/heading-with-underline-text.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/inlineExtension-with-data-consumer-mark.json +48 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/inlineExtension-with-fragment-mark.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/inlineExtension-with-parameters.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/inlineExtension-without-parameters.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/layout-with-embed.json +51 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/layoutSection-with-three-columns.json +50 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/layoutSection-with-two-columns-and-breakout.json +40 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/layoutSection-with-two-columns.json +37 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/link-with-href-title.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/link-with-href.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-item-with-bullet-list-and-media-single.json +47 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-item-with-media-single-and-bullet-list.json +57 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-item-with-ordered-list.json +37 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-item-with-paragraph.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/list-with-codeBlock.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/listItem-with-content.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-external-with-alt-text-value.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-a-layout-column.json +57 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-a-list-item.json +88 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-a-nested-expand.json +64 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-a-table.json +56 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-single-with-a-link-mark-in-an-expand.json +44 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-alt-text-value.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-alt-text.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-link-mark.json +36 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-occurrence-key.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media-with-type-link.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/media.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaGroup-with-multiple-media.json +27 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaInline-with-file-type-attr.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaInline-with-link-mark.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaInline-with-link-type-attr.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaInline.json +22 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-caption-inside-list-item.json +38 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-caption.json +28 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-link-mark.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-parameters.json +86 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-with-width.json +74 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mediaSingle-without-parameters.json +19 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mention-with-attrs.json +18 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/mention-with-user-type.json +35 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/nested-extensions-with-data-consumer-mark.json +226 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/nested-extensions-without-mark.json +176 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/nestedExpand.json +128 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/orderedList-with-content.json +30 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/orderedList-with-order.json +33 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-info.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-note.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-tip.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-warning.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-with-blockCard.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-with-list.json +31 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/panel-with-paragraph.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-with-content.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-with-empty-content.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-with-empty-marks.json +11 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-with-supported-mark.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/paragraph-without-content.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/placeholder.json +17 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/rule.json +9 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/status-nested-in-list.json +43 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/status-with-all-attrs.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/status-with-default-attrs.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/subsup-as-sub.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/subsup-as-sup.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-empty-cell.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-fragment-mark.json +41 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-header-row.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-layout.json +50 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-local-id.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/table-with-nested-nodes.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/task-with-mention.json +34 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/taskList-with-nested-taskLists.json +74 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/taskList-with-tasks.json +40 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-code-and-link.json +26 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-code.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-em.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-link.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-strong.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-subsup.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-textColor.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text-underline.json +20 -0
- package/src/__tests__/unit/json-schema/v1-reference/full/valid/text.json +15 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/.gitkeep +0 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-empty-attrs.json +10 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-empty-datasource.json +12 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-empty-views.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-id.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-layout.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-views-type.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/blockcard-with-invalid-datasource-width.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/bodiedExtension-with-source-as-string-data-consumer-mark.json +46 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/extension-with-invalid-local-id.json +16 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/extension-with-nonsense-marks.json +21 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/inlineExtension-with-source-as-string-data-consumer-mark.json +48 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/mediaSingle-with-invalid-percentage-width.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/mediaSingle-with-invalid-pixel-width.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/nested-extensions-with-link-mark.json +216 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/table-with-empty-local-id.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/table-with-invalid-local-id.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/invalid/table-with-invalid-width.json +32 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/.gitkeep +0 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/blockcard-with-datasources.json +38 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/blockcard-with-empty-datasource-parameters.json +29 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/blockcard-without-optional-fields.json +23 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/layoutSection-with-one-column.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/mediaSingle-with-percentage-width.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/mediaSingle-with-pixel-width.json +24 -0
- package/src/__tests__/unit/json-schema/v1-reference/stage-0/valid/table-with-width.json +32 -0
- package/src/__tests__/unit/json-schema/v1.ts +53 -0
- package/src/__tests__/unit/schema/create-schema.ts +214 -0
- package/src/__tests__/unit/schema/default-schema.ts +192 -0
- package/src/__tests__/unit/schema/marks/annotation.ts +46 -0
- package/src/__tests__/unit/schema/marks/border.ts +76 -0
- package/src/__tests__/unit/schema/marks/breakout.ts +24 -0
- package/src/__tests__/unit/schema/marks/code.ts +44 -0
- package/src/__tests__/unit/schema/marks/confluence-inline-comment.ts +25 -0
- package/src/__tests__/unit/schema/marks/data-consumer.ts +52 -0
- package/src/__tests__/unit/schema/marks/em.ts +37 -0
- package/src/__tests__/unit/schema/marks/link.ts +188 -0
- package/src/__tests__/unit/schema/marks/strike.ts +37 -0
- package/src/__tests__/unit/schema/marks/strong.ts +43 -0
- package/src/__tests__/unit/schema/marks/subsup.ts +50 -0
- package/src/__tests__/unit/schema/marks/text-color.ts +61 -0
- package/src/__tests__/unit/schema/marks/underline.ts +36 -0
- package/src/__tests__/unit/schema/nodes/_consts.ts +964 -0
- package/src/__tests__/unit/schema/nodes/block-card.ts +184 -0
- package/src/__tests__/unit/schema/nodes/blockquote.ts +44 -0
- package/src/__tests__/unit/schema/nodes/bodied-extension.ts +101 -0
- package/src/__tests__/unit/schema/nodes/code-block.ts +221 -0
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +36 -0
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +35 -0
- package/src/__tests__/unit/schema/nodes/date.ts +51 -0
- package/src/__tests__/unit/schema/nodes/decision-item.ts +46 -0
- package/src/__tests__/unit/schema/nodes/decision-list.ts +52 -0
- package/src/__tests__/unit/schema/nodes/embed-card.ts +60 -0
- package/src/__tests__/unit/schema/nodes/emoji.ts +71 -0
- package/src/__tests__/unit/schema/nodes/expand.ts +51 -0
- package/src/__tests__/unit/schema/nodes/extension.ts +101 -0
- package/src/__tests__/unit/schema/nodes/hard-break.ts +24 -0
- package/src/__tests__/unit/schema/nodes/heading.ts +56 -0
- package/src/__tests__/unit/schema/nodes/image.ts +32 -0
- package/src/__tests__/unit/schema/nodes/inline-card.ts +106 -0
- package/src/__tests__/unit/schema/nodes/inline-extension.ts +79 -0
- package/src/__tests__/unit/schema/nodes/layout-column.ts +54 -0
- package/src/__tests__/unit/schema/nodes/layout-section.ts +95 -0
- package/src/__tests__/unit/schema/nodes/list-item.ts +49 -0
- package/src/__tests__/unit/schema/nodes/media-group.ts +67 -0
- package/src/__tests__/unit/schema/nodes/media-single.ts +171 -0
- package/src/__tests__/unit/schema/nodes/media.ts +388 -0
- package/src/__tests__/unit/schema/nodes/mention.ts +115 -0
- package/src/__tests__/unit/schema/nodes/nestedExpand.ts +72 -0
- package/src/__tests__/unit/schema/nodes/ordered-list.ts +49 -0
- package/src/__tests__/unit/schema/nodes/panel.ts +180 -0
- package/src/__tests__/unit/schema/nodes/paragraph.ts +25 -0
- package/src/__tests__/unit/schema/nodes/placeholder.ts +46 -0
- package/src/__tests__/unit/schema/nodes/rule.ts +24 -0
- package/src/__tests__/unit/schema/nodes/status.ts +120 -0
- package/src/__tests__/unit/schema/nodes/tableNodes.ts +555 -0
- package/src/__tests__/unit/schema/nodes/task-item.ts +39 -0
- package/src/__tests__/unit/schema/nodes/task-list.ts +45 -0
- package/src/__tests__/unit/schema/nodes/unknown-block.ts +42 -0
- package/src/__tests__/unit/schema/nodes/unsupported-block.ts +42 -0
- package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +38 -0
- package/src/__tests__/unit/utils/colors.ts +42 -0
- package/src/__tests__/unit/utils/url.ts +209 -0
- package/src/index.ts +297 -0
- package/src/json-schema/index.ts +2 -0
- package/src/schema/bitbucket-schema.ts +43 -0
- package/src/schema/confluence-schema.ts +76 -0
- package/src/schema/create-schema.ts +337 -0
- package/src/schema/default-schema.ts +180 -0
- package/src/schema/groups.ts +30 -0
- package/src/schema/index.ts +238 -0
- package/src/schema/inline-nodes.ts +9 -0
- package/src/schema/jira-schema.ts +158 -0
- package/src/schema/marks/__tests__/unit/annotation.ts +18 -0
- package/src/schema/marks/alignment.ts +48 -0
- package/src/schema/marks/annotation.ts +107 -0
- package/src/schema/marks/border.ts +74 -0
- package/src/schema/marks/breakout.ts +42 -0
- package/src/schema/marks/code.ts +45 -0
- package/src/schema/marks/confluence-inline-comment.ts +32 -0
- package/src/schema/marks/data-consumer.ts +100 -0
- package/src/schema/marks/em.ts +19 -0
- package/src/schema/marks/fragment.ts +77 -0
- package/src/schema/marks/indentation.ts +47 -0
- package/src/schema/marks/index.ts +61 -0
- package/src/schema/marks/link.ts +139 -0
- package/src/schema/marks/strike.ts +26 -0
- package/src/schema/marks/strong.ts +45 -0
- package/src/schema/marks/subsup.ts +53 -0
- package/src/schema/marks/text-color.ts +172 -0
- package/src/schema/marks/type-ahead-query.ts +22 -0
- package/src/schema/marks/underline.ts +24 -0
- package/src/schema/marks/unsupported-mark.ts +9 -0
- package/src/schema/marks/unsupported-node-attributes.ts +8 -0
- package/src/schema/nodes/block-card.ts +121 -0
- package/src/schema/nodes/blockquote.ts +25 -0
- package/src/schema/nodes/bodied-extension.ts +75 -0
- package/src/schema/nodes/bullet-list.ts +17 -0
- package/src/schema/nodes/caption.ts +51 -0
- package/src/schema/nodes/code-block.ts +176 -0
- package/src/schema/nodes/confluence-jira-issue.ts +43 -0
- package/src/schema/nodes/confluence-unsupported-block.ts +29 -0
- package/src/schema/nodes/confluence-unsupported-inline.ts +30 -0
- package/src/schema/nodes/date.ts +38 -0
- package/src/schema/nodes/decision-item.ts +50 -0
- package/src/schema/nodes/decision-list.ts +56 -0
- package/src/schema/nodes/doc.ts +30 -0
- package/src/schema/nodes/embed-card.ts +62 -0
- package/src/schema/nodes/emoji.ts +89 -0
- package/src/schema/nodes/expand.ts +101 -0
- package/src/schema/nodes/extension.ts +60 -0
- package/src/schema/nodes/hard-break.ts +21 -0
- package/src/schema/nodes/heading.ts +64 -0
- package/src/schema/nodes/image.ts +32 -0
- package/src/schema/nodes/index.ts +184 -0
- package/src/schema/nodes/inline-card.ts +70 -0
- package/src/schema/nodes/inline-extension.ts +57 -0
- package/src/schema/nodes/layout-column.ts +68 -0
- package/src/schema/nodes/layout-section.ts +93 -0
- package/src/schema/nodes/list-item.ts +13 -0
- package/src/schema/nodes/media-group.ts +44 -0
- package/src/schema/nodes/media-inline.ts +19 -0
- package/src/schema/nodes/media-single.ts +179 -0
- package/src/schema/nodes/media.ts +249 -0
- package/src/schema/nodes/mention.ts +86 -0
- package/src/schema/nodes/nested-expand.ts +77 -0
- package/src/schema/nodes/ordered-list.ts +62 -0
- package/src/schema/nodes/panel.ts +133 -0
- package/src/schema/nodes/paragraph.ts +79 -0
- package/src/schema/nodes/placeholder.ts +40 -0
- package/src/schema/nodes/rule.ts +17 -0
- package/src/schema/nodes/status.ts +58 -0
- package/src/schema/nodes/tableNodes.ts +480 -0
- package/src/schema/nodes/task-item.ts +51 -0
- package/src/schema/nodes/task-list.ts +61 -0
- package/src/schema/nodes/text.ts +19 -0
- package/src/schema/nodes/types/block-content.ts +51 -0
- package/src/schema/nodes/types/extensions.ts +36 -0
- package/src/schema/nodes/types/inline-content.ts +56 -0
- package/src/schema/nodes/types/list.ts +54 -0
- package/src/schema/nodes/types/mark.ts +16 -0
- package/src/schema/nodes/types/non-nestable-block-content.ts +39 -0
- package/src/schema/nodes/types/rich-media-common.ts +51 -0
- package/src/schema/nodes/unknown-block.ts +13 -0
- package/src/schema/nodes/unsupported-block.ts +28 -0
- package/src/schema/nodes/unsupported-inline.ts +27 -0
- package/src/schema/unsupported.ts +4 -0
- package/src/steps/__tests__/unit/analytics.ts +72 -0
- package/src/steps/__tests__/unit/link-meta-step.ts +64 -0
- package/src/steps/__tests__/unit/override-document-step.ts +174 -0
- package/src/steps/__tests__/unit/set-attrs.ts +71 -0
- package/src/steps/analytics.ts +189 -0
- package/src/steps/link-meta-step.ts +105 -0
- package/src/steps/override-document-step.ts +97 -0
- package/src/steps/set-attrs.tsx +74 -0
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-0.json +15 -0
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-1.json +15 -0
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-2.json +15 -0
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-3.json +15 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-0.json +9 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-1.json +9 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-2.json +9 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row-inverted.json +98 -0
- package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row.json +71 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1-inverted.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2-inverted.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0-inverted.json +63 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1-inverted.json +64 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1.json +22 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2-inverted.json +63 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2.json +21 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3-inverted.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3.json +19 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0-inverted.json +52 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0.json +38 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1-inverted.json +52 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1.json +38 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2-inverted.json +25 -0
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2.json +11 -0
- package/src/steps/table/__tests__/_utils.ts +103 -0
- package/src/steps/table/__tests__/add-column-merge-columns.ts +491 -0
- package/src/steps/table/__tests__/add-column-merge-rows.ts +450 -0
- package/src/steps/table/__tests__/add-column.ts +610 -0
- package/src/steps/table/add-column.ts +440 -0
- package/src/steps/table/constants.ts +4 -0
- package/src/steps/table/sort-column.ts +57 -0
- package/src/steps/table/types.ts +48 -0
- package/src/steps/table/utils/cell-step.ts +239 -0
- package/src/steps/table/utils/cells-at-column.ts +72 -0
- package/src/steps/table/utils/find-column.ts +90 -0
- package/src/steps/table/utils/get-table-rect-from-doc.ts +37 -0
- package/src/steps/table/utils/side-effects/rows.ts +327 -0
- package/src/steps/table/utils/side-effects/side-effects.ts +90 -0
- package/src/steps/table/utils/side-effects/table.ts +112 -0
- package/src/steps/table/utils/side-effects/types.ts +34 -0
- package/src/steps/table/utils/table-map.ts +28 -0
- package/src/steps/type-ahead.ts +100 -0
- package/src/steps.ts +16 -0
- package/src/utils/colors.ts +171 -0
- package/src/utils/confluence/emoji.ts +99 -0
- package/src/utils/extensions.ts +32 -0
- package/src/utils/index.ts +69 -0
- package/src/utils/parseDOM.ts +2 -0
- package/src/utils/url.ts +173 -0
- package/src/utils/uuid.ts +19 -0
- package/src/version.json +6 -0
- package/babel.config.js +0 -156
@@ -0,0 +1,171 @@
|
|
1
|
+
import * as namedColors from 'css-color-names'; // eslint-disable-line import/extensions
|
2
|
+
|
3
|
+
/**
|
4
|
+
* We're avoding importing these colors from @atlaskit/theme since we
|
5
|
+
* do not want to have react as a dependency of this package.
|
6
|
+
* TODO: Refactor this once tokenization by Core team is ready
|
7
|
+
* https://product-fabric.atlassian.net/browse/CS-908
|
8
|
+
*/
|
9
|
+
|
10
|
+
export const R50 = '#FFEBE6';
|
11
|
+
export const R75 = '#FFBDAD';
|
12
|
+
export const R100 = '#FF8F73';
|
13
|
+
export const R300 = '#FF5630';
|
14
|
+
export const R400 = '#DE350B';
|
15
|
+
export const R500 = '#BF2600';
|
16
|
+
|
17
|
+
export const Y50 = '#FFFAE6';
|
18
|
+
export const Y75 = '#FFF0B3';
|
19
|
+
export const Y200 = '#FFC400';
|
20
|
+
export const Y400 = '#FF991F';
|
21
|
+
export const Y500 = '#FF8B00';
|
22
|
+
|
23
|
+
export const G50 = '#E3FCEF';
|
24
|
+
export const G75 = '#ABF5D1';
|
25
|
+
export const G200 = '#57D9A3';
|
26
|
+
export const G300 = '#36B37E';
|
27
|
+
export const G400 = '#00875A';
|
28
|
+
export const G500 = '#006644';
|
29
|
+
|
30
|
+
export const B50 = '#DEEBFF';
|
31
|
+
export const B75 = '#B3D4FF';
|
32
|
+
export const B100 = '#4C9AFF';
|
33
|
+
export const B400 = '#0052CC';
|
34
|
+
export const B500 = '#0747A6';
|
35
|
+
|
36
|
+
export const N0 = '#FFFFFF';
|
37
|
+
export const N20 = '#F4F5F7';
|
38
|
+
export const N30 = '#EBECF0';
|
39
|
+
export const N40 = '#DFE1E6';
|
40
|
+
export const N50 = '#C1C7D0';
|
41
|
+
export const N60 = '#B3BAC5';
|
42
|
+
export const N80 = '#97A0AF';
|
43
|
+
export const N90 = '#8993A4';
|
44
|
+
export const N200 = '#6B778C';
|
45
|
+
export const N300 = '#5E6C84';
|
46
|
+
export const N300A = '#091E4224';
|
47
|
+
export const N500 = '#42526E';
|
48
|
+
export const N600 = '#758195';
|
49
|
+
export const N800 = '#172B4D';
|
50
|
+
export const N1000 = '#172B4D';
|
51
|
+
|
52
|
+
export const P50 = '#EAE6FF';
|
53
|
+
export const P75 = '#C0B6F2';
|
54
|
+
export const P100 = '#998DD9';
|
55
|
+
export const P300 = '#6554C0';
|
56
|
+
export const P400 = '#5243AA';
|
57
|
+
export const P500 = '#403294';
|
58
|
+
|
59
|
+
export const T50 = '#E6FCFF';
|
60
|
+
export const T75 = '#B3F5FF';
|
61
|
+
export const T100 = '#79E2F2';
|
62
|
+
export const T300 = '#00B8D9';
|
63
|
+
export const T500 = '#008DA6';
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @return String with HEX-coded color.
|
67
|
+
*/
|
68
|
+
export function normalizeHexColor(
|
69
|
+
color: string | null,
|
70
|
+
defaultColor?: string,
|
71
|
+
): string | null {
|
72
|
+
if (!color) {
|
73
|
+
return null;
|
74
|
+
}
|
75
|
+
|
76
|
+
// Normalize to hex
|
77
|
+
color = color.trim().toLowerCase();
|
78
|
+
if (isHex(color)) {
|
79
|
+
// Normalize 3-hex to 6-hex colours
|
80
|
+
if (color.length === 4) {
|
81
|
+
color = color
|
82
|
+
.split('')
|
83
|
+
.map((c) => (c === '#' ? '#' : `${c}${c}`))
|
84
|
+
.join('');
|
85
|
+
}
|
86
|
+
} else if (isRgb(color)) {
|
87
|
+
return rgbToHex(color);
|
88
|
+
} else {
|
89
|
+
// http://dev.w3.org/csswg/css-color/#named-colors
|
90
|
+
if (color === 'default') {
|
91
|
+
return null;
|
92
|
+
} else if ((namedColors).default && (namedColors as any).default[color]) {
|
93
|
+
color = (namedColors as any).default[color];
|
94
|
+
} else if (namedColors && namedColors[color]) {
|
95
|
+
color = namedColors[color];
|
96
|
+
} else {
|
97
|
+
return null;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
if (color === defaultColor) {
|
102
|
+
return null;
|
103
|
+
}
|
104
|
+
|
105
|
+
return color;
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Converts hex color format to rgb.
|
110
|
+
* Works well with full hex color format and shortcut as well.
|
111
|
+
*
|
112
|
+
* @param hex - hex color string (#xxx, or #xxxxxx)
|
113
|
+
*/
|
114
|
+
export function hexToRgb(color: string): string | null {
|
115
|
+
if (!isHex(color)) {
|
116
|
+
return null;
|
117
|
+
}
|
118
|
+
|
119
|
+
let colorBits = color.substring(1).split('');
|
120
|
+
if (colorBits.length === 3) {
|
121
|
+
colorBits = [
|
122
|
+
colorBits[0],
|
123
|
+
colorBits[0],
|
124
|
+
colorBits[1],
|
125
|
+
colorBits[1],
|
126
|
+
colorBits[2],
|
127
|
+
colorBits[2],
|
128
|
+
];
|
129
|
+
}
|
130
|
+
|
131
|
+
const rgb = Number(`0x${colorBits.join('')}`);
|
132
|
+
// eslint-disable-next-line no-bitwise
|
133
|
+
return `rgb(${(rgb >> 16) & 255},${(rgb >> 8) & 255},${rgb & 255})`;
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Converts hex color format to rgba.
|
138
|
+
*
|
139
|
+
* @param hex - hex color string (#xxx, or #xxxxxx)
|
140
|
+
*/
|
141
|
+
export function hexToRgba(rawColor: string, alpha: number): string | null {
|
142
|
+
let color = normalizeHexColor(rawColor);
|
143
|
+
if (!color) {
|
144
|
+
return null;
|
145
|
+
}
|
146
|
+
const hex2rgb = (color: string) =>
|
147
|
+
color.match(/[a-z0-9]{2}/gi)!.map((hex) => parseInt(hex, 16));
|
148
|
+
return `rgba(${hex2rgb(color).concat(alpha).join(',')})`;
|
149
|
+
}
|
150
|
+
|
151
|
+
export function rgbToHex(value: string): string | null {
|
152
|
+
const matches = value.match(/(0?\.?\d{1,3})%?\b/g);
|
153
|
+
|
154
|
+
if (matches && matches.length >= 3) {
|
155
|
+
const [red, green, blue] = matches.map(Number);
|
156
|
+
return (
|
157
|
+
'#' +
|
158
|
+
(blue | (green << 8) | (red << 16) | (1 << 24)).toString(16).slice(1) // eslint-disable-line no-bitwise
|
159
|
+
);
|
160
|
+
}
|
161
|
+
|
162
|
+
return null;
|
163
|
+
}
|
164
|
+
|
165
|
+
export function isRgb(color: string): boolean {
|
166
|
+
return /rgba?\(/.test(color);
|
167
|
+
}
|
168
|
+
|
169
|
+
export function isHex(color: string): boolean {
|
170
|
+
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(color);
|
171
|
+
}
|
@@ -0,0 +1,99 @@
|
|
1
|
+
// Default emoji id for Confluence glyphs that has no match to Fabric Emoji
|
2
|
+
const DEFAULT_EMOJI_ID = '2b50';
|
3
|
+
|
4
|
+
// Default ac:name for emoticons as a fallback is `blue-star`
|
5
|
+
const DEFAULT_EMOJI_ACNAME = 'blue-star';
|
6
|
+
|
7
|
+
// ac:hipchat-emoticon prefix when converting to Emoji ID
|
8
|
+
const HC_EMOTICON_PREFIX = 'atlassian-';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Confluence glyphs ac:name of <ac:emoticon /> map to new emojis
|
12
|
+
* {
|
13
|
+
* [ac:name] : ['emoji-id', 'emoji-shortName', 'emoji-fallback']
|
14
|
+
* ...
|
15
|
+
* }
|
16
|
+
* Glyphs that do not map to Fabric Emoji
|
17
|
+
* will be mapped to Emoji Id '2b50' (:star:) with preserving ac:name as shortName attribute;
|
18
|
+
*/
|
19
|
+
const acNameToEmojiMap = {
|
20
|
+
smile: ['1f642', ':slight_smile:', '\uD83D\uDE42'],
|
21
|
+
sad: ['1f641', ':slight_frown:', '\uD83D\uDE41'],
|
22
|
+
cheeky: ['1f61b', ':stuck_out_tongue:', '\uD83D\uDE1B'],
|
23
|
+
laugh: ['1f600', ':grinning:', '\uD83D\uDE00'],
|
24
|
+
wink: ['1f609', ':wink:', '\uD83D\uDE09'],
|
25
|
+
information: ['2139', ':information_source:', '\u2139'],
|
26
|
+
tick: ['2705', ':white_check_mark:', '\u2705'],
|
27
|
+
cross: ['274c', ':x:', '\u274C'],
|
28
|
+
warning: ['26a0', ':warning:', '\u26A0'],
|
29
|
+
plus: ['2795', ':heavy_plus_sign:', '\u2795'],
|
30
|
+
minus: ['2796', ':heavy_minus_sign:', '\u2796'],
|
31
|
+
question: ['2753', ':question:', '\u003F'],
|
32
|
+
'thumbs-up': ['1f44d', ':thumbsup:', '\uD83D\uDC4D'],
|
33
|
+
'thumbs-down': ['1f44e', ':thumbsdown:', '\uD83D\uDC4E'],
|
34
|
+
'light-on': ['1f4a1', ':bulb:', '\uD83D\uDCA1'],
|
35
|
+
'yellow-star': ['2b50', ':star:', '\uD83D\uDC9B'],
|
36
|
+
'light-off': ['1f6ab', ':no_entry_sign:', '\uD83D\uDEAB'],
|
37
|
+
'red-star': ['2764', ':heart:', '\u2764\uFE0F'],
|
38
|
+
'green-star': ['1f49a', ':green_heart:', '\uD83D\uDC9A'],
|
39
|
+
'blue-star': ['1f499', ':blue_heart:', '\uD83D\uDC99'],
|
40
|
+
heart: ['2764', ':heart:', '\u2764\uFE0F'],
|
41
|
+
'broken-heart': ['1f494', ':broken_heart:', '\uD83D\uDC94'],
|
42
|
+
};
|
43
|
+
|
44
|
+
export type NameToEmoji = keyof typeof acNameToEmojiMap;
|
45
|
+
|
46
|
+
export function acNameToEmoji(acName: NameToEmoji) {
|
47
|
+
const emojiData = acNameToEmojiMap[acName];
|
48
|
+
return emojiData
|
49
|
+
? {
|
50
|
+
id: emojiData[0],
|
51
|
+
shortName: emojiData[1],
|
52
|
+
text: emojiData[2],
|
53
|
+
}
|
54
|
+
: {
|
55
|
+
id: DEFAULT_EMOJI_ID,
|
56
|
+
shortName: `:${acName}:`,
|
57
|
+
text: '',
|
58
|
+
};
|
59
|
+
}
|
60
|
+
|
61
|
+
export function emojiIdToAcName(emojiId: string) {
|
62
|
+
const filterEmojis = (acName: keyof typeof acNameToEmojiMap) =>
|
63
|
+
acNameToEmojiMap[acName] ? acNameToEmojiMap[acName][0] === emojiId : false;
|
64
|
+
return (
|
65
|
+
Object.keys(acNameToEmojiMap) as Array<keyof typeof acNameToEmoji>
|
66
|
+
).filter(filterEmojis)[0];
|
67
|
+
}
|
68
|
+
|
69
|
+
export function acShortcutToEmoji(hipchatEmoticonShortName: string) {
|
70
|
+
return {
|
71
|
+
id: `${HC_EMOTICON_PREFIX}${hipchatEmoticonShortName}`,
|
72
|
+
shortName: `:${hipchatEmoticonShortName}:`,
|
73
|
+
text: '',
|
74
|
+
};
|
75
|
+
}
|
76
|
+
|
77
|
+
function getAcNameFromShortName(shortName: string) {
|
78
|
+
return shortName.slice(
|
79
|
+
shortName[0] === ':' ? 1 : 0,
|
80
|
+
shortName[shortName.length - 1] === ':' ? -1 : shortName.length,
|
81
|
+
);
|
82
|
+
}
|
83
|
+
|
84
|
+
export function getEmojiAcName({
|
85
|
+
id,
|
86
|
+
shortName,
|
87
|
+
}: {
|
88
|
+
id: string;
|
89
|
+
shortName: string;
|
90
|
+
}) {
|
91
|
+
if (DEFAULT_EMOJI_ID === id) {
|
92
|
+
const possibleName = getAcNameFromShortName(shortName);
|
93
|
+
if (possibleName in acNameToEmojiMap) {
|
94
|
+
return possibleName;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
return emojiIdToAcName(id) || DEFAULT_EMOJI_ACNAME;
|
99
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { ExtensionAttributes, Layout } from '../schema/nodes/types/extensions';
|
2
|
+
|
3
|
+
export const isValidLayout = (name: string | null): name is Layout => {
|
4
|
+
return !!name && ['default', 'wide', 'full-width'].includes(name);
|
5
|
+
};
|
6
|
+
|
7
|
+
export const getExtensionAttrs = (
|
8
|
+
dom: HTMLElement,
|
9
|
+
isInline: boolean = false,
|
10
|
+
): ExtensionAttributes | false => {
|
11
|
+
const extensionType = dom.getAttribute('data-extension-type');
|
12
|
+
const extensionKey = dom.getAttribute('data-extension-key');
|
13
|
+
|
14
|
+
if (!extensionType || !extensionKey) {
|
15
|
+
return false;
|
16
|
+
}
|
17
|
+
|
18
|
+
const attrs: ExtensionAttributes = {
|
19
|
+
extensionType,
|
20
|
+
extensionKey,
|
21
|
+
text: dom.getAttribute('data-text') || undefined,
|
22
|
+
parameters: JSON.parse(dom.getAttribute('data-parameters') || '{}'),
|
23
|
+
localId: dom.getAttribute('data-local-id') || undefined,
|
24
|
+
};
|
25
|
+
|
26
|
+
if (!isInline) {
|
27
|
+
const rawLayout = dom.getAttribute('data-layout');
|
28
|
+
attrs.layout = isValidLayout(rawLayout) ? rawLayout : 'default';
|
29
|
+
}
|
30
|
+
|
31
|
+
return attrs;
|
32
|
+
};
|
@@ -0,0 +1,69 @@
|
|
1
|
+
export {
|
2
|
+
acNameToEmoji,
|
3
|
+
acShortcutToEmoji,
|
4
|
+
emojiIdToAcName,
|
5
|
+
getEmojiAcName,
|
6
|
+
} from './confluence/emoji';
|
7
|
+
export type { NameToEmoji } from './confluence/emoji';
|
8
|
+
export { generateUuid, uuid } from './uuid';
|
9
|
+
export {
|
10
|
+
B100,
|
11
|
+
B400,
|
12
|
+
B50,
|
13
|
+
B500,
|
14
|
+
B75,
|
15
|
+
G200,
|
16
|
+
G300,
|
17
|
+
G400,
|
18
|
+
G50,
|
19
|
+
G500,
|
20
|
+
G75,
|
21
|
+
N0,
|
22
|
+
N20,
|
23
|
+
N200,
|
24
|
+
N30,
|
25
|
+
N300,
|
26
|
+
N40,
|
27
|
+
N50,
|
28
|
+
N500,
|
29
|
+
N60,
|
30
|
+
N80,
|
31
|
+
N800,
|
32
|
+
N90,
|
33
|
+
P100,
|
34
|
+
P300,
|
35
|
+
P400,
|
36
|
+
P50,
|
37
|
+
P500,
|
38
|
+
P75,
|
39
|
+
R100,
|
40
|
+
R300,
|
41
|
+
R400,
|
42
|
+
R50,
|
43
|
+
R500,
|
44
|
+
R75,
|
45
|
+
T100,
|
46
|
+
T300,
|
47
|
+
T50,
|
48
|
+
T500,
|
49
|
+
T75,
|
50
|
+
Y200,
|
51
|
+
Y400,
|
52
|
+
Y50,
|
53
|
+
Y500,
|
54
|
+
Y75,
|
55
|
+
hexToRgb,
|
56
|
+
hexToRgba,
|
57
|
+
isHex,
|
58
|
+
isRgb,
|
59
|
+
normalizeHexColor,
|
60
|
+
rgbToHex,
|
61
|
+
} from './colors';
|
62
|
+
export {
|
63
|
+
getLinkMatch,
|
64
|
+
isSafeUrl,
|
65
|
+
normalizeUrl,
|
66
|
+
linkify,
|
67
|
+
linkifyMatch,
|
68
|
+
} from './url';
|
69
|
+
export type { Match } from './url';
|
package/src/utils/url.ts
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
/**
|
2
|
+
* This file has been partially duplicated in packages/linking-platform/linking-common/src/url.ts
|
3
|
+
* Any changes made here should be mirrored there.
|
4
|
+
* Ticket for dedeplication: https://product-fabric.atlassian.net/browse/EDM-7138
|
5
|
+
* Ticket for fixing linkification of filename-like urls: https://product-fabric.atlassian.net/browse/EDM-7190
|
6
|
+
*/
|
7
|
+
import LinkifyIt from 'linkify-it';
|
8
|
+
|
9
|
+
const whitelistedURLPatterns = [
|
10
|
+
/^https?:\/\//im,
|
11
|
+
/^ftps?:\/\//im,
|
12
|
+
/^gopher:\/\//im,
|
13
|
+
/^integrity:\/\//im,
|
14
|
+
/^file:\/\//im,
|
15
|
+
/^smb:\/\//im,
|
16
|
+
/^dynamicsnav:\/\//im,
|
17
|
+
/^jamfselfservice:\/\//im,
|
18
|
+
/^\//im,
|
19
|
+
/^mailto:/im,
|
20
|
+
/^skype:/im,
|
21
|
+
/^callto:/im,
|
22
|
+
/^facetime:/im,
|
23
|
+
/^git:/im,
|
24
|
+
/^irc6?:/im,
|
25
|
+
/^news:/im,
|
26
|
+
/^nntp:/im,
|
27
|
+
/^feed:/im,
|
28
|
+
/^cvs:/im,
|
29
|
+
/^svn:/im,
|
30
|
+
/^mvn:/im,
|
31
|
+
/^ssh:/im,
|
32
|
+
/^scp:\/\//im,
|
33
|
+
/^sftp:\/\//im,
|
34
|
+
/^itms:/im,
|
35
|
+
// This is not a valid notes link, but we support this pattern for backwards compatibility
|
36
|
+
/^notes:/im,
|
37
|
+
/^notes:\/\//im,
|
38
|
+
/^hipchat:\/\//im,
|
39
|
+
// This is not a valid sourcetree link, but we support this pattern for backwards compatibility
|
40
|
+
/^sourcetree:/im,
|
41
|
+
/^sourcetree:\/\//im,
|
42
|
+
/^urn:/im,
|
43
|
+
/^tel:/im,
|
44
|
+
/^xmpp:/im,
|
45
|
+
/^telnet:/im,
|
46
|
+
/^vnc:/im,
|
47
|
+
/^rdp:/im,
|
48
|
+
/^whatsapp:/im,
|
49
|
+
/^slack:/im,
|
50
|
+
/^sips?:/im,
|
51
|
+
/^magnet:/im,
|
52
|
+
/^#/im,
|
53
|
+
];
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Please notify the Editor Mobile team (Slack: #help-mobilekit) if the logic for this changes.
|
57
|
+
*/
|
58
|
+
export const isSafeUrl = (url: string): boolean => {
|
59
|
+
const urlTrimmed = url.trim();
|
60
|
+
if (urlTrimmed.length === 0) {
|
61
|
+
return true;
|
62
|
+
}
|
63
|
+
return whitelistedURLPatterns.some((p) => p.test(urlTrimmed));
|
64
|
+
};
|
65
|
+
|
66
|
+
export interface Match {
|
67
|
+
schema: any;
|
68
|
+
index: number;
|
69
|
+
lastIndex: number;
|
70
|
+
raw: string;
|
71
|
+
text: string;
|
72
|
+
url: string;
|
73
|
+
length?: number;
|
74
|
+
input?: string;
|
75
|
+
}
|
76
|
+
|
77
|
+
export const linkify = LinkifyIt();
|
78
|
+
linkify.add('sourcetree:', 'http:');
|
79
|
+
linkify.add('jamfselfservice:', 'http:');
|
80
|
+
|
81
|
+
const urlWithoutSpacesValidator: LinkifyIt.Rule = {
|
82
|
+
validate: /[^\s]+/,
|
83
|
+
};
|
84
|
+
|
85
|
+
// `tel:` URI spec is https://datatracker.ietf.org/doc/html/rfc3966
|
86
|
+
// We're not validating the phone number or separators - but if there's a space it definitely isn't a valid `tel:` URI
|
87
|
+
linkify.add('tel:', urlWithoutSpacesValidator);
|
88
|
+
|
89
|
+
// https://datatracker.ietf.org/doc/html/rfc8089
|
90
|
+
linkify.add('file:', urlWithoutSpacesValidator);
|
91
|
+
|
92
|
+
linkify.add('notes:', 'http:');
|
93
|
+
|
94
|
+
const tlds =
|
95
|
+
'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split(
|
96
|
+
'|',
|
97
|
+
);
|
98
|
+
const tlds2Char =
|
99
|
+
'a[cdefgilmnoqrtuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrtuvwxyz]|n[acefgilopruz]|om|p[aefghkmnrtw]|qa|r[eosuw]|s[abcdegijklmnrtuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
|
100
|
+
tlds.push(tlds2Char);
|
101
|
+
linkify.tlds(tlds, false);
|
102
|
+
|
103
|
+
// linkify-it mishandles closing braces on long urls, so we preference using our own regex first:
|
104
|
+
// https://product-fabric.atlassian.net/browse/ED-13669
|
105
|
+
export const LINK_REGEXP =
|
106
|
+
/(https?|ftp|jamfselfservice|gopher|dynamicsnav|integrity|file|smb):\/\/[^\s]+/;
|
107
|
+
|
108
|
+
/** Attempt to find a link match using a regex string defining a URL */
|
109
|
+
export const linkifyMatch = (text: string): Match[] => {
|
110
|
+
if (!LINK_REGEXP.test(text)) {
|
111
|
+
return [];
|
112
|
+
}
|
113
|
+
|
114
|
+
const matches: Match[] = [];
|
115
|
+
let startpos = 0;
|
116
|
+
let substr;
|
117
|
+
|
118
|
+
while ((substr = text.substr(startpos))) {
|
119
|
+
const link = (substr.match(LINK_REGEXP) || [''])[0];
|
120
|
+
if (link) {
|
121
|
+
const index = substr.search(LINK_REGEXP);
|
122
|
+
const start = index >= 0 ? index + startpos : index;
|
123
|
+
const end = start + link.length;
|
124
|
+
matches.push({
|
125
|
+
index: start,
|
126
|
+
lastIndex: end,
|
127
|
+
raw: link,
|
128
|
+
url: link,
|
129
|
+
text: link,
|
130
|
+
schema: '',
|
131
|
+
});
|
132
|
+
startpos += end;
|
133
|
+
} else {
|
134
|
+
break;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
return matches;
|
139
|
+
};
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Attempt to find a link match. Tries to use our regex search first.
|
143
|
+
* If this doesn't match (e.g. no protocol), try using linkify-it library.
|
144
|
+
* Returns null if url string empty or no string given, or if no match found.
|
145
|
+
*/
|
146
|
+
export function getLinkMatch(str?: string): Match | null {
|
147
|
+
if (!str) {
|
148
|
+
return null;
|
149
|
+
}
|
150
|
+
// linkify-it mishandles closing braces on long urls, so we preference using our own regex first:
|
151
|
+
// https://product-fabric.atlassian.net/browse/ED-13669
|
152
|
+
let match: null | Match[] = linkifyMatch(str);
|
153
|
+
if (!match.length) {
|
154
|
+
match = linkify.match(str);
|
155
|
+
}
|
156
|
+
return match && match[0];
|
157
|
+
}
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Adds protocol to url if needed.
|
161
|
+
* Returns empty string if no url given or if no link match found.
|
162
|
+
*/
|
163
|
+
export function normalizeUrl(url?: string) {
|
164
|
+
const match = getLinkMatch(url);
|
165
|
+
return (match && match.url) || '';
|
166
|
+
}
|
167
|
+
|
168
|
+
/**
|
169
|
+
* checks if root relative link
|
170
|
+
*/
|
171
|
+
export function isRootRelative(url: string) {
|
172
|
+
return url.startsWith('/');
|
173
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/* eslint-disable no-bitwise */
|
2
|
+
export const generateUuid = () =>
|
3
|
+
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
4
|
+
const r = (Math.random() * 16) | 0;
|
5
|
+
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
6
|
+
});
|
7
|
+
/* eslint-enable no-bitwise */
|
8
|
+
|
9
|
+
let staticValue: string | false = false;
|
10
|
+
|
11
|
+
export const uuid = {
|
12
|
+
setStatic(value: string | false) {
|
13
|
+
staticValue = value;
|
14
|
+
},
|
15
|
+
|
16
|
+
generate() {
|
17
|
+
return staticValue || generateUuid();
|
18
|
+
},
|
19
|
+
};
|