diff --git a/.eslintrc.json b/.eslintrc.json index bffb357a7..ab41625b3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,12 @@ { - "extends": "next/core-web-vitals" + "plugins": [ + "prettier" + ], + "extends": [ + "prettier", + "next/core-web-vitals" + ], + "rules": { + "prettier/prettier": "error" + } } diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..0a379d53a --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "trailingComma": "es5", + "tabWidth": 2, + "semi": false, + "singleQuote": false +} \ No newline at end of file diff --git a/package.json b/package.json index b68b9afe3..e43328d6e 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "lint:fix": "next lint --fix" }, "dependencies": { "@apollo/client": "^3.4.16", @@ -86,6 +87,10 @@ "@types/react-router-dom": "^5.3.1", "eslint": "8.0.0", "eslint-config-next": "11.1.2", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-react": "^7.31.8", + "prettier": "2.6.2", "typescript": "4.4.3" } } diff --git a/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/BlockTypeChange.ts b/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/BlockTypeChange.ts index 2739db20c..ad39973e2 100644 --- a/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/BlockTypeChange.ts +++ b/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/BlockTypeChange.ts @@ -1,30 +1,50 @@ import { Editor, Transforms } from 'slate'; import { AutoFormatChangeType, ChangeData, AutoFormatChange } from './index'; import { getRangeFromBlockStartToCursor, getTextFromBlockStartToCursor } from '../../utils'; +import { BlockDefinitions, EArticleBlocks } from '../../Blocks'; +import { escapeRegExp } from "../../../../../utils/regex"; export class BlockTypeChange implements AutoFormatChange { shortcut: string | string[] type: AutoFormatChangeType data: ChangeData + trigger:string constructor(shortcut:string | string[], data: ChangeData) { this.shortcut = shortcut this.data = data this.type = 'BlockTypeChange' + this.trigger = ' '; } - apply = (editor: Editor): boolean => { - const textBeforeCursor = `${getTextFromBlockStartToCursor(editor)} `; + apply = (editor: Editor, text: string): boolean => { + const isTrigger = text === this.trigger; + const textBeforeCursor = isTrigger ? getTextFromBlockStartToCursor(editor) : text; const testValues = typeof this.shortcut === 'string' ? [this.shortcut] : this.shortcut; - const shortcutMatch = testValues.find((shortcut) => textBeforeCursor.startsWith(`${shortcut} `)) - if (!shortcutMatch) return false; - - Transforms.delete(editor, { - at: getRangeFromBlockStartToCursor(editor), - }) - Transforms.setNodes( - editor, - { ...this.data }, - ) - return true; + const shortcutMatch = testValues.find((shortcut) => `${textBeforeCursor} `.startsWith(`${shortcut} `)) + if (isTrigger && shortcutMatch) { + Transforms.delete(editor, { + at: getRangeFromBlockStartToCursor(editor), + }) + Transforms.setNodes( + editor, + { ...this.data }, + ) + return true; + } else { + const matchShortcutWithText = new RegExp(`^(${testValues.map(testValue => escapeRegExp(testValue)).join('|')})\\s(?.*)`, 'gm'); + const matches = matchShortcutWithText.exec(textBeforeCursor); + if (!matches) return false; + const { type } = this.data; + const matchedText = matches.groups?.text; + if (!matchedText) return false; + const blockDefinition = BlockDefinitions[type as EArticleBlocks]; + const element = blockDefinition?.instanciateElement?.({...this.data, text: matchedText}) + if(!element) return false; + Transforms.insertNodes( + editor, + element, + ) + return true; + } } } diff --git a/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/CustomDirectiveChange.ts b/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/CustomDirectiveChange.ts index c36c986d6..84e89c373 100644 --- a/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/CustomDirectiveChange.ts +++ b/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/CustomDirectiveChange.ts @@ -1,7 +1,7 @@ import { Range, Point, Node, Editor, Transforms, Ancestor, NodeEntry } from 'slate'; import { AutoFormatChangeType, ChangeData, AutoFormatChange } from './index'; -import { customNodes } from '../../../processor/plugins'; import { getTextFromBlockStartToCursor } from '../../utils'; +import { getSlateEditorStateFromMarkdownSync } from '../../../processor/getSlateEditorStateFromMarkdown'; function parseAttributes(attributes:string|undefined): {[key: string]: any} { const classNames = [] @@ -35,54 +35,56 @@ function parseAttributes(attributes:string|undefined): {[key: string]: any} { return parsed } - - export class CustomDirectiveChange implements AutoFormatChange { shortcut: string type: AutoFormatChangeType data?: ChangeData + trigger: string constructor(shortcut:string, data?: ChangeData) { this.shortcut = shortcut if (data) this.data = data this.type = 'CustomDirectiveChange' + this.trigger = ' ' } - apply(editor: Editor): boolean { + getMarkdownFromCurrentCursorPosition(editor: Editor):string|null { const textBeforeCursor = getTextFromBlockStartToCursor(editor); - const matchDirective = new RegExp('(:*s*(?[^\\s]*)\\s*\\[(?.*)]\\s*{(?.*)})', 'mg') + const matchDirective = new RegExp('(:+(?.*)\\[(?.*)]{(?.*)})\\s*$', 'mg') const matches = matchDirective.exec(textBeforeCursor); - if (!matches) return false; - const type = matches.groups?.['type'] - const text = matches.groups?.['text'] - const attributes = matches.groups?.['attributes'] - if (!type) return false; - const parsedAttributes = parseAttributes(attributes) - const nodeAttributes = { - value: text, - type, - ...parsedAttributes.attributes - } - const props = customNodes.leafDirective[type]?.transformMdhastToComponent?.(null as any, nodeAttributes) || nodeAttributes; - const [start] = Range.edges(editor.selection as Range); - const charBefore = Editor.before(editor, start, { - unit: 'character', - distance: matches[0].length, - }) as Point; - Transforms.delete(editor, { - at: { - anchor: charBefore, - focus: start - } - }) - Transforms.insertNodes( - editor, - { - ...props, - type:props.type, - children: [{text: props.value}], + if (!matches) return null; + return matches[0]; + } + + apply(editor: Editor, text:string): boolean { + const isTrigger = text === this.trigger; + const markdownString = isTrigger ? this.getMarkdownFromCurrentCursorPosition(editor) : text; + if (!markdownString) return false; + try { + const parsed = getSlateEditorStateFromMarkdownSync(markdownString) + if(!parsed) return false; + const {editorState: [parsedNode]} = parsed; + if (parsedNode.type !== this.shortcut) return false; + const [start] = Range.edges(editor.selection as Range); + const charBefore = Editor.before(editor, start, { + unit: 'character', + distance: markdownString.length, + }) as Point; + if (isTrigger) { + Transforms.delete(editor, { + at: { + anchor: charBefore, + focus: start + } + }) } - ) - return true; + Transforms.insertNodes( + editor, + parsedNode + ) + return true + } catch { + return false; + } } } diff --git a/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/InlineTypeChange.ts b/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/InlineTypeChange.ts index 091ed720f..ab27ffe3c 100644 --- a/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/InlineTypeChange.ts +++ b/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/InlineTypeChange.ts @@ -1,7 +1,9 @@ -import { Editor, Node, NodeEntry, Path, Range, Transforms } from 'slate'; +import { Editor, Node, NodeEntry, Path, Range, Transforms, Location } from 'slate'; import { AutoFormatChange, AutoFormatChangeType, ChangeData } from './index'; -import { getTextFromBlockStartToCursor } from '../../utils'; +import { getTextFromBlockStartToCursor, lookupElementAtSelection } from '../../utils'; import { escapeRegExp } from "../../../../../utils/regex"; +import { getSlateEditorStateFromMarkdownSync } from '../../../processor/getSlateEditorStateFromMarkdown'; +import { BlockDefinitions, EArticleBlocks } from '../../Blocks'; function getSelectionAccrossNodes( editor: Editor, @@ -34,111 +36,153 @@ function getSelectionAccrossNodes( return { anchor, focus }; } -export class InlineTypeChange implements AutoFormatChange { +export class InlineTypeChanges implements AutoFormatChange { shortcut: string | string[] type: AutoFormatChangeType data: ChangeData + formats: [ChangeData, string | string[]][] - constructor(shortcut: string | string[], data: ChangeData) { - this.shortcut = shortcut - this.data = data - this.type = 'InlineTypeChange' + constructor(formats: [ChangeData, string | string[]][]) { + this.type = 'InlineTypeChanges' + this.formats = formats; + this.shortcut = formats.map(([,shortcut]) => shortcut ).flat() + this.data = formats.reduce((acc:ChangeData, [data, shortcut]: [ChangeData, string | string[]]) => { + if (Array.isArray(shortcut)) { + shortcut.forEach((s: string) => { + acc[s] = data; + }) + } else { + acc[shortcut] = data; + } + return acc; + }, {}) } apply = ( editor: Editor, + text: string ): boolean => { - const testValues = typeof this.shortcut === 'string' ? [this.shortcut] : this.shortcut; - const textBeforeCursor = `${getTextFromBlockStartToCursor(editor)} `; - const shortcutMatch = testValues.find((shortcut) => textBeforeCursor.endsWith(`${shortcut} `)) - if (!shortcutMatch) return false; + // We use the inline menu configuration to check if the current element actually allows + // inline styles + const [elementUnderCursor] = lookupElementAtSelection(editor, editor.selection as Location) || [] + const { inlineMenu } = BlockDefinitions[elementUnderCursor?.type as any as EArticleBlocks] || {}; + let hideFloatingInlineMenu = inlineMenu === null; + if (hideFloatingInlineMenu) return false; + const testValues = typeof this.shortcut === 'string' ? [this.shortcut] : this.shortcut + const textBeforeCursor = getTextFromBlockStartToCursor(editor) + const isPasted = text.length > 1; + const shortcutMatch = testValues.find((shortcut) => textBeforeCursor.endsWith(shortcut)) + if (shortcutMatch) { + const changeData = this.data[shortcutMatch] as ChangeData; + const [, shortcut] = this.formats.find(([data]) => data === changeData) || []; + if (!shortcut) return false; + const formatAliases = typeof shortcut === 'string' ? [shortcut] : shortcut; + // retreive the matches based on usual markdown pattern, e.g. + // __bold__, _italic_, etc. + const escapedShortcuts = `(${formatAliases.map((shortcut: string) => escapeRegExp(shortcut)).join('|')})` + const matcher = RegExp(`(? { + const value = changeData[key]; + editor.addMark(key, value); + }) + Transforms.collapse(editor, { edge: 'anchor' }) + // Now lets cleanup the md shortcuts from the text. + // Setting the marks on text nodes can result in a new structure + // because elements might be split up to apply the styles. + // Therefore we retrieve the updated selection of the matched string. + const selectionBeforeMatch = getSelectionAccrossNodes( + editor, + matchStartIndex, + matchEndIndex, + shortcutMatch + ) + // Create a range that matches the md shortcut + // before the search string (anchor) + const rangeBefore = { + anchor: selectionBeforeMatch.anchor, + focus: { + ...selectionBeforeMatch.anchor, + offset: selectionBeforeMatch.anchor.offset + shortcutMatch.length + } + } + Transforms.delete( + editor, + { + at: rangeBefore + } + ) + const selectionAfterMatch = getSelectionAccrossNodes( + editor, + matchStartIndex, + matchEndIndex, + shortcutMatch + ) + // Create a range that matches the md shortcut + // after the search string (focus) + const rangeAfter = { + anchor: selectionAfterMatch.anchor, + focus: { + ...selectionAfterMatch.anchor, + offset: selectionAfterMatch.anchor.offset + shortcutMatch.length + }, + } + Transforms.delete( + editor, + { + at: rangeAfter, + } + ) + Transforms.move(editor, { + distance: selectionAfterMatch.anchor.offset, + unit: 'character' + }) - // retreive the matches based on usual markdown pattern, e.g. - // __bold__, _italic_, etc. - const escapedShortcut = escapeRegExp(shortcutMatch); - const matcher = RegExp(`(? { - const value = this.data[key]; - editor.addMark(key, value); - }) - Transforms.collapse(editor, { edge: 'anchor' }) - // Now lets cleanup the md shortcuts from the text. - // Setting the marks on text nodes can result in a new structure - // because elements might be split up to apply the styles. - // Therefore we retrieve the updated selection of the matched string. - const selectionBeforeMatch = getSelectionAccrossNodes( - editor, - matchStartIndex, - matchEndIndex, - shortcutMatch - ) - // Create a range that matches the md shortcut - // before the search string (anchor) - const rangeBefore = { - anchor: selectionBeforeMatch.anchor, - focus: { - ...selectionBeforeMatch.anchor, - offset: selectionBeforeMatch.anchor.offset + shortcutMatch.length - } - } - Transforms.delete( - editor, - { - at: rangeBefore + Transforms.select(editor, { + anchor: {...selection.anchor, offset: selection.anchor.offset - text.length}, + focus: selection.focus, + }) + + Object.keys(changeData).forEach((key: string) => { + editor.removeMark(key) + }) + Transforms.collapse(editor, {edge: 'focus'}) + return true; + } else if(isPasted) { + try { + const escapedShortcuts = `(${(this.shortcut as string[]).map((shortcut: string) => escapeRegExp(shortcut)).join('|')})` + const matcher = RegExp(`(?.+?)\\]\\((?.+?\\))', 'gm') + const matches = matcher.exec(mdText) + if (!matches) return false + const matchedMarkdown = matches[0] + if (!matchedMarkdown) return false; + try { + const { type, markdown } = classifyMarkdown(matchedMarkdown) + const parsed = getSlateEditorStateFromMarkdownSync(markdown) + if (!parsed) return false; + const nodeToInsert = getNodeToInsert(type, parsed) + if (!nodeToInsert || !this.shortcut.includes(nodeToInsert.type)) return false; + const [start] = Range.edges(editor.selection as Range); + const charBefore = Editor.before(editor, start, { + unit: 'character', + distance: markdown.length, + }) as Point; + if(isTrigger) { + Transforms.delete(editor, { + at: { + anchor: charBefore, + focus: start + } + }) + } + Transforms.insertNodes( + editor, + [nodeToInsert, {text: " "}], + ) + return true + } catch (e) { + console.error(e) + return false; + } + } +} diff --git a/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/index.tsx b/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/index.tsx index cbd485a22..ea7944f87 100644 --- a/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/index.tsx +++ b/src/components/NFTArticle/SlateEditor/Plugins/AutoFormatPlugin/index.tsx @@ -1,20 +1,22 @@ import { Range, Editor } from 'slate'; import { BlockTypeChange } from './BlockTypeChange' -import { InlineTypeChange } from './InlineTypeChange' +import { InlineTypeChanges } from './InlineTypeChange' import { CustomDirectiveChange } from './CustomDirectiveChange' -export type AutoFormatChangeType = "BlockTypeChange" | "InlineTypeChange" | "CustomDirectiveChange" | "InlineTypeCreate"; -export type ChangeData = {[key: string]: number | string | boolean} +import { LinkAndFigureAutoFormat } from './LinkAndFigureAutoFormat' + +export type AutoFormatChangeType = "BlockTypeChange" | "InlineTypeChanges" | "CustomDirectiveChange" | "LinkAndFigureAutoFormat" | "InlineTypeCreate" +export type ChangeData = {[key: string]: number | string | boolean | ChangeData} export type AutoFormatChange = { shortcut: string | string[] type: AutoFormatChangeType data?: ChangeData - apply: (editor: Editor, text?: string) => boolean, + apply: (editor: Editor, text: string) => boolean, } function createChangeTypeHeading():AutoFormatChange[] { const changes = []; - for (let i = 1; i < 6; i++) { + for (let i = 1; i <= 6; i++) { changes.push(new BlockTypeChange( Array(i).fill('#').join(''), { @@ -28,11 +30,18 @@ function createChangeTypeHeading():AutoFormatChange[] { const changeWithSpaceValidation: AutoFormatChange[] = [ ...createChangeTypeHeading(), - new BlockTypeChange('p', {type: 'paragraph',} ), - new InlineTypeChange(['__', '**'], {strong: true}), - new InlineTypeChange(['_', '*'], {emphasis: true}), + new BlockTypeChange('p', {type: 'paragraph',} ), + new BlockTypeChange('>', {type: 'blockquote',} ), new BlockTypeChange(['---', '***', '___'], {type: 'thematicBreak'}), + new BlockTypeChange(['-', '*'], {type: 'listItem'}), + new InlineTypeChanges([ + [{strong: true}, ['__', '**']], + [{emphasis: true}, ['_', '*']], + [{inlineCode: true}, ['`']], + ]), + new CustomDirectiveChange('embed-media'), new CustomDirectiveChange('tezos-storage-pointer'), + new LinkAndFigureAutoFormat(), ] export const withAutoFormat = (editor: Editor) => { @@ -41,13 +50,10 @@ export const withAutoFormat = (editor: Editor) => { const { selection } = editor; let handled = false; if (selection && Range.isCollapsed(selection)) { - if (text === ' ') { - handled = changeWithSpaceValidation.some(change => change.apply(editor)); - } - if (handled) return true; + handled = changeWithSpaceValidation.some(change => change.apply(editor, text) ) } + if (handled) return true; insertText(text) } - return editor } diff --git a/src/components/NFTArticle/SlateEditor/Plugins/SlateConstraintsPlugin.ts b/src/components/NFTArticle/SlateEditor/Plugins/SlateConstraintsPlugin.ts index ae73773f3..361859db1 100644 --- a/src/components/NFTArticle/SlateEditor/Plugins/SlateConstraintsPlugin.ts +++ b/src/components/NFTArticle/SlateEditor/Plugins/SlateConstraintsPlugin.ts @@ -106,16 +106,22 @@ export const withConstraints: EnhanceEditorWith = (editor) => { ) } } - // normalise links + // Make sure listItems are wrapped with a list node + if(node.type === 'listItem') { + const parentNode = Node.parent(editor, path); + if (parentNode.type !== 'list') { + Transforms.wrapNodes(editor, {type: 'list' }) + } + } + + // delete link nodes that have no text content if(node.type === 'link') { - // unwrap links that have no url if(node.url === "") { - Transforms.unwrapNodes(editor, {at: path}) + Transforms.unwrapNodes(editor, {at: path}) } - // remove links that have no text entirly if(Node.string(node).length === 0) { - Transforms.removeNodes(editor, {at: path}) - return; + Transforms.removeNodes(editor, {at: path}) + return; } } diff --git a/src/components/NFTArticle/SlateEditor/index.tsx b/src/components/NFTArticle/SlateEditor/index.tsx index 080e9e8f6..13dc84ceb 100644 --- a/src/components/NFTArticle/SlateEditor/index.tsx +++ b/src/components/NFTArticle/SlateEditor/index.tsx @@ -94,7 +94,7 @@ export interface SlateEditorProps { } const INLINE_ELEMENTS = ['inlineMath', 'link', 'mention'] -const VOID_ELEMENTS = ['inlineMath', 'math', 'mention'] +const VOID_ELEMENTS = ['inlineMath', 'math', 'embed-media', 'tezos-storage', 'mention'] export const SlateEditor = forwardRef(({ initialValue, diff --git a/src/components/NFTArticle/elements/Blockquote/BlockquoteDefinition.tsx b/src/components/NFTArticle/elements/Blockquote/BlockquoteDefinition.tsx index b53bb6bba..11ca37515 100644 --- a/src/components/NFTArticle/elements/Blockquote/BlockquoteDefinition.tsx +++ b/src/components/NFTArticle/elements/Blockquote/BlockquoteDefinition.tsx @@ -7,10 +7,10 @@ export const blockquoteDefinition: IArticleBlockDefinition = { buttonInstantiable: true, render: BlockquoteEditor, hasUtilityWrapper: true, - instanciateElement: () => ({ + instanciateElement: ({text=""}: {text?: string} = {}) => ({ type: "blockquote", children: [{ - text: "" + text }] }) } diff --git a/src/components/NFTArticle/elements/Heading/HeadingDefinition.tsx b/src/components/NFTArticle/elements/Heading/HeadingDefinition.tsx index 5ee2508c5..1635c2bbe 100644 --- a/src/components/NFTArticle/elements/Heading/HeadingDefinition.tsx +++ b/src/components/NFTArticle/elements/Heading/HeadingDefinition.tsx @@ -26,11 +26,11 @@ export const headingDefinition: IArticleBlockDefinition = { }, insertBreakBehavior: EBreakBehavior.insertParagraph, hasUtilityWrapper: true, - instanciateElement: () => ({ + instanciateElement: ({depth=1, text=""}: {depth?: number, text?:string} = {}) => ({ type: "heading", - depth: 1, + depth, children: [{ - text: "" + text }] }), editAttributeComp: HeadingAttributeSettings, diff --git a/src/components/NFTArticle/elements/List/ListDefinition.tsx b/src/components/NFTArticle/elements/List/ListDefinition.tsx index fc5747a70..fbd52d102 100644 --- a/src/components/NFTArticle/elements/List/ListDefinition.tsx +++ b/src/components/NFTArticle/elements/List/ListDefinition.tsx @@ -68,4 +68,15 @@ export const listItemDefinition: IArticleBlockDefinition = { }) }, hasUtilityWrapper: false, + instanciateElement: ({text=""}) => ({ + type: "list", + ordered: false, + spread: false, + children: [{ + type: "listItem", + children: [{ + text, + }] + }] + }), } diff --git a/src/components/NFTArticle/elements/Paragraph/ParagraphDefinition.tsx b/src/components/NFTArticle/elements/Paragraph/ParagraphDefinition.tsx index 2b735ce0b..939a30232 100644 --- a/src/components/NFTArticle/elements/Paragraph/ParagraphDefinition.tsx +++ b/src/components/NFTArticle/elements/Paragraph/ParagraphDefinition.tsx @@ -8,10 +8,10 @@ export const paragraphDefinition: IArticleBlockDefinition = {

{children}

), hasUtilityWrapper: true, - instanciateElement: () => ({ + instanciateElement: ({text=""}: {text?: string} = {}) => ({ type: "paragraph", children: [{ - text: "" + text, }] }), } diff --git a/src/components/NFTArticle/processor/getSlateEditorStateFromMarkdown.ts b/src/components/NFTArticle/processor/getSlateEditorStateFromMarkdown.ts index 431e5a8ce..2fd189895 100644 --- a/src/components/NFTArticle/processor/getSlateEditorStateFromMarkdown.ts +++ b/src/components/NFTArticle/processor/getSlateEditorStateFromMarkdown.ts @@ -64,30 +64,44 @@ const remarkSlateTransformerOverrides: OverridedMdastBuilders = { mention: mentionProcessor.transformMarkdownMdhastToSlate, }; -interface PayloadSlateEditorStateFromMarkdown { - [p: string]: any; - editorState: Descendant[]; +export interface PayloadSlateEditorStateFromMarkdown { + [p: string]: any + editorState: Descendant[] } -export default async function getSlateEditorStateFromMarkdown( - markdown: string -): Promise { +const mdToSlateProcessor = unified() + .use(remarkParse) + .use(mdastFlattenListItemParagraphs) + .use(mdastParseMentions) + .use(remarkMath) + .use(remarkGfm) + .use(remarkUnwrapImages) + .use(remarkDirective) + .use(remarkFxHashCustom) + .use(remarkToSlate, { + overrides: remarkSlateTransformerOverrides, + }) + + +export default async function getSlateEditorStateFromMarkdown(markdown: string): Promise { try { - const matterResult = matter(markdown); - const processed = await unified() - .use(remarkParse) - .use(mdastFlattenListItemParagraphs) - .use(mdastParseMentions) - .use(remarkMath) - .use(remarkGfm) - .use(remarkUnwrapImages) - .use(remarkDirective) - .use(remarkFxHashCustom) - .use(remarkToSlate, { - overrides: remarkSlateTransformerOverrides, - }) - .process(matterResult.content); + const matterResult = matter(markdown) + const processed = await mdToSlateProcessor.process(matterResult.content) + + return { + ...matterResult.data, + editorState: processed.result as Descendant[] + }; + } catch(e) { + console.error(e) + return null; + } +} +export function getSlateEditorStateFromMarkdownSync(markdown: string): PayloadSlateEditorStateFromMarkdown | null { + try { + const matterResult = matter(markdown) + const processed = mdToSlateProcessor.processSync(matterResult.content) return { ...matterResult.data, editorState: processed.result as Descendant[], diff --git a/yarn.lock b/yarn.lock index 7d4e061d8..17c40c982 100644 --- a/yarn.lock +++ b/yarn.lock @@ -860,6 +860,17 @@ array-includes@^3.1.3, array-includes@^3.1.4: get-intrinsic "^1.1.1" is-string "^1.0.7" +array-includes@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.5.tgz#2c320010db8d31031fd2a5f6b3bbd4b1aad31bdb" + integrity sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.19.5" + get-intrinsic "^1.1.1" + is-string "^1.0.7" + array-union@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" @@ -883,6 +894,16 @@ array.prototype.flatmap@^1.2.5: define-properties "^1.1.3" es-abstract "^1.19.0" +array.prototype.flatmap@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz#a7e8ed4225f4788a70cd910abcf0791e76a5534f" + integrity sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.2" + es-shim-unscopables "^1.0.0" + asap@~2.0.3: version "2.0.6" resolved "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz" @@ -1488,6 +1509,14 @@ define-properties@^1.1.3: dependencies: object-keys "^1.0.12" +define-properties@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1" + integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA== + dependencies: + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + depd@~1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" @@ -1632,6 +1661,42 @@ es-abstract@^1.18.5, es-abstract@^1.19.0, es-abstract@^1.19.1: string.prototype.trimstart "^1.0.4" unbox-primitive "^1.0.1" +es-abstract@^1.19.2, es-abstract@^1.19.5: + version "1.20.2" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.2.tgz#8495a07bc56d342a3b8ea3ab01bd986700c2ccb3" + integrity sha512-XxXQuVNrySBNlEkTYJoDNFe5+s2yIOpzq80sUHEdPdQr0S5nTLz4ZPPPswNIpKseDDUS5yghX1gfLIHQZ1iNuQ== + dependencies: + call-bind "^1.0.2" + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + function.prototype.name "^1.1.5" + get-intrinsic "^1.1.2" + get-symbol-description "^1.0.0" + has "^1.0.3" + has-property-descriptors "^1.0.0" + has-symbols "^1.0.3" + internal-slot "^1.0.3" + is-callable "^1.2.4" + is-negative-zero "^2.0.2" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + is-string "^1.0.7" + is-weakref "^1.0.2" + object-inspect "^1.12.2" + object-keys "^1.1.1" + object.assign "^4.1.4" + regexp.prototype.flags "^1.4.3" + string.prototype.trimend "^1.0.5" + string.prototype.trimstart "^1.0.5" + unbox-primitive "^1.0.2" + +es-shim-unscopables@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz#702e632193201e3edf8713635d083d378e510241" + integrity sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w== + dependencies: + has "^1.0.3" + es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz" @@ -1681,6 +1746,11 @@ eslint-config-next@11.1.2: eslint-plugin-react "^7.23.1" eslint-plugin-react-hooks "^4.2.0" +eslint-config-prettier@^8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.5.0.tgz#5a81680ec934beca02c7b1a61cf8ca34b66feab1" + integrity sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q== + eslint-import-resolver-node@^0.3.4, eslint-import-resolver-node@^0.3.6: version "0.3.6" resolved "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz" @@ -1746,6 +1816,13 @@ eslint-plugin-jsx-a11y@^6.4.1: language-tags "^1.0.5" minimatch "^3.0.4" +eslint-plugin-prettier@^4.0.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" + integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ== + dependencies: + prettier-linter-helpers "^1.0.0" + eslint-plugin-react-hooks@^4.2.0: version "4.3.0" resolved "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.3.0.tgz" @@ -1771,6 +1848,26 @@ eslint-plugin-react@^7.23.1: semver "^6.3.0" string.prototype.matchall "^4.0.6" +eslint-plugin-react@^7.31.8: + version "7.31.8" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.31.8.tgz#3a4f80c10be1bcbc8197be9e8b641b2a3ef219bf" + integrity sha512-5lBTZmgQmARLLSYiwI71tiGVTLUuqXantZM6vlSY39OaDSV0M7+32K5DnLkmFrwTe+Ksz0ffuLUC91RUviVZfw== + dependencies: + array-includes "^3.1.5" + array.prototype.flatmap "^1.3.0" + doctrine "^2.1.0" + estraverse "^5.3.0" + jsx-ast-utils "^2.4.1 || ^3.0.0" + minimatch "^3.1.2" + object.entries "^1.1.5" + object.fromentries "^2.0.5" + object.hasown "^1.1.1" + object.values "^1.1.5" + prop-types "^15.8.1" + resolve "^2.0.0-next.3" + semver "^6.3.0" + string.prototype.matchall "^4.0.7" + eslint-scope@^6.0.0: version "6.0.0" resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-6.0.0.tgz" @@ -1913,6 +2010,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + fast-glob@^3.1.1: version "3.2.7" resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz" @@ -2096,11 +2198,26 @@ function-bind@^1.1.1: resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function.prototype.name@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" + integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.0" + functions-have-names "^1.2.2" + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= +functions-have-names@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== + fuzzy-search@^3.2.1: version "3.2.1" resolved "https://registry.npmjs.org/fuzzy-search/-/fuzzy-search-3.2.1.tgz" @@ -2115,6 +2232,15 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: has "^1.0.3" has-symbols "^1.0.1" +get-intrinsic@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.3.tgz#063c84329ad93e83893c7f4f243ef63ffa351385" + integrity sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.3" + get-orientation@1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/get-orientation/-/get-orientation-1.1.2.tgz" @@ -2236,6 +2362,11 @@ has-bigints@^1.0.1: resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz" integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== +has-bigints@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" + integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz" @@ -2246,11 +2377,23 @@ has-flag@^4.0.0: resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-property-descriptors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" + integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== + dependencies: + get-intrinsic "^1.1.1" + has-symbols@^1.0.1, has-symbols@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz" integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + has-tostringtag@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz" @@ -2689,6 +2832,11 @@ is-negative-zero@^2.0.1: resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz" integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== +is-negative-zero@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" + integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== + is-number-object@^1.0.4: version "1.0.6" resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz" @@ -2724,6 +2872,13 @@ is-shared-array-buffer@^1.0.1: resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz" integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== +is-shared-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" + integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== + dependencies: + call-bind "^1.0.2" + is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz" @@ -2756,6 +2911,13 @@ is-weakref@^1.0.1: dependencies: call-bind "^1.0.0" +is-weakref@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" + integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== + dependencies: + call-bind "^1.0.2" + isarray@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" @@ -3503,6 +3665,13 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" +minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + minimist@^1.2.0: version "1.2.5" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz" @@ -3672,6 +3841,11 @@ object-inspect@^1.11.0, object-inspect@^1.9.0: resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz" integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== +object-inspect@^1.12.2: + version "1.12.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" + integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== + object-is@^1.0.1: version "1.1.5" resolved "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz" @@ -3695,6 +3869,16 @@ object.assign@^4.1.2: has-symbols "^1.0.1" object-keys "^1.1.1" +object.assign@^4.1.4: + version "4.1.4" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.4.tgz#9673c7c7c351ab8c4d0b516f4343ebf4dfb7799f" + integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + has-symbols "^1.0.3" + object-keys "^1.1.1" + object.entries@^1.1.5: version "1.1.5" resolved "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz" @@ -3721,6 +3905,14 @@ object.hasown@^1.1.0: define-properties "^1.1.3" es-abstract "^1.19.1" +object.hasown@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.1.tgz#ad1eecc60d03f49460600430d97f23882cf592a3" + integrity sha512-LYLe4tivNQzq4JdaWW6WO3HMZZJWzkkH8fnI6EebWl0VZth2wL2Lovm74ep2/gZzlaTdV62JZHEqHQ2yVn8Q/A== + dependencies: + define-properties "^1.1.4" + es-abstract "^1.19.5" + object.values@^1.1.5: version "1.1.5" resolved "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz" @@ -3955,6 +4147,18 @@ prelude-ls@^1.2.1: resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.2.tgz#e26d71a18a74c3d0f0597f55f01fb6c06c206032" + integrity sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew== + prismjs@^1.24.1, prismjs@^1.28.0: version "1.28.0" resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.28.0.tgz#0d8f561fa0f7cf6ebca901747828b149147044b6" @@ -3986,6 +4190,15 @@ prop-types@^15.6.2, prop-types@^15.7.2: object-assign "^4.1.1" react-is "^16.8.1" +prop-types@^15.8.1: + version "15.8.1" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" + integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.13.1" + property-expr@^2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/property-expr/-/property-expr-2.0.4.tgz" @@ -4130,7 +4343,7 @@ react-is@17.0.2: resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== -react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1: +react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1: version "16.13.1" resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -4274,6 +4487,15 @@ regexp.prototype.flags@^1.3.1: call-bind "^1.0.2" define-properties "^1.1.3" +regexp.prototype.flags@^1.4.1, regexp.prototype.flags@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac" + integrity sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + functions-have-names "^1.2.2" + regexpp@^3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz" @@ -4773,6 +4995,20 @@ string.prototype.matchall@^4.0.6: regexp.prototype.flags "^1.3.1" side-channel "^1.0.4" +string.prototype.matchall@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz#8e6ecb0d8a1fb1fda470d81acecb2dba057a481d" + integrity sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.1" + get-intrinsic "^1.1.1" + has-symbols "^1.0.3" + internal-slot "^1.0.3" + regexp.prototype.flags "^1.4.1" + side-channel "^1.0.4" + string.prototype.trimend@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz" @@ -4781,6 +5017,15 @@ string.prototype.trimend@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" +string.prototype.trimend@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz#914a65baaab25fbdd4ee291ca7dde57e869cb8d0" + integrity sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.19.5" + string.prototype.trimstart@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz" @@ -4789,6 +5034,15 @@ string.prototype.trimstart@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" +string.prototype.trimstart@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz#5466d93ba58cfa2134839f81d7f42437e8c01fef" + integrity sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.19.5" + string_decoder@1.3.0, string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" @@ -5068,6 +5322,16 @@ unbox-primitive@^1.0.1: has-symbols "^1.0.2" which-boxed-primitive "^1.0.2" +unbox-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" + integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== + dependencies: + call-bind "^1.0.2" + has-bigints "^1.0.2" + has-symbols "^1.0.3" + which-boxed-primitive "^1.0.2" + unified@^10.0.0, unified@^10.1.0: version "10.1.1" resolved "https://registry.npmjs.org/unified/-/unified-10.1.1.tgz"