@atlaskit/adf-schema 19.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1524 -0
- package/LICENSE +13 -0
- package/build/tsconfig.json +17 -0
- package/dist/cjs/index.js +1089 -0
- package/dist/cjs/schema/bitbucket-schema.js +14 -0
- package/dist/cjs/schema/confluence-schema.js +21 -0
- package/dist/cjs/schema/create-schema.js +354 -0
- package/dist/cjs/schema/default-schema.js +52 -0
- package/dist/cjs/schema/groups.js +35 -0
- package/dist/cjs/schema/index.js +755 -0
- package/dist/cjs/schema/inline-nodes.js +20 -0
- package/dist/cjs/schema/jira-schema.js +118 -0
- package/dist/cjs/schema/marks/alignment.js +39 -0
- package/dist/cjs/schema/marks/annotation.js +96 -0
- package/dist/cjs/schema/marks/breakout.js +32 -0
- package/dist/cjs/schema/marks/code.js +46 -0
- package/dist/cjs/schema/marks/confluence-inline-comment.js +30 -0
- package/dist/cjs/schema/marks/data-consumer.js +71 -0
- package/dist/cjs/schema/marks/em.js +25 -0
- package/dist/cjs/schema/marks/indentation.js +32 -0
- package/dist/cjs/schema/marks/index.js +189 -0
- package/dist/cjs/schema/marks/link.js +128 -0
- package/dist/cjs/schema/marks/strike.js +29 -0
- package/dist/cjs/schema/marks/strong.js +37 -0
- package/dist/cjs/schema/marks/subsup.js +61 -0
- package/dist/cjs/schema/marks/text-color.js +93 -0
- package/dist/cjs/schema/marks/type-ahead-query.js +31 -0
- package/dist/cjs/schema/marks/underline.js +25 -0
- package/dist/cjs/schema/marks/unsupported-mark.js +15 -0
- package/dist/cjs/schema/marks/unsupported-node-attributes.js +16 -0
- package/dist/cjs/schema/nodes/block-card.js +56 -0
- package/dist/cjs/schema/nodes/blockquote.js +23 -0
- package/dist/cjs/schema/nodes/bodied-extension.js +66 -0
- package/dist/cjs/schema/nodes/bullet-list.js +29 -0
- package/dist/cjs/schema/nodes/caption.js +27 -0
- package/dist/cjs/schema/nodes/code-block.js +160 -0
- package/dist/cjs/schema/nodes/confluence-jira-issue.js +54 -0
- package/dist/cjs/schema/nodes/confluence-unsupported-block.js +33 -0
- package/dist/cjs/schema/nodes/confluence-unsupported-inline.js +34 -0
- package/dist/cjs/schema/nodes/date.js +36 -0
- package/dist/cjs/schema/nodes/decision-item.js +45 -0
- package/dist/cjs/schema/nodes/decision-list.js +45 -0
- package/dist/cjs/schema/nodes/doc.js +15 -0
- package/dist/cjs/schema/nodes/embed-card.js +62 -0
- package/dist/cjs/schema/nodes/emoji.js +73 -0
- package/dist/cjs/schema/nodes/expand.js +86 -0
- package/dist/cjs/schema/nodes/extension.js +59 -0
- package/dist/cjs/schema/nodes/hard-break.js +22 -0
- package/dist/cjs/schema/nodes/heading.js +69 -0
- package/dist/cjs/schema/nodes/image.js +40 -0
- package/dist/cjs/schema/nodes/index.js +539 -0
- package/dist/cjs/schema/nodes/inline-card.js +64 -0
- package/dist/cjs/schema/nodes/inline-extension.js +54 -0
- package/dist/cjs/schema/nodes/layout-column.js +53 -0
- package/dist/cjs/schema/nodes/layout-section.js +61 -0
- package/dist/cjs/schema/nodes/list-item.js +25 -0
- package/dist/cjs/schema/nodes/media-group.js +29 -0
- package/dist/cjs/schema/nodes/media-inline.js +11 -0
- package/dist/cjs/schema/nodes/media-single.js +101 -0
- package/dist/cjs/schema/nodes/media.js +196 -0
- package/dist/cjs/schema/nodes/mention.js +90 -0
- package/dist/cjs/schema/nodes/nested-expand.js +64 -0
- package/dist/cjs/schema/nodes/ordered-list.js +29 -0
- package/dist/cjs/schema/nodes/panel.js +85 -0
- package/dist/cjs/schema/nodes/paragraph.js +45 -0
- package/dist/cjs/schema/nodes/placeholder.js +39 -0
- package/dist/cjs/schema/nodes/rule.js +21 -0
- package/dist/cjs/schema/nodes/status.js +56 -0
- package/dist/cjs/schema/nodes/tableNodes.js +276 -0
- package/dist/cjs/schema/nodes/task-item.js +46 -0
- package/dist/cjs/schema/nodes/task-list.js +45 -0
- package/dist/cjs/schema/nodes/text.js +17 -0
- package/dist/cjs/schema/nodes/types/block-content.js +5 -0
- package/dist/cjs/schema/nodes/types/extensions.js +5 -0
- package/dist/cjs/schema/nodes/types/inline-content.js +5 -0
- package/dist/cjs/schema/nodes/types/mark.js +5 -0
- package/dist/cjs/schema/nodes/types/non-nestable-block-content.js +5 -0
- package/dist/cjs/schema/nodes/types/rich-media-common.js +5 -0
- package/dist/cjs/schema/nodes/unknown-block.js +21 -0
- package/dist/cjs/schema/nodes/unsupported-block.js +33 -0
- package/dist/cjs/schema/nodes/unsupported-inline.js +32 -0
- package/dist/cjs/schema/unsupported.js +8 -0
- package/dist/cjs/steps/analytics.js +183 -0
- package/dist/cjs/steps/set-attrs.js +106 -0
- package/dist/cjs/steps/table/add-column.js +453 -0
- package/dist/cjs/steps/table/constants.js +13 -0
- package/dist/cjs/steps/table/sort-column.js +87 -0
- package/dist/cjs/steps/table/types.js +5 -0
- package/dist/cjs/steps/table/utils/cell-step.js +233 -0
- package/dist/cjs/steps/table/utils/cells-at-column.js +94 -0
- package/dist/cjs/steps/table/utils/find-column.js +94 -0
- package/dist/cjs/steps/table/utils/get-table-rect-from-doc.js +38 -0
- package/dist/cjs/steps/table/utils/side-effects/rows.js +370 -0
- package/dist/cjs/steps/table/utils/side-effects/side-effects.js +106 -0
- package/dist/cjs/steps/table/utils/side-effects/table.js +126 -0
- package/dist/cjs/steps/table/utils/side-effects/types.js +5 -0
- package/dist/cjs/steps/table/utils/table-map.js +36 -0
- package/dist/cjs/steps/type-ahead.js +134 -0
- package/dist/cjs/steps.js +59 -0
- package/dist/cjs/utils/colors.js +234 -0
- package/dist/cjs/utils/confluence/emoji.js +97 -0
- package/dist/cjs/utils/extensions.js +39 -0
- package/dist/cjs/utils/index.js +373 -0
- package/dist/cjs/utils/parseDOM.js +12 -0
- package/dist/cjs/utils/url.js +38 -0
- package/dist/cjs/utils/uuid.js +28 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/index.js +2 -0
- package/dist/es2019/schema/bitbucket-schema.js +5 -0
- package/dist/es2019/schema/confluence-schema.js +11 -0
- package/dist/es2019/schema/create-schema.js +325 -0
- package/dist/es2019/schema/default-schema.js +35 -0
- package/dist/es2019/schema/groups.js +23 -0
- package/dist/es2019/schema/index.js +9 -0
- package/dist/es2019/schema/inline-nodes.js +3 -0
- package/dist/es2019/schema/jira-schema.js +88 -0
- package/dist/es2019/schema/marks/alignment.js +32 -0
- package/dist/es2019/schema/marks/annotation.js +80 -0
- package/dist/es2019/schema/marks/breakout.js +29 -0
- package/dist/es2019/schema/marks/code.js +43 -0
- package/dist/es2019/schema/marks/confluence-inline-comment.js +24 -0
- package/dist/es2019/schema/marks/data-consumer.js +61 -0
- package/dist/es2019/schema/marks/em.js +22 -0
- package/dist/es2019/schema/marks/indentation.js +27 -0
- package/dist/es2019/schema/marks/index.js +17 -0
- package/dist/es2019/schema/marks/link.js +105 -0
- package/dist/es2019/schema/marks/strike.js +24 -0
- package/dist/es2019/schema/marks/strong.js +40 -0
- package/dist/es2019/schema/marks/subsup.js +51 -0
- package/dist/es2019/schema/marks/text-color.js +67 -0
- package/dist/es2019/schema/marks/type-ahead-query.js +23 -0
- package/dist/es2019/schema/marks/underline.js +20 -0
- package/dist/es2019/schema/marks/unsupported-mark.js +9 -0
- package/dist/es2019/schema/marks/unsupported-node-attributes.js +10 -0
- package/dist/es2019/schema/nodes/block-card.js +50 -0
- package/dist/es2019/schema/nodes/blockquote.js +17 -0
- package/dist/es2019/schema/nodes/bodied-extension.js +58 -0
- package/dist/es2019/schema/nodes/bullet-list.js +23 -0
- package/dist/es2019/schema/nodes/caption.js +21 -0
- package/dist/es2019/schema/nodes/code-block.js +143 -0
- package/dist/es2019/schema/nodes/confluence-jira-issue.js +49 -0
- package/dist/es2019/schema/nodes/confluence-unsupported-block.js +30 -0
- package/dist/es2019/schema/nodes/confluence-unsupported-inline.js +31 -0
- package/dist/es2019/schema/nodes/date.js +28 -0
- package/dist/es2019/schema/nodes/decision-item.js +37 -0
- package/dist/es2019/schema/nodes/decision-list.js +41 -0
- package/dist/es2019/schema/nodes/doc.js +7 -0
- package/dist/es2019/schema/nodes/embed-card.js +55 -0
- package/dist/es2019/schema/nodes/emoji.js +67 -0
- package/dist/es2019/schema/nodes/expand.js +73 -0
- package/dist/es2019/schema/nodes/extension.js +51 -0
- package/dist/es2019/schema/nodes/hard-break.js +16 -0
- package/dist/es2019/schema/nodes/heading.js +63 -0
- package/dist/es2019/schema/nodes/image.js +37 -0
- package/dist/es2019/schema/nodes/index.js +44 -0
- package/dist/es2019/schema/nodes/inline-card.js +58 -0
- package/dist/es2019/schema/nodes/inline-extension.js +46 -0
- package/dist/es2019/schema/nodes/layout-column.js +49 -0
- package/dist/es2019/schema/nodes/layout-section.js +56 -0
- package/dist/es2019/schema/nodes/list-item.js +20 -0
- package/dist/es2019/schema/nodes/media-group.js +23 -0
- package/dist/es2019/schema/nodes/media-inline.js +2 -0
- package/dist/es2019/schema/nodes/media-single.js +77 -0
- package/dist/es2019/schema/nodes/media.js +165 -0
- package/dist/es2019/schema/nodes/mention.js +81 -0
- package/dist/es2019/schema/nodes/nested-expand.js +58 -0
- package/dist/es2019/schema/nodes/ordered-list.js +23 -0
- package/dist/es2019/schema/nodes/panel.js +79 -0
- package/dist/es2019/schema/nodes/paragraph.js +39 -0
- package/dist/es2019/schema/nodes/placeholder.js +33 -0
- package/dist/es2019/schema/nodes/rule.js +15 -0
- package/dist/es2019/schema/nodes/status.js +54 -0
- package/dist/es2019/schema/nodes/tableNodes.js +222 -0
- package/dist/es2019/schema/nodes/task-item.js +38 -0
- package/dist/es2019/schema/nodes/task-list.js +37 -0
- package/dist/es2019/schema/nodes/text.js +7 -0
- package/dist/es2019/schema/nodes/types/block-content.js +1 -0
- package/dist/es2019/schema/nodes/types/extensions.js +1 -0
- package/dist/es2019/schema/nodes/types/inline-content.js +1 -0
- package/dist/es2019/schema/nodes/types/mark.js +1 -0
- package/dist/es2019/schema/nodes/types/non-nestable-block-content.js +1 -0
- package/dist/es2019/schema/nodes/types/rich-media-common.js +1 -0
- package/dist/es2019/schema/nodes/unknown-block.js +16 -0
- package/dist/es2019/schema/nodes/unsupported-block.js +26 -0
- package/dist/es2019/schema/nodes/unsupported-inline.js +25 -0
- package/dist/es2019/schema/unsupported.js +1 -0
- package/dist/es2019/steps/analytics.js +122 -0
- package/dist/es2019/steps/set-attrs.js +57 -0
- package/dist/es2019/steps/table/add-column.js +349 -0
- package/dist/es2019/steps/table/constants.js +6 -0
- package/dist/es2019/steps/table/sort-column.js +41 -0
- package/dist/es2019/steps/table/types.js +1 -0
- package/dist/es2019/steps/table/utils/cell-step.js +204 -0
- package/dist/es2019/steps/table/utils/cells-at-column.js +57 -0
- package/dist/es2019/steps/table/utils/find-column.js +86 -0
- package/dist/es2019/steps/table/utils/get-table-rect-from-doc.js +30 -0
- package/dist/es2019/steps/table/utils/side-effects/rows.js +297 -0
- package/dist/es2019/steps/table/utils/side-effects/side-effects.js +81 -0
- package/dist/es2019/steps/table/utils/side-effects/table.js +99 -0
- package/dist/es2019/steps/table/utils/side-effects/types.js +1 -0
- package/dist/es2019/steps/table/utils/table-map.js +19 -0
- package/dist/es2019/steps/type-ahead.js +85 -0
- package/dist/es2019/steps.js +6 -0
- package/dist/es2019/utils/colors.js +148 -0
- package/dist/es2019/utils/confluence/emoji.js +83 -0
- package/dist/es2019/utils/extensions.js +26 -0
- package/dist/es2019/utils/index.js +4 -0
- package/dist/es2019/utils/parseDOM.js +1 -0
- package/dist/es2019/utils/url.js +19 -0
- package/dist/es2019/utils/uuid.js +18 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/schema/bitbucket-schema.js +5 -0
- package/dist/esm/schema/confluence-schema.js +11 -0
- package/dist/esm/schema/create-schema.js +338 -0
- package/dist/esm/schema/default-schema.js +36 -0
- package/dist/esm/schema/groups.js +23 -0
- package/dist/esm/schema/index.js +9 -0
- package/dist/esm/schema/inline-nodes.js +5 -0
- package/dist/esm/schema/jira-schema.js +88 -0
- package/dist/esm/schema/marks/alignment.js +30 -0
- package/dist/esm/schema/marks/annotation.js +82 -0
- package/dist/esm/schema/marks/breakout.js +25 -0
- package/dist/esm/schema/marks/code.js +41 -0
- package/dist/esm/schema/marks/confluence-inline-comment.js +22 -0
- package/dist/esm/schema/marks/data-consumer.js +63 -0
- package/dist/esm/schema/marks/em.js +20 -0
- package/dist/esm/schema/marks/indentation.js +23 -0
- package/dist/esm/schema/marks/index.js +17 -0
- package/dist/esm/schema/marks/link.js +113 -0
- package/dist/esm/schema/marks/strike.js +24 -0
- package/dist/esm/schema/marks/strong.js +32 -0
- package/dist/esm/schema/marks/subsup.js +53 -0
- package/dist/esm/schema/marks/text-color.js +78 -0
- package/dist/esm/schema/marks/type-ahead-query.js +21 -0
- package/dist/esm/schema/marks/underline.js +20 -0
- package/dist/esm/schema/marks/unsupported-mark.js +8 -0
- package/dist/esm/schema/marks/unsupported-node-attributes.js +9 -0
- package/dist/esm/schema/nodes/block-card.js +48 -0
- package/dist/esm/schema/nodes/blockquote.js +15 -0
- package/dist/esm/schema/nodes/bodied-extension.js +58 -0
- package/dist/esm/schema/nodes/bullet-list.js +21 -0
- package/dist/esm/schema/nodes/caption.js +19 -0
- package/dist/esm/schema/nodes/code-block.js +149 -0
- package/dist/esm/schema/nodes/confluence-jira-issue.js +47 -0
- package/dist/esm/schema/nodes/confluence-unsupported-block.js +26 -0
- package/dist/esm/schema/nodes/confluence-unsupported-inline.js +27 -0
- package/dist/esm/schema/nodes/date.js +28 -0
- package/dist/esm/schema/nodes/decision-item.js +36 -0
- package/dist/esm/schema/nodes/decision-list.js +39 -0
- package/dist/esm/schema/nodes/doc.js +7 -0
- package/dist/esm/schema/nodes/embed-card.js +54 -0
- package/dist/esm/schema/nodes/emoji.js +68 -0
- package/dist/esm/schema/nodes/expand.js +75 -0
- package/dist/esm/schema/nodes/extension.js +51 -0
- package/dist/esm/schema/nodes/hard-break.js +14 -0
- package/dist/esm/schema/nodes/heading.js +61 -0
- package/dist/esm/schema/nodes/image.js +33 -0
- package/dist/esm/schema/nodes/index.js +44 -0
- package/dist/esm/schema/nodes/inline-card.js +56 -0
- package/dist/esm/schema/nodes/inline-extension.js +46 -0
- package/dist/esm/schema/nodes/layout-column.js +45 -0
- package/dist/esm/schema/nodes/layout-section.js +52 -0
- package/dist/esm/schema/nodes/list-item.js +18 -0
- package/dist/esm/schema/nodes/media-group.js +21 -0
- package/dist/esm/schema/nodes/media-inline.js +2 -0
- package/dist/esm/schema/nodes/media-single.js +84 -0
- package/dist/esm/schema/nodes/media.js +174 -0
- package/dist/esm/schema/nodes/mention.js +80 -0
- package/dist/esm/schema/nodes/nested-expand.js +56 -0
- package/dist/esm/schema/nodes/ordered-list.js +21 -0
- package/dist/esm/schema/nodes/panel.js +76 -0
- package/dist/esm/schema/nodes/paragraph.js +37 -0
- package/dist/esm/schema/nodes/placeholder.js +31 -0
- package/dist/esm/schema/nodes/rule.js +13 -0
- package/dist/esm/schema/nodes/status.js +51 -0
- package/dist/esm/schema/nodes/tableNodes.js +238 -0
- package/dist/esm/schema/nodes/task-item.js +37 -0
- package/dist/esm/schema/nodes/task-list.js +35 -0
- package/dist/esm/schema/nodes/text.js +9 -0
- package/dist/esm/schema/nodes/types/block-content.js +1 -0
- package/dist/esm/schema/nodes/types/extensions.js +1 -0
- package/dist/esm/schema/nodes/types/inline-content.js +1 -0
- package/dist/esm/schema/nodes/types/mark.js +1 -0
- package/dist/esm/schema/nodes/types/non-nestable-block-content.js +1 -0
- package/dist/esm/schema/nodes/types/rich-media-common.js +1 -0
- package/dist/esm/schema/nodes/unknown-block.js +14 -0
- package/dist/esm/schema/nodes/unsupported-block.js +26 -0
- package/dist/esm/schema/nodes/unsupported-inline.js +25 -0
- package/dist/esm/schema/unsupported.js +1 -0
- package/dist/esm/steps/analytics.js +166 -0
- package/dist/esm/steps/set-attrs.js +89 -0
- package/dist/esm/steps/table/add-column.js +431 -0
- package/dist/esm/steps/table/constants.js +6 -0
- package/dist/esm/steps/table/sort-column.js +69 -0
- package/dist/esm/steps/table/types.js +1 -0
- package/dist/esm/steps/table/utils/cell-step.js +216 -0
- package/dist/esm/steps/table/utils/cells-at-column.js +84 -0
- package/dist/esm/steps/table/utils/find-column.js +87 -0
- package/dist/esm/steps/table/utils/get-table-rect-from-doc.js +30 -0
- package/dist/esm/steps/table/utils/side-effects/rows.js +360 -0
- package/dist/esm/steps/table/utils/side-effects/side-effects.js +93 -0
- package/dist/esm/steps/table/utils/side-effects/table.js +113 -0
- package/dist/esm/steps/table/utils/side-effects/types.js +1 -0
- package/dist/esm/steps/table/utils/table-map.js +19 -0
- package/dist/esm/steps/type-ahead.js +117 -0
- package/dist/esm/steps.js +6 -0
- package/dist/esm/utils/colors.js +160 -0
- package/dist/esm/utils/confluence/emoji.js +85 -0
- package/dist/esm/utils/extensions.js +27 -0
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/parseDOM.js +3 -0
- package/dist/esm/utils/url.js +21 -0
- package/dist/esm/utils/uuid.js +18 -0
- package/dist/esm/version.json +5 -0
- package/dist/json-schema/v1/full.json +2536 -0
- package/dist/json-schema/v1/stage-0.json +2737 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/schema/bitbucket-schema.d.ts +2 -0
- package/dist/types/schema/confluence-schema.d.ts +3 -0
- package/dist/types/schema/create-schema.d.ts +31 -0
- package/dist/types/schema/default-schema.d.ts +7 -0
- package/dist/types/schema/groups.d.ts +6 -0
- package/dist/types/schema/index.d.ts +11 -0
- package/dist/types/schema/inline-nodes.d.ts +1 -0
- package/dist/types/schema/jira-schema.d.ts +26 -0
- package/dist/types/schema/marks/alignment.d.ts +16 -0
- package/dist/types/schema/marks/annotation.d.ts +32 -0
- package/dist/types/schema/marks/breakout.d.ts +12 -0
- package/dist/types/schema/marks/code.d.ts +8 -0
- package/dist/types/schema/marks/confluence-inline-comment.d.ts +12 -0
- package/dist/types/schema/marks/data-consumer.d.ts +41 -0
- package/dist/types/schema/marks/em.d.ts +8 -0
- package/dist/types/schema/marks/indentation.d.ts +16 -0
- package/dist/types/schema/marks/index.d.ts +30 -0
- package/dist/types/schema/marks/link.d.ts +32 -0
- package/dist/types/schema/marks/strike.d.ts +8 -0
- package/dist/types/schema/marks/strong.d.ts +8 -0
- package/dist/types/schema/marks/subsup.d.ts +15 -0
- package/dist/types/schema/marks/text-color.d.ts +21 -0
- package/dist/types/schema/marks/type-ahead-query.d.ts +2 -0
- package/dist/types/schema/marks/underline.d.ts +8 -0
- package/dist/types/schema/marks/unsupported-mark.d.ts +2 -0
- package/dist/types/schema/marks/unsupported-node-attributes.d.ts +2 -0
- package/dist/types/schema/nodes/block-card.d.ts +19 -0
- package/dist/types/schema/nodes/blockquote.d.ts +14 -0
- package/dist/types/schema/nodes/bodied-extension.d.ts +27 -0
- package/dist/types/schema/nodes/bullet-list.d.ts +14 -0
- package/dist/types/schema/nodes/caption.d.ts +21 -0
- package/dist/types/schema/nodes/code-block.d.ts +31 -0
- package/dist/types/schema/nodes/confluence-jira-issue.d.ts +2 -0
- package/dist/types/schema/nodes/confluence-unsupported-block.d.ts +2 -0
- package/dist/types/schema/nodes/confluence-unsupported-inline.d.ts +2 -0
- package/dist/types/schema/nodes/date.d.ts +14 -0
- package/dist/types/schema/nodes/decision-item.d.ts +17 -0
- package/dist/types/schema/nodes/decision-list.d.ts +18 -0
- package/dist/types/schema/nodes/doc.d.ts +18 -0
- package/dist/types/schema/nodes/embed-card.d.ts +15 -0
- package/dist/types/schema/nodes/emoji.d.ts +14 -0
- package/dist/types/schema/nodes/expand.d.ts +33 -0
- package/dist/types/schema/nodes/extension.d.ts +21 -0
- package/dist/types/schema/nodes/hard-break.d.ts +11 -0
- package/dist/types/schema/nodes/heading.d.ts +36 -0
- package/dist/types/schema/nodes/image.d.ts +2 -0
- package/dist/types/schema/nodes/index.d.ts +93 -0
- package/dist/types/schema/nodes/inline-card.d.ts +19 -0
- package/dist/types/schema/nodes/inline-extension.d.ts +21 -0
- package/dist/types/schema/nodes/layout-column.d.ts +21 -0
- package/dist/types/schema/nodes/layout-section.d.ts +44 -0
- package/dist/types/schema/nodes/list-item.d.ts +20 -0
- package/dist/types/schema/nodes/media-group.d.ts +14 -0
- package/dist/types/schema/nodes/media-inline.d.ts +16 -0
- package/dist/types/schema/nodes/media-single.d.ts +59 -0
- package/dist/types/schema/nodes/media.d.ts +60 -0
- package/dist/types/schema/nodes/mention.d.ts +26 -0
- package/dist/types/schema/nodes/nested-expand.d.ts +27 -0
- package/dist/types/schema/nodes/ordered-list.d.ts +20 -0
- package/dist/types/schema/nodes/panel.d.ts +46 -0
- package/dist/types/schema/nodes/paragraph.d.ts +37 -0
- package/dist/types/schema/nodes/placeholder.d.ts +11 -0
- package/dist/types/schema/nodes/rule.d.ts +8 -0
- package/dist/types/schema/nodes/status.d.ts +20 -0
- package/dist/types/schema/nodes/tableNodes.d.ts +111 -0
- package/dist/types/schema/nodes/task-item.d.ts +17 -0
- package/dist/types/schema/nodes/task-list.d.ts +21 -0
- package/dist/types/schema/nodes/text.d.ts +15 -0
- package/dist/types/schema/nodes/types/block-content.d.ts +22 -0
- package/dist/types/schema/nodes/types/extensions.d.ts +34 -0
- package/dist/types/schema/nodes/types/inline-content.d.ts +32 -0
- package/dist/types/schema/nodes/types/mark.d.ts +15 -0
- package/dist/types/schema/nodes/types/non-nestable-block-content.d.ts +20 -0
- package/dist/types/schema/nodes/types/rich-media-common.d.ts +9 -0
- package/dist/types/schema/nodes/unknown-block.d.ts +3 -0
- package/dist/types/schema/nodes/unsupported-block.d.ts +2 -0
- package/dist/types/schema/nodes/unsupported-inline.d.ts +2 -0
- package/dist/types/schema/unsupported.d.ts +1 -0
- package/dist/types/steps/analytics.d.ts +59 -0
- package/dist/types/steps/set-attrs.d.ts +23 -0
- package/dist/types/steps/table/add-column.d.ts +88 -0
- package/dist/types/steps/table/constants.d.ts +4 -0
- package/dist/types/steps/table/sort-column.d.ts +18 -0
- package/dist/types/steps/table/types.d.ts +39 -0
- package/dist/types/steps/table/utils/cell-step.d.ts +47 -0
- package/dist/types/steps/table/utils/cells-at-column.d.ts +20 -0
- package/dist/types/steps/table/utils/find-column.d.ts +8 -0
- package/dist/types/steps/table/utils/get-table-rect-from-doc.d.ts +8 -0
- package/dist/types/steps/table/utils/side-effects/rows.d.ts +25 -0
- package/dist/types/steps/table/utils/side-effects/side-effects.d.ts +15 -0
- package/dist/types/steps/table/utils/side-effects/table.d.ts +16 -0
- package/dist/types/steps/table/utils/side-effects/types.d.ts +33 -0
- package/dist/types/steps/table/utils/table-map.d.ts +6 -0
- package/dist/types/steps/type-ahead.d.ts +35 -0
- package/dist/types/steps.d.ts +8 -0
- package/dist/types/utils/colors.d.ts +71 -0
- package/dist/types/utils/confluence/emoji.d.ts +50 -0
- package/dist/types/utils/extensions.d.ts +3 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/parseDOM.d.ts +1 -0
- package/dist/types/utils/url.d.ts +15 -0
- package/dist/types/utils/uuid.d.ts +5 -0
- package/document-fixtures/unsupported-content.json +526 -0
- package/json-schema/v1/full.json +2536 -0
- package/json-schema/v1/stage-0.json +2737 -0
- package/package.json +63 -0
- package/steps/package.json +7 -0
- package/test-helpers/html-helpers.ts +40 -0
- package/test-helpers/matches.ts +8 -0
- package/test-helpers/schema-builder.ts +329 -0
- package/test-helpers/schema.ts +79 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { TableSideEffectHandler } from './table';
|
|
2
|
+
import { RowsSideEffectHandler } from './rows';
|
|
3
|
+
export class SideEffectsHandler {
|
|
4
|
+
constructor(sideEffects) {
|
|
5
|
+
this.table = new TableSideEffectHandler(sideEffects && sideEffects.table);
|
|
6
|
+
this.rows = new RowsSideEffectHandler(sideEffects && sideEffects.rows);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
getTableMap(isDelete) {
|
|
10
|
+
return this.table.getTableMap(isDelete);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
map(mapping) {
|
|
14
|
+
const sideEffects = {};
|
|
15
|
+
const tableSideEffect = this.table.map(mapping);
|
|
16
|
+
const rowsSideEffect = this.rows.map(mapping);
|
|
17
|
+
|
|
18
|
+
if (tableSideEffect) {
|
|
19
|
+
sideEffects.table = tableSideEffect;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (rowsSideEffect) {
|
|
23
|
+
sideEffects.rows = rowsSideEffect;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return sideEffects;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
invert(originalDoc, isDelete, map) {
|
|
30
|
+
const sideEffects = {};
|
|
31
|
+
const tableSideEffect = this.table.invert(originalDoc);
|
|
32
|
+
|
|
33
|
+
if (tableSideEffect) {
|
|
34
|
+
sideEffects.table = tableSideEffect;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const rowsSideEffect = this.rows.invert(originalDoc, isDelete, map);
|
|
38
|
+
|
|
39
|
+
if (rowsSideEffect) {
|
|
40
|
+
sideEffects.rows = rowsSideEffect;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return sideEffects;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
toJSON() {
|
|
47
|
+
const tableSideEffectJson = this.table.toJSON();
|
|
48
|
+
const rowsSideEffectJson = this.rows.toJSON();
|
|
49
|
+
|
|
50
|
+
if (!tableSideEffectJson && !rowsSideEffectJson) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const sideEffectsJSON = {};
|
|
55
|
+
|
|
56
|
+
if (tableSideEffectJson) {
|
|
57
|
+
sideEffectsJSON.table = tableSideEffectJson;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (rowsSideEffectJson) {
|
|
61
|
+
sideEffectsJSON.rows = rowsSideEffectJson;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return sideEffectsJSON;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static fromJSON(schema, json) {
|
|
68
|
+
const sideEffects = {};
|
|
69
|
+
|
|
70
|
+
if (json.table) {
|
|
71
|
+
sideEffects.table = TableSideEffectHandler.fromJSON(schema, json.table);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (json.rows) {
|
|
75
|
+
sideEffects.rows = RowsSideEffectHandler.fromJSON(schema, json.rows);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return sideEffects;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { StepMap } from 'prosemirror-transform';
|
|
2
|
+
export class TableSideEffectHandler {
|
|
3
|
+
constructor(tableSideEffect) {
|
|
4
|
+
if (tableSideEffect) {
|
|
5
|
+
this.table = tableSideEffect;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
addTableSideEffect(from, to, node) {
|
|
10
|
+
this.table = {
|
|
11
|
+
from,
|
|
12
|
+
to,
|
|
13
|
+
node
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
handleAddTable(tr, isDelete) {
|
|
18
|
+
if (isDelete || !this.table) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
tr.insert(this.table.from, this.table.node);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
handleRemoveTable(tr, tablePos, tableRect, column, isDelete) {
|
|
27
|
+
if (isDelete && tableRect.map.width === 1 && column === 0) {
|
|
28
|
+
// Add side effect
|
|
29
|
+
this.addTableSideEffect(tablePos, tablePos + tableRect.table.nodeSize, tableRect.table.copy(tableRect.table.content));
|
|
30
|
+
tr.delete(tablePos, tablePos + tableRect.table.nodeSize);
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
getTableMap(isDelete) {
|
|
38
|
+
if (!this.table) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
from,
|
|
44
|
+
to
|
|
45
|
+
} = this.table;
|
|
46
|
+
|
|
47
|
+
if (isDelete) {
|
|
48
|
+
return new StepMap([from, to - from, 0]);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return new StepMap([from, 0, to - from]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
map(mapping) {
|
|
55
|
+
if (!this.table) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
from: mapping.map(this.table.from),
|
|
61
|
+
to: mapping.map(this.table.to),
|
|
62
|
+
node: this.table.node
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
invert(doc) {
|
|
67
|
+
if (!this.table) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const tableNode = doc.nodeAt(this.table.from);
|
|
72
|
+
return {
|
|
73
|
+
from: this.table.from,
|
|
74
|
+
to: this.table.from + tableNode.nodeSize,
|
|
75
|
+
node: tableNode.copy(tableNode.content)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
toJSON() {
|
|
80
|
+
if (!this.table) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
from: this.table.from,
|
|
86
|
+
to: this.table.to,
|
|
87
|
+
node: this.table.node.toJSON()
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static fromJSON(schema, json) {
|
|
92
|
+
return {
|
|
93
|
+
from: json.from,
|
|
94
|
+
to: json.to,
|
|
95
|
+
node: schema.nodeFromJSON(json.node)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const getCellIndex = (map, row, col) => {
|
|
2
|
+
return row * map.width + col;
|
|
3
|
+
};
|
|
4
|
+
export function hasMergedColumns(map, row, col) {
|
|
5
|
+
const index = getCellIndex(map, row, col);
|
|
6
|
+
return col > 0 && map.map[index - 1] === map.map[index] || col < map.width - 1 && map.map[index + 1] === map.map[index];
|
|
7
|
+
}
|
|
8
|
+
export function hasMergedRows(map, row, col) {
|
|
9
|
+
const index = getCellIndex(map, row, col);
|
|
10
|
+
return row > 0 && map.map[index - map.width] !== map.map[index] || row < map.height - 1 && map.map[index + map.width] === map.map[index];
|
|
11
|
+
}
|
|
12
|
+
export function isRootRow(map, row, col) {
|
|
13
|
+
const index = getCellIndex(map, row, col);
|
|
14
|
+
return row > 0 ? map.map[index - map.width] !== map.map[index] : true;
|
|
15
|
+
}
|
|
16
|
+
export function isRootCol(map, row, col) {
|
|
17
|
+
const index = getCellIndex(map, row, col);
|
|
18
|
+
return row > 0 ? map.map[index - 1] !== map.map[index] : true;
|
|
19
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Slice } from 'prosemirror-model';
|
|
2
|
+
import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror-transform';
|
|
3
|
+
export const insertTypeAheadStepType = 'atlaskit-insert-type-ahead';
|
|
4
|
+
export let InsertTypeAheadStages;
|
|
5
|
+
|
|
6
|
+
(function (InsertTypeAheadStages) {
|
|
7
|
+
InsertTypeAheadStages["DELETING_RAW_QUERY"] = "DELETING_RAW_QUERY";
|
|
8
|
+
InsertTypeAheadStages["INSERTING_ITEM"] = "INSERTING_ITEM";
|
|
9
|
+
})(InsertTypeAheadStages || (InsertTypeAheadStages = {}));
|
|
10
|
+
|
|
11
|
+
export class InsertTypeAheadStep extends Step {
|
|
12
|
+
constructor({
|
|
13
|
+
stage,
|
|
14
|
+
query,
|
|
15
|
+
trigger,
|
|
16
|
+
selectedIndex
|
|
17
|
+
}, isInvertStep = false) {
|
|
18
|
+
super();
|
|
19
|
+
this.isInvertStep = isInvertStep;
|
|
20
|
+
this.stage = stage;
|
|
21
|
+
this.query = query;
|
|
22
|
+
this.trigger = trigger;
|
|
23
|
+
this.selectedIndex = selectedIndex;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
invert() {
|
|
27
|
+
const config = {
|
|
28
|
+
stage: this.stage,
|
|
29
|
+
query: this.query,
|
|
30
|
+
trigger: this.trigger,
|
|
31
|
+
selectedIndex: this.selectedIndex
|
|
32
|
+
};
|
|
33
|
+
return new InsertTypeAheadStep(config, !this.isInvertStep);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
apply(doc) {
|
|
37
|
+
return StepResult.ok(doc);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
merge() {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
isInsertionStep() {
|
|
45
|
+
return !this.isInvertStep;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
isUndoingStep() {
|
|
49
|
+
return this.isInvertStep;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
map(mapping) {
|
|
53
|
+
const config = {
|
|
54
|
+
stage: this.stage,
|
|
55
|
+
query: this.query,
|
|
56
|
+
trigger: this.trigger,
|
|
57
|
+
selectedIndex: this.selectedIndex
|
|
58
|
+
}; // Return the same events, this step will never be removed
|
|
59
|
+
|
|
60
|
+
return new InsertTypeAheadStep(config, this.isInvertStep);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getMap() {
|
|
64
|
+
return new StepMap([0, 0, 0]);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
toJSON() {
|
|
68
|
+
// When serialized we should create a noop Replace step
|
|
69
|
+
return {
|
|
70
|
+
stepType: 'replace',
|
|
71
|
+
from: 0,
|
|
72
|
+
to: 0
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static fromJSON() {
|
|
77
|
+
// This is a "local custom step" once serialized
|
|
78
|
+
// we need to transform it in a no-operation action
|
|
79
|
+
return new ReplaceStep(0, 0, Slice.empty);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
/** Register this step with Prosemirror */
|
|
84
|
+
|
|
85
|
+
Step.jsonID(insertTypeAheadStepType, InsertTypeAheadStep);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { SortOrder as TableSortOrder } from './steps/table/constants';
|
|
2
|
+
export { TableSortStep } from './steps/table/sort-column';
|
|
3
|
+
export { InsertTypeAheadStages, InsertTypeAheadStep } from './steps/type-ahead';
|
|
4
|
+
export { AddColumnStep } from './steps/table/add-column';
|
|
5
|
+
export { SetAttrsStep } from './steps/set-attrs';
|
|
6
|
+
export { AnalyticsStep } from './steps/analytics';
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
export const Y50 = '#FFFAE6';
|
|
17
|
+
export const Y75 = '#FFF0B3';
|
|
18
|
+
export const Y200 = '#FFC400';
|
|
19
|
+
export const Y400 = '#FF991F';
|
|
20
|
+
export const Y500 = '#FF8B00';
|
|
21
|
+
export const G50 = '#E3FCEF';
|
|
22
|
+
export const G75 = '#ABF5D1';
|
|
23
|
+
export const G200 = '#57D9A3';
|
|
24
|
+
export const G300 = '#36B37E';
|
|
25
|
+
export const G400 = '#00875A';
|
|
26
|
+
export const G500 = '#006644';
|
|
27
|
+
export const B50 = '#DEEBFF';
|
|
28
|
+
export const B75 = '#B3D4FF';
|
|
29
|
+
export const B100 = '#4C9AFF';
|
|
30
|
+
export const B400 = '#0052CC';
|
|
31
|
+
export const B500 = '#0747A6';
|
|
32
|
+
export const N0 = '#FFFFFF';
|
|
33
|
+
export const N20 = '#F4F5F7';
|
|
34
|
+
export const N30 = '#EBECF0';
|
|
35
|
+
export const N40 = '#DFE1E6';
|
|
36
|
+
export const N50 = '#C1C7D0';
|
|
37
|
+
export const N60 = '#B3BAC5';
|
|
38
|
+
export const N80 = '#97A0AF';
|
|
39
|
+
export const N90 = '#8993A4';
|
|
40
|
+
export const N200 = '#6B778C';
|
|
41
|
+
export const N300 = '#5E6C84';
|
|
42
|
+
export const N500 = '#42526E';
|
|
43
|
+
export const N800 = '#172B4D';
|
|
44
|
+
export const P50 = '#EAE6FF';
|
|
45
|
+
export const P75 = '#C0B6F2';
|
|
46
|
+
export const P100 = '#998DD9';
|
|
47
|
+
export const P300 = '#6554C0';
|
|
48
|
+
export const P400 = '#5243AA';
|
|
49
|
+
export const P500 = '#403294';
|
|
50
|
+
export const T50 = '#E6FCFF';
|
|
51
|
+
export const T75 = '#B3F5FF';
|
|
52
|
+
export const T100 = '#79E2F2';
|
|
53
|
+
export const T300 = '#00B8D9';
|
|
54
|
+
export const T500 = '#008DA6';
|
|
55
|
+
/**
|
|
56
|
+
* @return String with HEX-coded color
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
export function normalizeHexColor(color, defaultColor) {
|
|
60
|
+
if (!color) {
|
|
61
|
+
return null;
|
|
62
|
+
} // Normalize to hex
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
color = color.trim().toLowerCase();
|
|
66
|
+
|
|
67
|
+
if (isHex(color)) {
|
|
68
|
+
// Normalize 3-hex to 6-hex colours
|
|
69
|
+
if (color.length === 4) {
|
|
70
|
+
color = color.split('').map(c => c === '#' ? '#' : `${c}${c}`).join('');
|
|
71
|
+
}
|
|
72
|
+
} else if (isRgb(color)) {
|
|
73
|
+
return rgbToHex(color);
|
|
74
|
+
} else {
|
|
75
|
+
// http://dev.w3.org/csswg/css-color/#named-colors
|
|
76
|
+
if (color === 'default') {
|
|
77
|
+
return null;
|
|
78
|
+
} else if (namedColors.default && namedColors.default[color]) {
|
|
79
|
+
color = namedColors.default[color];
|
|
80
|
+
} else if (namedColors && namedColors[color]) {
|
|
81
|
+
color = namedColors[color];
|
|
82
|
+
} else {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (color === defaultColor) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return color;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Converts hex color format to rgb.
|
|
95
|
+
* Works well with full hex color format and shortcut as well.
|
|
96
|
+
*
|
|
97
|
+
* @param hex - hex color string (#xxx, or #xxxxxx)
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
export function hexToRgb(color) {
|
|
101
|
+
if (!isHex(color)) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let colorBits = color.substring(1).split('');
|
|
106
|
+
|
|
107
|
+
if (colorBits.length === 3) {
|
|
108
|
+
colorBits = [colorBits[0], colorBits[0], colorBits[1], colorBits[1], colorBits[2], colorBits[2]];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const rgb = Number(`0x${colorBits.join('')}`); // eslint-disable-next-line no-bitwise
|
|
112
|
+
|
|
113
|
+
return `rgb(${rgb >> 16 & 255},${rgb >> 8 & 255},${rgb & 255})`;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Converts hex color format to rgba.
|
|
117
|
+
*
|
|
118
|
+
* @param hex - hex color string (#xxx, or #xxxxxx)
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
export function hexToRgba(rawColor, alpha) {
|
|
122
|
+
let color = normalizeHexColor(rawColor);
|
|
123
|
+
|
|
124
|
+
if (!color) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const hex2rgb = color => color.match(/[a-z0-9]{2}/gi).map(hex => parseInt(hex, 16));
|
|
129
|
+
|
|
130
|
+
return `rgba(${hex2rgb(color).concat(alpha).join(',')})`;
|
|
131
|
+
}
|
|
132
|
+
export function rgbToHex(value) {
|
|
133
|
+
const matches = value.match(/(0?\.?\d{1,3})%?\b/g);
|
|
134
|
+
|
|
135
|
+
if (matches && matches.length >= 3) {
|
|
136
|
+
const [red, green, blue] = matches.map(Number);
|
|
137
|
+
return '#' + (blue | green << 8 | red << 16 | 1 << 24).toString(16).slice(1) // eslint-disable-line no-bitwise
|
|
138
|
+
;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
export function isRgb(color) {
|
|
144
|
+
return /rgba?\(/.test(color);
|
|
145
|
+
}
|
|
146
|
+
export function isHex(color) {
|
|
147
|
+
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(color);
|
|
148
|
+
}
|