@plumile/ui 0.1.68 → 0.1.70
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/lib/esm/admin/organisms/admin_sidebar/AdminSidebar.js +62 -0
- package/lib/esm/admin/organisms/admin_sidebar/AdminSidebar.js.map +1 -0
- package/lib/esm/admin/organisms/admin_sidebar/adminSidebar.css.js +17 -0
- package/lib/esm/admin/organisms/admin_sidebar/adminSidebar.css.js.map +1 -0
- package/lib/esm/{backoffice/organisms/backoffice_topbar/BackofficeTopbar.js → admin/organisms/admin_topbar/AdminTopbar.js} +4 -4
- package/lib/esm/admin/organisms/admin_topbar/AdminTopbar.js.map +1 -0
- package/lib/esm/admin/organisms/admin_topbar/adminTopbar.css.js +8 -0
- package/lib/esm/admin/organisms/admin_topbar/adminTopbar.css.js.map +1 -0
- package/lib/esm/admin/templates/admin_shell_layout/AdminShellLayout.js +19 -0
- package/lib/esm/admin/templates/admin_shell_layout/AdminShellLayout.js.map +1 -0
- package/lib/esm/admin/theme/AdminThemeProvider.js +11 -0
- package/lib/esm/admin/theme/AdminThemeProvider.js.map +1 -0
- package/lib/esm/admin/theme/adminTheme.css.js +7 -0
- package/lib/esm/admin/theme/adminTheme.css.js.map +1 -0
- package/lib/esm/atomic/atoms/badge/Badge.js +3 -3
- package/lib/esm/atomic/atoms/button/Button.js +1 -1
- package/lib/esm/atomic/atoms/checkbox/Checkbox.js +1 -1
- package/lib/esm/atomic/atoms/error_message/ErrorMessage.js +1 -1
- package/lib/esm/atomic/atoms/formatted-date/FormattedDate.js +4 -4
- package/lib/esm/atomic/atoms/label/Label.js +1 -1
- package/lib/esm/atomic/atoms/modal/Modal.js +13 -13
- package/lib/esm/atomic/molecules/breadcrumb_navigation/BreadcrumbMenuDropdown.js +12 -12
- package/lib/esm/atomic/molecules/breadcrumb_navigation/BreadcrumbMenuPopover.js +20 -20
- package/lib/esm/atomic/molecules/breadcrumb_navigation/BreadcrumbNavigation.js +14 -14
- package/lib/esm/atomic/molecules/card/Card.js +6 -6
- package/lib/esm/atomic/molecules/checkbox_field/CheckboxField.js +1 -1
- package/lib/esm/atomic/molecules/dropdown/Dropdown.js +80 -80
- package/lib/esm/atomic/molecules/dropdown/Dropdown.js.map +1 -1
- package/lib/esm/atomic/molecules/form/Form.js +1 -1
- package/lib/esm/atomic/molecules/form_error/FormError.js +1 -1
- package/lib/esm/atomic/molecules/highlight/HighlightCode.js +25 -25
- package/lib/esm/atomic/molecules/markdown/LazyMarkdownRenderer.js +7 -7
- package/lib/esm/atomic/molecules/markdown/MarkdownRenderer.js +33 -33
- package/lib/esm/atomic/molecules/markdown/MarkdownRenderer.js.map +1 -1
- package/lib/esm/atomic/molecules/markdown/components/LazyMarkdownCodeBlock.js +9 -9
- package/lib/esm/atomic/molecules/markdown/components/MarkdownArticleContainer.css.js +0 -1
- package/lib/esm/atomic/molecules/markdown/components/MarkdownCodeBlock.js +7 -7
- package/lib/esm/atomic/molecules/markdown/components/MarkdownCodeCopyButton.js +9 -9
- package/lib/esm/atomic/molecules/markdown/components/MarkdownFootnotesSection.js +7 -7
- package/lib/esm/atomic/molecules/markdown/components/MarkdownMermaidBlock.js +34 -34
- package/lib/esm/atomic/molecules/markdown/components/MarkdownParagraph.css.js +1 -0
- package/lib/esm/atomic/molecules/markdown/components/MarkdownShikiCodeBlock.js +4 -4
- package/lib/esm/atomic/molecules/profile_dropdown/ProfileDropdown.js +25 -25
- package/lib/esm/atomic/molecules/toast/ToastProvider.js +15 -15
- package/lib/esm/atomic/molecules/toast/ToastViewport.js +15 -15
- package/lib/esm/atomic/organisms/login_form/LoginForm.js +1 -1
- package/lib/esm/atomic/organisms/sidebar/NavigationSidebar.js +34 -34
- package/lib/esm/atomic/organisms/sidebar/icons.js +13 -13
- package/lib/esm/atomic/templates/auth_layout/AuthLayout.js +1 -1
- package/lib/esm/atomic/templates/detail-page/DetailPage.js +49 -0
- package/lib/esm/atomic/templates/detail-page/DetailPage.js.map +1 -0
- package/lib/esm/atomic/templates/detail-page/detailPage.css.js +8 -0
- package/lib/esm/atomic/templates/detail-page/detailPage.css.js.map +1 -0
- package/lib/esm/atomic/templates/page-container/PageContainer.js +36 -0
- package/lib/esm/atomic/templates/page-container/PageContainer.js.map +1 -0
- package/lib/esm/atomic/templates/page-container/pageContainer.css.js +8 -0
- package/lib/esm/atomic/templates/page-container/pageContainer.css.js.map +1 -0
- package/lib/esm/backoffice/atoms/copyable_text/CopyableText.js +10 -10
- package/lib/esm/backoffice/atoms/shortcut_hint/ShortcutHint.js +6 -6
- package/lib/esm/backoffice/atoms/tag/Tag.js +7 -7
- package/lib/esm/backoffice/molecules/backoffice_filter_drawer/BackofficeFilterDrawer.js +22 -22
- package/lib/esm/backoffice/molecules/backoffice_json_viewer/BackofficeJsonViewer.js +12 -12
- package/lib/esm/backoffice/molecules/backoffice_json_viewer/LazyBackofficeJsonViewer.js +11 -11
- package/lib/esm/backoffice/molecules/backoffice_page_header/BackofficePageHeader.js +27 -21
- package/lib/esm/backoffice/molecules/backoffice_page_header/BackofficePageHeader.js.map +1 -1
- package/lib/esm/backoffice/molecules/backoffice_page_header/backofficePageHeader.css.js +2 -2
- package/lib/esm/backoffice/molecules/backoffice_page_header/backofficePageHeader.css.js.map +1 -1
- package/lib/esm/backoffice/molecules/backoffice_relations_menu/BackofficeRelationsMenu.js +12 -12
- package/lib/esm/backoffice/molecules/confirm_dialog/ConfirmDialog.js +9 -9
- package/lib/esm/backoffice/molecules/global_search_input/GlobalSearchInput.js +5 -5
- package/lib/esm/backoffice/molecules/sidebar_collapse_toggle/SidebarCollapseToggle.js +7 -7
- package/lib/esm/backoffice/molecules/sidebar_nav_item/SidebarNavItem.js +26 -26
- package/lib/esm/backoffice/molecules/sidebar_nav_item/SidebarNavItem.js.map +1 -1
- package/lib/esm/backoffice/molecules/sidebar_nav_section/SidebarNavSection.js +11 -11
- package/lib/esm/backoffice/organisms/backoffice_data_table/BackofficeDataTable.js +20 -20
- package/lib/esm/components/data-table/TableCell.js +17 -17
- package/lib/esm/components/data-table/VirtualizedConnectionTable.js +27 -27
- package/lib/esm/components/layout/AppShell.js +14 -0
- package/lib/esm/components/layout/AppShell.js.map +1 -0
- package/lib/esm/components/layout/PageShell.js +65 -65
- package/lib/esm/components/layout/PageShell.js.map +1 -1
- package/lib/esm/components/layout/SettingsLayout.css.js +8 -0
- package/lib/esm/components/layout/SettingsLayout.css.js.map +1 -0
- package/lib/esm/{backoffice/templates/settings_template/SettingsTemplate.js → components/layout/SettingsLayout.js} +5 -5
- package/lib/esm/components/layout/SettingsLayout.js.map +1 -0
- package/lib/esm/components/layout/SplitViewLayout.css.js +8 -0
- package/lib/esm/components/layout/SplitViewLayout.css.js.map +1 -0
- package/lib/esm/{backoffice/templates/split_view_template/SplitViewTemplate.js → components/layout/SplitViewLayout.js} +5 -5
- package/lib/esm/components/layout/SplitViewLayout.js.map +1 -0
- package/lib/esm/components/select/SimpleSelect.js +23 -23
- package/lib/esm/index.js +109 -106
- package/lib/esm/node_modules/react-shiki/dist/chunk-QPJZGYHO.js +23 -23
- package/lib/esm/node_modules/react-shiki/dist/chunk-QPJZGYHO.js.map +1 -1
- package/lib/esm/style.css +1 -1
- package/lib/esm/theme/ThemeProvider.js +11 -11
- package/lib/esm/theme/VisuallyHidden.js +3 -3
- package/lib/esm/theme/index.js +9 -9
- package/lib/types/{backoffice/organisms/backoffice_sidebar/BackofficeSidebar.d.ts → admin/organisms/admin_sidebar/AdminSidebar.d.ts} +7 -7
- package/lib/types/admin/organisms/admin_sidebar/AdminSidebar.d.ts.map +1 -0
- package/lib/types/{backoffice/organisms/backoffice_sidebar/backofficeSidebar.css.d.ts → admin/organisms/admin_sidebar/adminSidebar.css.d.ts} +1 -1
- package/lib/types/admin/organisms/admin_sidebar/adminSidebar.css.d.ts.map +1 -0
- package/lib/types/admin/organisms/admin_topbar/AdminTopbar.d.ts +10 -0
- package/lib/types/admin/organisms/admin_topbar/AdminTopbar.d.ts.map +1 -0
- package/lib/types/{backoffice/organisms/backoffice_topbar/backofficeTopbar.css.d.ts → admin/organisms/admin_topbar/adminTopbar.css.d.ts} +1 -1
- package/lib/types/admin/organisms/admin_topbar/adminTopbar.css.d.ts.map +1 -0
- package/lib/types/admin/templates/admin_shell_layout/AdminShellLayout.d.ts +14 -0
- package/lib/types/admin/templates/admin_shell_layout/AdminShellLayout.d.ts.map +1 -0
- package/lib/types/admin/theme/AdminThemeProvider.d.ts +7 -0
- package/lib/types/admin/theme/AdminThemeProvider.d.ts.map +1 -0
- package/lib/types/admin/theme/adminTheme.css.d.ts +2 -0
- package/lib/types/admin/theme/adminTheme.css.d.ts.map +1 -0
- package/lib/types/atomic/templates/detail-page/DetailPage.d.ts +19 -0
- package/lib/types/atomic/templates/detail-page/DetailPage.d.ts.map +1 -0
- package/lib/types/atomic/templates/detail-page/detailPage.css.d.ts +9 -0
- package/lib/types/atomic/templates/detail-page/detailPage.css.d.ts.map +1 -0
- package/lib/types/atomic/templates/page-container/PageContainer.d.ts +14 -0
- package/lib/types/atomic/templates/page-container/PageContainer.d.ts.map +1 -0
- package/lib/types/atomic/templates/page-container/pageContainer.css.d.ts +7 -0
- package/lib/types/atomic/templates/page-container/pageContainer.css.d.ts.map +1 -0
- package/lib/types/backoffice/molecules/backoffice_page_header/BackofficePageHeader.d.ts +2 -1
- package/lib/types/backoffice/molecules/backoffice_page_header/BackofficePageHeader.d.ts.map +1 -1
- package/lib/types/backoffice/molecules/backoffice_page_header/backofficePageHeader.css.d.ts +2 -0
- package/lib/types/backoffice/molecules/backoffice_page_header/backofficePageHeader.css.d.ts.map +1 -1
- package/lib/types/components/layout/AppShell.d.ts +12 -0
- package/lib/types/components/layout/AppShell.d.ts.map +1 -0
- package/lib/types/{backoffice/templates/settings_template/settingsTemplate.css.d.ts → components/layout/SettingsLayout.css.d.ts} +1 -1
- package/lib/types/components/layout/SettingsLayout.css.d.ts.map +1 -0
- package/lib/types/components/layout/SettingsLayout.d.ts +11 -0
- package/lib/types/components/layout/SettingsLayout.d.ts.map +1 -0
- package/lib/types/{backoffice/templates/split_view_template/splitViewTemplate.css.d.ts → components/layout/SplitViewLayout.css.d.ts} +1 -1
- package/lib/types/components/layout/SplitViewLayout.css.d.ts.map +1 -0
- package/lib/types/components/layout/SplitViewLayout.d.ts +11 -0
- package/lib/types/components/layout/SplitViewLayout.d.ts.map +1 -0
- package/lib/types/index.d.ts +11 -8
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/lib/esm/backoffice/organisms/backoffice_app_shell/BackofficeAppShell.js +0 -14
- package/lib/esm/backoffice/organisms/backoffice_app_shell/BackofficeAppShell.js.map +0 -1
- package/lib/esm/backoffice/organisms/backoffice_sidebar/BackofficeSidebar.js +0 -62
- package/lib/esm/backoffice/organisms/backoffice_sidebar/BackofficeSidebar.js.map +0 -1
- package/lib/esm/backoffice/organisms/backoffice_sidebar/backofficeSidebar.css.js +0 -17
- package/lib/esm/backoffice/organisms/backoffice_sidebar/backofficeSidebar.css.js.map +0 -1
- package/lib/esm/backoffice/organisms/backoffice_topbar/BackofficeTopbar.js.map +0 -1
- package/lib/esm/backoffice/organisms/backoffice_topbar/backofficeTopbar.css.js +0 -8
- package/lib/esm/backoffice/organisms/backoffice_topbar/backofficeTopbar.css.js.map +0 -1
- package/lib/esm/backoffice/templates/backoffice_shell_template/BackofficeShellTemplate.js +0 -19
- package/lib/esm/backoffice/templates/backoffice_shell_template/BackofficeShellTemplate.js.map +0 -1
- package/lib/esm/backoffice/templates/settings_template/SettingsTemplate.js.map +0 -1
- package/lib/esm/backoffice/templates/settings_template/settingsTemplate.css.js +0 -8
- package/lib/esm/backoffice/templates/settings_template/settingsTemplate.css.js.map +0 -1
- package/lib/esm/backoffice/templates/split_view_template/SplitViewTemplate.js.map +0 -1
- package/lib/esm/backoffice/templates/split_view_template/splitViewTemplate.css.js +0 -8
- package/lib/esm/backoffice/templates/split_view_template/splitViewTemplate.css.js.map +0 -1
- package/lib/esm/backoffice/theme/BackofficeThemeProvider.js +0 -11
- package/lib/esm/backoffice/theme/BackofficeThemeProvider.js.map +0 -1
- package/lib/esm/backoffice/theme/backofficeTheme.css.js +0 -7
- package/lib/esm/backoffice/theme/backofficeTheme.css.js.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_app_shell/BackofficeAppShell.d.ts +0 -12
- package/lib/types/backoffice/organisms/backoffice_app_shell/BackofficeAppShell.d.ts.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_sidebar/BackofficeSidebar.d.ts.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_sidebar/backofficeSidebar.css.d.ts.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_topbar/BackofficeTopbar.d.ts +0 -10
- package/lib/types/backoffice/organisms/backoffice_topbar/BackofficeTopbar.d.ts.map +0 -1
- package/lib/types/backoffice/organisms/backoffice_topbar/backofficeTopbar.css.d.ts.map +0 -1
- package/lib/types/backoffice/templates/backoffice_shell_template/BackofficeShellTemplate.d.ts +0 -14
- package/lib/types/backoffice/templates/backoffice_shell_template/BackofficeShellTemplate.d.ts.map +0 -1
- package/lib/types/backoffice/templates/settings_template/SettingsTemplate.d.ts +0 -11
- package/lib/types/backoffice/templates/settings_template/SettingsTemplate.d.ts.map +0 -1
- package/lib/types/backoffice/templates/settings_template/settingsTemplate.css.d.ts.map +0 -1
- package/lib/types/backoffice/templates/split_view_template/SplitViewTemplate.d.ts +0 -11
- package/lib/types/backoffice/templates/split_view_template/SplitViewTemplate.d.ts.map +0 -1
- package/lib/types/backoffice/templates/split_view_template/splitViewTemplate.css.d.ts.map +0 -1
- package/lib/types/backoffice/theme/BackofficeThemeProvider.d.ts +0 -7
- package/lib/types/backoffice/theme/BackofficeThemeProvider.d.ts.map +0 -1
- package/lib/types/backoffice/theme/backofficeTheme.css.d.ts +0 -2
- package/lib/types/backoffice/theme/backofficeTheme.css.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer.js","names":[],"sources":["../../../../../src/atomic/molecules/markdown/MarkdownRenderer.tsx"],"sourcesContent":["import {\n Fragment,\n useDeferredValue,\n useMemo,\n type JSX,\n type ReactNode,\n} from 'react';\nimport Markdown, { RuleType, type MarkdownToJSX } from 'markdown-to-jsx';\n\nimport { MarkdownArticleContainer } from './components/MarkdownArticleContainer.js';\nimport { MarkdownBlockquote } from './components/MarkdownBlockquote.js';\nimport { MarkdownCodeBlock } from './components/MarkdownCodeBlock.js';\nimport { MarkdownDelete } from './components/MarkdownDelete.js';\nimport { MarkdownEmphasis } from './components/MarkdownEmphasis.js';\nimport { MarkdownFootnoteReference } from './components/MarkdownFootnoteReference.js';\nimport { MarkdownFootnotesSection } from './components/MarkdownFootnotesSection.js';\nimport { MarkdownHeading } from './components/MarkdownHeading.js';\nimport { MarkdownHtmlFallback } from './components/MarkdownHtmlFallback.js';\nimport { MarkdownImage } from './components/MarkdownImage.js';\nimport { MarkdownInlineCode } from './components/MarkdownInlineCode.js';\nimport { MarkdownLineBreak } from './components/MarkdownLineBreak.js';\nimport { MarkdownLink } from './components/MarkdownLink.js';\nimport { MarkdownList } from './components/MarkdownList.js';\nimport { MarkdownListItem } from './components/MarkdownListItem.js';\nimport { MarkdownMark } from './components/MarkdownMark.js';\nimport { MarkdownParagraph } from './components/MarkdownParagraph.js';\nimport { MarkdownStrong } from './components/MarkdownStrong.js';\nimport { MarkdownSuperscript } from './components/MarkdownSuperscript.js';\nimport { MarkdownSubscript } from './components/MarkdownSubscript.js';\nimport { MarkdownTable } from './components/MarkdownTable.js';\nimport { MarkdownTableBody } from './components/MarkdownTableBody.js';\nimport { MarkdownTableCell } from './components/MarkdownTableCell.js';\nimport { MarkdownTableHead } from './components/MarkdownTableHead.js';\nimport { MarkdownTableHeaderCell } from './components/MarkdownTableHeaderCell.js';\nimport { MarkdownTableRow } from './components/MarkdownTableRow.js';\nimport { MarkdownTaskListItem } from './components/MarkdownTaskListItem.js';\nimport { MarkdownText } from './components/MarkdownText.js';\nimport { MarkdownThematicBreak } from './components/MarkdownThematicBreak.js';\nimport type {\n MarkdownParserResult,\n MarkdownRenderRule,\n MarkdownRuleOutput,\n MarkdownState,\n} from './helpers/markdownTypes.js';\n\ntype Props = {\n content: string;\n};\n\ntype Alignment = 'left' | 'center' | 'right';\n\nconst mapAlignment = (alignValue: string | null | undefined): Alignment => {\n if (alignValue === 'center' || alignValue === 'right') {\n return alignValue;\n }\n return 'left';\n};\n\nconst renderChildrenSafe = (\n renderChildren: MarkdownRuleOutput,\n children: MarkdownParserResult | MarkdownParserResult[] | undefined,\n state: MarkdownState,\n): ReactNode => {\n if (children == null) {\n return null;\n }\n\n return renderChildren(children, state);\n};\n\nconst getNodeChildren = (\n parserResult: MarkdownParserResult,\n): MarkdownParserResult[] | undefined => {\n if ('children' in parserResult) {\n const candidate = parserResult as {\n children?: MarkdownParserResult[];\n };\n return candidate.children;\n }\n\n return undefined;\n};\n\nconst isCodeInlineNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.CodeInlineNode => {\n return parserResult.type === RuleType.codeInline;\n};\n\nconst isCodeBlockNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.CodeBlockNode => {\n return parserResult.type === RuleType.codeBlock;\n};\n\nconst isFootnoteReferenceNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.FootnoteReferenceNode => {\n return parserResult.type === RuleType.footnoteReference;\n};\n\nconst isHeadingNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.HeadingNode => {\n return parserResult.type === RuleType.heading;\n};\n\nconst isHtmlBlockNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.HTMLNode => {\n return parserResult.type === RuleType.htmlBlock;\n};\n\nconst isHtmlSelfClosingNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.HTMLSelfClosingNode => {\n return parserResult.type === RuleType.htmlSelfClosing;\n};\n\nconst isImageNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.ImageNode => {\n return parserResult.type === RuleType.image;\n};\n\nconst isLinkNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.LinkNode => {\n return parserResult.type === RuleType.link;\n};\n\nconst isOrderedListNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.OrderedListNode => {\n return parserResult.type === RuleType.orderedList;\n};\n\nconst isParagraphNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.ParagraphNode => {\n return parserResult.type === RuleType.paragraph;\n};\n\nconst isTableNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.TableNode => {\n return parserResult.type === RuleType.table;\n};\n\nconst isTextNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.TextNode => {\n return parserResult.type === RuleType.text;\n};\n\nconst isFormattedTextNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.FormattedTextNode => {\n return parserResult.type === RuleType.textFormatted;\n};\n\nconst isUnorderedListNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.UnorderedListNode => {\n return parserResult.type === RuleType.unorderedList;\n};\n\nconst isGfmTaskNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.GFMTaskNode => {\n return parserResult.type === RuleType.gfmTask;\n};\n\nconst renderRules: Partial<Record<RuleType, MarkdownRenderRule>> = {\n [RuleType.blockQuote]: (_next, node, renderChildren, state) => {\n return (\n <MarkdownBlockquote key={state.key}>\n {renderChildrenSafe(renderChildren, getNodeChildren(node), state)}\n </MarkdownBlockquote>\n );\n },\n [RuleType.breakLine]: (_next, _node, _renderChildren, state) => {\n return <MarkdownLineBreak key={state.key} />;\n },\n [RuleType.breakThematic]: (_next, _node, _renderChildren, state) => {\n return <MarkdownThematicBreak key={state.key} />;\n },\n [RuleType.codeInline]: (_next, node, _renderChildren, state) => {\n if (!isCodeInlineNode(node)) {\n return null;\n }\n return <MarkdownInlineCode key={state.key} text={node.text} />;\n },\n [RuleType.codeBlock]: (_next, node, _renderChildren, state) => {\n if (!isCodeBlockNode(node)) {\n return null;\n }\n return (\n <MarkdownCodeBlock\n code={node.text}\n key={state.key}\n language={node.lang}\n />\n );\n },\n [RuleType.footnoteReference]: (_next, node, _renderChildren, state) => {\n if (!isFootnoteReferenceNode(node)) {\n return null;\n }\n return (\n <MarkdownFootnoteReference\n href={node.target}\n key={state.key}\n label={node.text}\n />\n );\n },\n [RuleType.gfmTask]: () => {\n return null;\n },\n [RuleType.heading]: (_next, node, renderChildren, state) => {\n if (!isHeadingNode(node)) {\n return null;\n }\n return (\n <MarkdownHeading id={node.id} key={state.key} level={node.level}>\n {renderChildrenSafe(renderChildren, node.children, state)}\n </MarkdownHeading>\n );\n },\n [RuleType.htmlBlock]: (_next, node, _renderChildren, state) => {\n if (!isHtmlBlockNode(node)) {\n return null;\n }\n const content = node.text;\n let fallbackContent = '';\n if (typeof content === 'string') {\n fallbackContent = content;\n }\n return (\n <MarkdownHtmlFallback\n content={fallbackContent}\n key={state.key}\n title=\"HTML non pris en charge\"\n />\n );\n },\n [RuleType.htmlSelfClosing]: (_next, node, _renderChildren, state) => {\n if (!isHtmlSelfClosingNode(node)) {\n return null;\n }\n return (\n <MarkdownHtmlFallback\n content={`<${node.tag} />`}\n key={state.key}\n title=\"HTML non pris en charge\"\n />\n );\n },\n [RuleType.image]: (_next, node, _renderChildren, state) => {\n if (!isImageNode(node)) {\n return null;\n }\n return (\n <MarkdownImage\n alt={node.alt}\n key={state.key}\n src={node.target}\n title={node.title}\n />\n );\n },\n [RuleType.link]: (_next, node, renderChildren, state) => {\n if (!isLinkNode(node)) {\n return null;\n }\n const href = node.target;\n if (href == null) {\n return (\n <Fragment key={state.key}>\n {renderChildrenSafe(renderChildren, node.children, state)}\n </Fragment>\n );\n }\n return (\n <MarkdownLink href={href} key={state.key} title={node.title}>\n {renderChildrenSafe(renderChildren, node.children, state)}\n </MarkdownLink>\n );\n },\n [RuleType.orderedList]: (_next, node, renderChildren, state) => {\n if (!isOrderedListNode(node)) {\n return null;\n }\n return (\n <MarkdownList key={state.key} ordered start={node.start}>\n {node.items.map((itemNodes, index) => {\n let listKeyPrefix = 'ol';\n if (state.key != null) {\n listKeyPrefix = String(state.key);\n }\n const key = `${listKeyPrefix}-${index}`;\n const first = itemNodes[0];\n if (first != null && isGfmTaskNode(first)) {\n const rest = itemNodes.slice(1);\n return (\n <MarkdownTaskListItem checked={first.completed} key={key}>\n {renderChildrenSafe(renderChildren, rest, state)}\n </MarkdownTaskListItem>\n );\n }\n return (\n <MarkdownListItem key={key}>\n {renderChildrenSafe(renderChildren, itemNodes, state)}\n </MarkdownListItem>\n );\n })}\n </MarkdownList>\n );\n },\n [RuleType.paragraph]: (_next, node, renderChildren, state) => {\n if (!isParagraphNode(node)) {\n return null;\n }\n return (\n <MarkdownParagraph key={state.key}>\n {renderChildrenSafe(renderChildren, node.children, state)}\n </MarkdownParagraph>\n );\n },\n [RuleType.table]: (_next, node, renderChildren, state) => {\n if (!isTableNode(node)) {\n return null;\n }\n\n let tableHeader: JSX.Element | null = null;\n if (Array.isArray(node.header) && node.header.length > 0) {\n tableHeader = (\n <MarkdownTableHead>\n <MarkdownTableRow>\n {node.header.map((headerCell, index) => {\n let alignValue: string | null | undefined;\n if (Array.isArray(node.align)) {\n alignValue = node.align[index];\n }\n const align = mapAlignment(alignValue);\n return (\n <MarkdownTableHeaderCell align={align} key={`header-${index}`}>\n {renderChildrenSafe(renderChildren, headerCell, state)}\n </MarkdownTableHeaderCell>\n );\n })}\n </MarkdownTableRow>\n </MarkdownTableHead>\n );\n }\n\n return (\n <MarkdownTable key={state.key}>\n {tableHeader}\n <MarkdownTableBody>\n {node.cells.map((row, rowIndex) => {\n return (\n <MarkdownTableRow key={`row-${rowIndex}`}>\n {row.map((cell, cellIndex) => {\n let alignValue: string | null | undefined;\n if (Array.isArray(node.align)) {\n alignValue = node.align[cellIndex];\n }\n const align = mapAlignment(alignValue);\n return (\n <MarkdownTableCell\n align={align}\n key={`cell-${rowIndex}-${cellIndex}`}\n >\n {renderChildrenSafe(renderChildren, cell, state)}\n </MarkdownTableCell>\n );\n })}\n </MarkdownTableRow>\n );\n })}\n </MarkdownTableBody>\n </MarkdownTable>\n );\n },\n [RuleType.text]: (_next, node, _renderChildren, state) => {\n if (!isTextNode(node)) {\n return null;\n }\n return <MarkdownText key={state.key} text={node.text} />;\n },\n [RuleType.textFormatted]: (next, node, renderChildren, state): ReactNode => {\n if (!isFormattedTextNode(node)) {\n return next();\n }\n\n const children = renderChildrenSafe(renderChildren, node.children, state);\n\n switch (node.tag) {\n case 'strong':\n case 'b':\n return <MarkdownStrong key={state.key}>{children}</MarkdownStrong>;\n case 'em':\n case 'i':\n return <MarkdownEmphasis key={state.key}>{children}</MarkdownEmphasis>;\n case 'mark':\n return <MarkdownMark key={state.key}>{children}</MarkdownMark>;\n case 'del':\n case 's':\n return <MarkdownDelete key={state.key}>{children}</MarkdownDelete>;\n default:\n return next();\n }\n },\n [RuleType.unorderedList]: (_next, node, renderChildren, state) => {\n if (!isUnorderedListNode(node)) {\n return null;\n }\n return (\n <MarkdownList key={state.key} ordered={false}>\n {node.items.map((itemNodes, index) => {\n let listKeyPrefix = 'ul';\n if (state.key != null) {\n listKeyPrefix = String(state.key);\n }\n const key = `${listKeyPrefix}-${index}`;\n const first = itemNodes[0];\n if (first != null && isGfmTaskNode(first)) {\n const rest = itemNodes.slice(1);\n return (\n <MarkdownTaskListItem checked={first.completed} key={key}>\n {renderChildrenSafe(renderChildren, rest, state)}\n </MarkdownTaskListItem>\n );\n }\n return (\n <MarkdownListItem key={key}>\n {renderChildrenSafe(renderChildren, itemNodes, state)}\n </MarkdownListItem>\n );\n })}\n </MarkdownList>\n );\n },\n};\n\nconst markdownOptions: MarkdownToJSX.Options = {\n disableParsingRawHTML: true,\n forceBlock: true,\n wrapper: Fragment,\n overrides: {\n footer: {\n component: MarkdownFootnotesSection,\n },\n sup: {\n component: MarkdownSuperscript,\n },\n sub: {\n component: MarkdownSubscript,\n },\n },\n renderRule(next, node, renderChildren, state): ReactNode {\n const type = node.type as RuleType;\n const rule = renderRules[type];\n if (rule != null) {\n return rule(next, node, renderChildren, state);\n }\n return next();\n },\n};\n\nexport const MarkdownRenderer = ({ content }: Props): JSX.Element => {\n const deferredContent = useDeferredValue(content);\n\n const memoisedContent = useMemo(() => {\n return deferredContent;\n }, [deferredContent]);\n\n return (\n <MarkdownArticleContainer>\n <Markdown options={markdownOptions}>{memoisedContent}</Markdown>\n </MarkdownArticleContainer>\n );\n};\n\nexport default MarkdownRenderer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAAgB,MAChB,MAAe,YAAY,MAAe,UACrC,IAEF,QAGH,KACJ,GACA,GACA,MAEI,KAAY,OACP,OAGF,EAAe,GAAU,EAAM,EAGlC,KACJ,MACuC;AACvC,KAAI,cAAc,EAIhB,QAHkB,EAGD;GAMf,KACJ,MAEO,EAAa,SAAS,EAAS,YAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,WAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,mBAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,SAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,WAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,iBAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,OAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,MAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,aAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,WAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,OAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,MAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,eAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,eAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,SAGlC,IAA6D;EAChE,EAAS,cAAc,GAAO,GAAM,GAAgB,MAEjD,kBAAC,GAAD,EAAA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,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAU,SAAS;YANC,SACf,GACN,CAAC,EAAgB,CAAC;EAI+C,CAAA,EACvC,CAAA"}
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.js","names":[],"sources":["../../../../../src/atomic/molecules/markdown/MarkdownRenderer.tsx"],"sourcesContent":["import {\n Fragment,\n useDeferredValue,\n useMemo,\n type JSX,\n type ReactNode,\n} from 'react';\nimport Markdown, { RuleType, type MarkdownToJSX } from 'markdown-to-jsx';\n\nimport { MarkdownArticleContainer } from './components/MarkdownArticleContainer.js';\nimport { MarkdownBlockquote } from './components/MarkdownBlockquote.js';\nimport { MarkdownCodeBlock } from './components/MarkdownCodeBlock.js';\nimport { MarkdownDelete } from './components/MarkdownDelete.js';\nimport { MarkdownEmphasis } from './components/MarkdownEmphasis.js';\nimport { MarkdownFootnoteReference } from './components/MarkdownFootnoteReference.js';\nimport { MarkdownFootnotesSection } from './components/MarkdownFootnotesSection.js';\nimport { MarkdownHeading } from './components/MarkdownHeading.js';\nimport { MarkdownHtmlFallback } from './components/MarkdownHtmlFallback.js';\nimport { MarkdownImage } from './components/MarkdownImage.js';\nimport { MarkdownInlineCode } from './components/MarkdownInlineCode.js';\nimport { MarkdownLineBreak } from './components/MarkdownLineBreak.js';\nimport { MarkdownLink } from './components/MarkdownLink.js';\nimport { MarkdownList } from './components/MarkdownList.js';\nimport { MarkdownListItem } from './components/MarkdownListItem.js';\nimport { MarkdownMark } from './components/MarkdownMark.js';\nimport { MarkdownParagraph } from './components/MarkdownParagraph.js';\nimport { MarkdownStrong } from './components/MarkdownStrong.js';\nimport { MarkdownSuperscript } from './components/MarkdownSuperscript.js';\nimport { MarkdownSubscript } from './components/MarkdownSubscript.js';\nimport { MarkdownTable } from './components/MarkdownTable.js';\nimport { MarkdownTableBody } from './components/MarkdownTableBody.js';\nimport { MarkdownTableCell } from './components/MarkdownTableCell.js';\nimport { MarkdownTableHead } from './components/MarkdownTableHead.js';\nimport { MarkdownTableHeaderCell } from './components/MarkdownTableHeaderCell.js';\nimport { MarkdownTableRow } from './components/MarkdownTableRow.js';\nimport { MarkdownTaskListItem } from './components/MarkdownTaskListItem.js';\nimport { MarkdownText } from './components/MarkdownText.js';\nimport { MarkdownThematicBreak } from './components/MarkdownThematicBreak.js';\nimport type {\n MarkdownParserResult,\n MarkdownRenderRule,\n MarkdownRuleOutput,\n MarkdownState,\n} from './helpers/markdownTypes.js';\n\ntype Props = {\n content: string;\n};\n\ntype Alignment = 'left' | 'center' | 'right';\n\nconst mapAlignment = (alignValue: string | null | undefined): Alignment => {\n if (alignValue === 'center' || alignValue === 'right') {\n return alignValue;\n }\n return 'left';\n};\n\nconst renderChildrenSafe = (\n renderChildren: MarkdownRuleOutput,\n children: MarkdownParserResult | MarkdownParserResult[] | undefined,\n state: MarkdownState,\n): ReactNode => {\n if (children == null) {\n return null;\n }\n\n return renderChildren(children, state);\n};\n\nconst getNodeChildren = (\n parserResult: MarkdownParserResult,\n): MarkdownParserResult[] | undefined => {\n if ('children' in parserResult) {\n const candidate = parserResult as {\n children?: MarkdownParserResult[];\n };\n return candidate.children;\n }\n\n return undefined;\n};\n\nconst isCodeInlineNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.CodeInlineNode => {\n return parserResult.type === RuleType.codeInline;\n};\n\nconst isCodeBlockNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.CodeBlockNode => {\n return parserResult.type === RuleType.codeBlock;\n};\n\nconst isFootnoteReferenceNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.FootnoteReferenceNode => {\n return parserResult.type === RuleType.footnoteReference;\n};\n\nconst isHeadingNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.HeadingNode => {\n return parserResult.type === RuleType.heading;\n};\n\nconst isHtmlBlockNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.HTMLNode => {\n return parserResult.type === RuleType.htmlBlock;\n};\n\nconst isHtmlSelfClosingNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.HTMLSelfClosingNode => {\n return parserResult.type === RuleType.htmlSelfClosing;\n};\n\nconst isImageNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.ImageNode => {\n return parserResult.type === RuleType.image;\n};\n\nconst isLinkNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.LinkNode => {\n return parserResult.type === RuleType.link;\n};\n\nconst isOrderedListNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.OrderedListNode => {\n return parserResult.type === RuleType.orderedList;\n};\n\nconst isParagraphNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.ParagraphNode => {\n return parserResult.type === RuleType.paragraph;\n};\n\nconst isTableNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.TableNode => {\n return parserResult.type === RuleType.table;\n};\n\nconst isTextNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.TextNode => {\n return parserResult.type === RuleType.text;\n};\n\nconst isFormattedTextNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.FormattedTextNode => {\n return parserResult.type === RuleType.textFormatted;\n};\n\nconst isUnorderedListNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.UnorderedListNode => {\n return parserResult.type === RuleType.unorderedList;\n};\n\nconst isGfmTaskNode = (\n parserResult: MarkdownParserResult,\n): parserResult is MarkdownToJSX.GFMTaskNode => {\n return parserResult.type === RuleType.gfmTask;\n};\n\nconst renderRules: Partial<Record<RuleType, MarkdownRenderRule>> = {\n [RuleType.blockQuote]: (_next, node, renderChildren, state) => {\n return (\n <MarkdownBlockquote key={state.key}>\n {renderChildrenSafe(renderChildren, getNodeChildren(node), state)}\n </MarkdownBlockquote>\n );\n },\n [RuleType.breakLine]: (_next, _node, _renderChildren, state) => {\n return <MarkdownLineBreak key={state.key} />;\n },\n [RuleType.breakThematic]: (_next, _node, _renderChildren, state) => {\n return <MarkdownThematicBreak key={state.key} />;\n },\n [RuleType.codeInline]: (_next, node, _renderChildren, state) => {\n if (!isCodeInlineNode(node)) {\n return null;\n }\n return <MarkdownInlineCode key={state.key} text={node.text} />;\n },\n [RuleType.codeBlock]: (_next, node, _renderChildren, state) => {\n if (!isCodeBlockNode(node)) {\n return null;\n }\n return (\n <MarkdownCodeBlock\n code={node.text}\n key={state.key}\n language={node.lang}\n />\n );\n },\n [RuleType.footnoteReference]: (_next, node, _renderChildren, state) => {\n if (!isFootnoteReferenceNode(node)) {\n return null;\n }\n return (\n <MarkdownFootnoteReference\n href={node.target}\n key={state.key}\n label={node.text}\n />\n );\n },\n [RuleType.gfmTask]: () => {\n return null;\n },\n [RuleType.heading]: (_next, node, renderChildren, state) => {\n if (!isHeadingNode(node)) {\n return null;\n }\n return (\n <MarkdownHeading id={node.id} key={state.key} level={node.level}>\n {renderChildrenSafe(renderChildren, node.children, state)}\n </MarkdownHeading>\n );\n },\n [RuleType.htmlBlock]: (_next, node, _renderChildren, state) => {\n if (!isHtmlBlockNode(node)) {\n return null;\n }\n const content = node.text;\n let fallbackContent = '';\n if (typeof content === 'string') {\n fallbackContent = content;\n }\n return (\n <MarkdownHtmlFallback\n content={fallbackContent}\n key={state.key}\n title=\"HTML non pris en charge\"\n />\n );\n },\n [RuleType.htmlSelfClosing]: (_next, node, _renderChildren, state) => {\n if (!isHtmlSelfClosingNode(node)) {\n return null;\n }\n return (\n <MarkdownHtmlFallback\n content={`<${node.tag} />`}\n key={state.key}\n title=\"HTML non pris en charge\"\n />\n );\n },\n [RuleType.image]: (_next, node, _renderChildren, state) => {\n if (!isImageNode(node)) {\n return null;\n }\n return (\n <MarkdownImage\n alt={node.alt}\n key={state.key}\n src={node.target}\n title={node.title}\n />\n );\n },\n [RuleType.link]: (_next, node, renderChildren, state) => {\n if (!isLinkNode(node)) {\n return null;\n }\n const href = node.target;\n if (href == null) {\n return (\n <Fragment key={state.key}>\n {renderChildrenSafe(renderChildren, node.children, state)}\n </Fragment>\n );\n }\n return (\n <MarkdownLink href={href} key={state.key} title={node.title}>\n {renderChildrenSafe(renderChildren, node.children, state)}\n </MarkdownLink>\n );\n },\n [RuleType.orderedList]: (_next, node, renderChildren, state) => {\n if (!isOrderedListNode(node)) {\n return null;\n }\n return (\n <MarkdownList key={state.key} ordered start={node.start}>\n {node.items.map((itemNodes, index) => {\n let listKeyPrefix = 'ol';\n if (state.key != null) {\n listKeyPrefix = String(state.key);\n }\n const key = `${listKeyPrefix}-${index}`;\n const first = itemNodes[0];\n if (first != null && isGfmTaskNode(first)) {\n const rest = itemNodes.slice(1);\n return (\n <MarkdownTaskListItem checked={first.completed} key={key}>\n {renderChildrenSafe(renderChildren, rest, state)}\n </MarkdownTaskListItem>\n );\n }\n return (\n <MarkdownListItem key={key}>\n {renderChildrenSafe(renderChildren, itemNodes, state)}\n </MarkdownListItem>\n );\n })}\n </MarkdownList>\n );\n },\n [RuleType.paragraph]: (_next, node, renderChildren, state) => {\n if (!isParagraphNode(node)) {\n return null;\n }\n return (\n <MarkdownParagraph key={state.key}>\n {renderChildrenSafe(renderChildren, node.children, state)}\n </MarkdownParagraph>\n );\n },\n [RuleType.table]: (_next, node, renderChildren, state) => {\n if (!isTableNode(node)) {\n return null;\n }\n\n let tableHeader: JSX.Element | null = null;\n if (Array.isArray(node.header) && node.header.length > 0) {\n tableHeader = (\n <MarkdownTableHead>\n <MarkdownTableRow>\n {node.header.map((headerCell, index) => {\n let alignValue: string | null | undefined;\n if (Array.isArray(node.align)) {\n alignValue = node.align[index];\n }\n const align = mapAlignment(alignValue);\n return (\n <MarkdownTableHeaderCell align={align} key={`header-${index}`}>\n {renderChildrenSafe(renderChildren, headerCell, state)}\n </MarkdownTableHeaderCell>\n );\n })}\n </MarkdownTableRow>\n </MarkdownTableHead>\n );\n }\n\n return (\n <MarkdownTable key={state.key}>\n {tableHeader}\n <MarkdownTableBody>\n {node.cells.map((row, rowIndex) => {\n return (\n <MarkdownTableRow key={`row-${rowIndex}`}>\n {row.map((cell, cellIndex) => {\n let alignValue: string | null | undefined;\n if (Array.isArray(node.align)) {\n alignValue = node.align[cellIndex];\n }\n const align = mapAlignment(alignValue);\n return (\n <MarkdownTableCell\n align={align}\n key={`cell-${rowIndex}-${cellIndex}`}\n >\n {renderChildrenSafe(renderChildren, cell, state)}\n </MarkdownTableCell>\n );\n })}\n </MarkdownTableRow>\n );\n })}\n </MarkdownTableBody>\n </MarkdownTable>\n );\n },\n [RuleType.text]: (_next, node, _renderChildren, state) => {\n if (!isTextNode(node)) {\n return null;\n }\n return <MarkdownText key={state.key} text={node.text} />;\n },\n [RuleType.textFormatted]: (next, node, renderChildren, state): ReactNode => {\n if (!isFormattedTextNode(node)) {\n return next();\n }\n\n const children = renderChildrenSafe(renderChildren, node.children, state);\n\n switch (node.tag) {\n case 'strong':\n case 'b':\n return <MarkdownStrong key={state.key}>{children}</MarkdownStrong>;\n case 'em':\n case 'i':\n return <MarkdownEmphasis key={state.key}>{children}</MarkdownEmphasis>;\n case 'mark':\n return <MarkdownMark key={state.key}>{children}</MarkdownMark>;\n case 'del':\n case 's':\n return <MarkdownDelete key={state.key}>{children}</MarkdownDelete>;\n default:\n return next();\n }\n },\n [RuleType.unorderedList]: (_next, node, renderChildren, state) => {\n if (!isUnorderedListNode(node)) {\n return null;\n }\n return (\n <MarkdownList key={state.key} ordered={false}>\n {node.items.map((itemNodes, index) => {\n let listKeyPrefix = 'ul';\n if (state.key != null) {\n listKeyPrefix = String(state.key);\n }\n const key = `${listKeyPrefix}-${index}`;\n const first = itemNodes[0];\n if (first != null && isGfmTaskNode(first)) {\n const rest = itemNodes.slice(1);\n return (\n <MarkdownTaskListItem checked={first.completed} key={key}>\n {renderChildrenSafe(renderChildren, rest, state)}\n </MarkdownTaskListItem>\n );\n }\n return (\n <MarkdownListItem key={key}>\n {renderChildrenSafe(renderChildren, itemNodes, state)}\n </MarkdownListItem>\n );\n })}\n </MarkdownList>\n );\n },\n};\n\nconst markdownOptions: MarkdownToJSX.Options = {\n disableParsingRawHTML: true,\n forceBlock: true,\n wrapper: Fragment,\n overrides: {\n footer: {\n component: MarkdownFootnotesSection,\n },\n sup: {\n component: MarkdownSuperscript,\n },\n sub: {\n component: MarkdownSubscript,\n },\n },\n renderRule(next, node, renderChildren, state): ReactNode {\n const type = node.type as RuleType;\n const rule = renderRules[type];\n if (rule != null) {\n return rule(next, node, renderChildren, state);\n }\n return next();\n },\n};\n\nexport const MarkdownRenderer = ({ content }: Props): JSX.Element => {\n const deferredContent = useDeferredValue(content);\n\n const memoisedContent = useMemo(() => {\n return deferredContent;\n }, [deferredContent]);\n\n return (\n <MarkdownArticleContainer>\n <Markdown options={markdownOptions}>{memoisedContent}</Markdown>\n </MarkdownArticleContainer>\n );\n};\n\nexport default MarkdownRenderer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAAgB,MAChB,MAAe,YAAY,MAAe,UACrC,IAEF,QAGH,KACJ,GACA,GACA,MAEI,KAAY,OACP,OAGF,EAAe,GAAU,EAAM,EAGlC,KACJ,MACuC;AACvC,KAAI,cAAc,EAIhB,QAHkB,EAGD;GAMf,KACJ,MAEO,EAAa,SAAS,EAAS,YAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,WAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,mBAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,SAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,WAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,iBAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,OAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,MAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,aAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,WAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,OAGlC,KACJ,MAEO,EAAa,SAAS,EAAS,MAGlC,KACJ,MAE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vD,IAAM,IAAO,EADA,EAAK;AAKlB,SAHI,KAAQ,OAGL,GAAM,GAFJ,EAAK,GAAM,GAAM,GAAgB,EAAM;;CAInD,EAEY,KAAoB,EAAE,iBAAkC;CACnE,IAAM,IAAkB,EAAiB,EAAQ;AAMjD,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAU,SAAS;YANC,QACf,GACN,CAAC,EAAgB,CAAC;EAI+C,CAAA,EACvC,CAAA"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { HighlightCode as e } from "../../highlight/HighlightCode.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Suspense as t, lazy as n } from "react";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
//#region src/atomic/molecules/markdown/components/LazyMarkdownCodeBlock.tsx
|
|
5
|
-
var i =
|
|
5
|
+
var i = n(async () => ({ default: (await import("./MarkdownCodeBlock.js")).MarkdownCodeBlock })), a = (e, t) => {
|
|
6
6
|
let n = t?.trim();
|
|
7
7
|
if (n != null && n !== "") return n;
|
|
8
8
|
let r = e?.trim();
|
|
9
9
|
return r != null && r !== "" ? r.toUpperCase() : "CODE";
|
|
10
|
-
}, o = ({ code:
|
|
11
|
-
fallback: /* @__PURE__ */
|
|
10
|
+
}, o = ({ code: n, language: o, badgeLabel: s }) => /* @__PURE__ */ r(t, {
|
|
11
|
+
fallback: /* @__PURE__ */ r(e, {
|
|
12
12
|
badgeLabel: a(o, s),
|
|
13
|
-
copyCode:
|
|
14
|
-
fallbackCodeText:
|
|
13
|
+
copyCode: n,
|
|
14
|
+
fallbackCodeText: n,
|
|
15
15
|
placeholderText: "Loading code block..."
|
|
16
16
|
}),
|
|
17
|
-
children: /* @__PURE__ */
|
|
17
|
+
children: /* @__PURE__ */ r(i, {
|
|
18
18
|
badgeLabel: s,
|
|
19
|
-
code:
|
|
19
|
+
code: n,
|
|
20
20
|
language: o
|
|
21
21
|
})
|
|
22
22
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HighlightCode as e } from "../../highlight/HighlightCode.js";
|
|
2
2
|
import { MarkdownMermaidBlock as t } from "./MarkdownMermaidBlock.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Suspense as n, lazy as r, useDeferredValue as i, useMemo as a } from "react";
|
|
4
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
5
5
|
//#region src/atomic/molecules/markdown/components/MarkdownCodeBlock.tsx
|
|
6
|
-
var s =
|
|
7
|
-
let u = a(
|
|
6
|
+
var s = r(async () => ({ default: (await import("./MarkdownShikiCodeBlock.js")).MarkdownShikiCodeBlock })), c = ({ code: r, language: c, badgeLabel: l }) => {
|
|
7
|
+
let u = i(a(() => r.replace(/\s+$/, ""), [r])), d = "plaintext";
|
|
8
8
|
if (c != null) {
|
|
9
9
|
let e = c.trim().toLowerCase();
|
|
10
10
|
e !== "" && (d = e);
|
|
@@ -17,14 +17,14 @@ var s = i(async () => ({ default: (await import("./MarkdownShikiCodeBlock.js")).
|
|
|
17
17
|
let e = c.trim();
|
|
18
18
|
e !== "" && (m = e.toUpperCase());
|
|
19
19
|
}
|
|
20
|
-
return f ? /* @__PURE__ */
|
|
21
|
-
fallback: /* @__PURE__ */
|
|
20
|
+
return f ? /* @__PURE__ */ o(t, { code: u }) : /* @__PURE__ */ o(n, {
|
|
21
|
+
fallback: /* @__PURE__ */ o(e, {
|
|
22
22
|
badgeLabel: m,
|
|
23
23
|
copyCode: u,
|
|
24
24
|
fallbackCodeText: u,
|
|
25
25
|
placeholderText: "Loading syntax highlighting..."
|
|
26
26
|
}),
|
|
27
|
-
children: /* @__PURE__ */
|
|
27
|
+
children: /* @__PURE__ */ o(s, {
|
|
28
28
|
badgeLabel: m,
|
|
29
29
|
code: u,
|
|
30
30
|
language: p
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { MarkdownCopySuccessSvg as e } from "../../../../icons/markdown/MarkdownCopySuccessSvg.js";
|
|
2
2
|
import { MarkdownCopySvg as t } from "../../../../icons/markdown/MarkdownCopySvg.js";
|
|
3
3
|
import { copyButton as n, icon as r, label as i } from "./MarkdownCodeCopyButton.css.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useCallback as a, useEffect as o, useRef as s, useState as c } from "react";
|
|
5
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
6
|
//#region src/atomic/molecules/markdown/components/MarkdownCodeCopyButton.tsx
|
|
7
7
|
var d = ({ code: d }) => {
|
|
8
|
-
let [f, p] =
|
|
9
|
-
|
|
8
|
+
let [f, p] = c(!1), m = s(null);
|
|
9
|
+
o(() => () => {
|
|
10
10
|
m.current != null && window.clearTimeout(m.current);
|
|
11
11
|
}, []);
|
|
12
|
-
let h =
|
|
12
|
+
let h = a(async () => {
|
|
13
13
|
try {
|
|
14
14
|
let e;
|
|
15
15
|
if (typeof navigator < "u" && (e = navigator.clipboard), e != null && typeof e.writeText == "function") await e.writeText(d);
|
|
@@ -23,17 +23,17 @@ var d = ({ code: d }) => {
|
|
|
23
23
|
} catch {}
|
|
24
24
|
}, [d]), g = "Copier le code";
|
|
25
25
|
f && (g = "Copié !");
|
|
26
|
-
let _ = /* @__PURE__ */
|
|
27
|
-
f && (_ = /* @__PURE__ */
|
|
26
|
+
let _ = /* @__PURE__ */ l(t, { className: r });
|
|
27
|
+
f && (_ = /* @__PURE__ */ l(e, { className: r }));
|
|
28
28
|
let v = "Copier";
|
|
29
|
-
return f && (v = "Copié"), /* @__PURE__ */
|
|
29
|
+
return f && (v = "Copié"), /* @__PURE__ */ u("button", {
|
|
30
30
|
className: n,
|
|
31
31
|
onClick: () => {
|
|
32
32
|
h().catch(() => {});
|
|
33
33
|
},
|
|
34
34
|
title: g,
|
|
35
35
|
type: "button",
|
|
36
|
-
children: [_, /* @__PURE__ */
|
|
36
|
+
children: [_, /* @__PURE__ */ l("span", {
|
|
37
37
|
className: i,
|
|
38
38
|
children: v
|
|
39
39
|
})]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { footnotesSection as e, footnotesTitle as t } from "./MarkdownFootnotesSection.css.js";
|
|
2
2
|
import { MarkdownFootnoteDefinition as n } from "./MarkdownFootnoteDefinition.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Children as r, isValidElement as i } from "react";
|
|
4
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
5
|
//#region src/atomic/molecules/markdown/components/MarkdownFootnotesSection.tsx
|
|
6
6
|
var s = ({ children: s }) => {
|
|
7
|
-
let c =
|
|
8
|
-
if (
|
|
7
|
+
let c = r.toArray(s).flatMap((e) => {
|
|
8
|
+
if (i(e)) {
|
|
9
9
|
let t = e.props;
|
|
10
10
|
if (typeof t.id == "string") {
|
|
11
11
|
let e = t.id;
|
|
12
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ a(n, {
|
|
13
13
|
id: e,
|
|
14
14
|
label: e,
|
|
15
15
|
children: t.children
|
|
@@ -18,10 +18,10 @@ var s = ({ children: s }) => {
|
|
|
18
18
|
}
|
|
19
19
|
return [];
|
|
20
20
|
});
|
|
21
|
-
return c.length === 0 ? null : /* @__PURE__ */
|
|
21
|
+
return c.length === 0 ? null : /* @__PURE__ */ o("section", {
|
|
22
22
|
className: e,
|
|
23
23
|
id: "footnotes",
|
|
24
|
-
children: [/* @__PURE__ */
|
|
24
|
+
children: [/* @__PURE__ */ a("p", {
|
|
25
25
|
className: t,
|
|
26
26
|
children: "Notes"
|
|
27
27
|
}), c]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { vars as e } from "../../../../theme/themeContract.js";
|
|
2
2
|
import { colors as t } from "../../../../theme/colors.js";
|
|
3
|
-
import {
|
|
3
|
+
import { HighlightCode as n } from "../../highlight/HighlightCode.js";
|
|
4
4
|
import { diagram as r, diagramSvg as i, error as a, errorCode as o, errorTitle as s } from "./MarkdownMermaidBlock.css.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useEffect as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
6
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
7
|
//#region src/atomic/molecules/markdown/components/MarkdownMermaidBlock.tsx
|
|
8
8
|
var h = /^var\((--[^,)+]+)(?:,[^)]+)?\)$/, g = (e, t) => {
|
|
9
9
|
let n = e.trim(), r = h.exec(n);
|
|
@@ -13,20 +13,20 @@ var h = /^var\((--[^,)+]+)(?:,[^)]+)?\)$/, g = (e, t) => {
|
|
|
13
13
|
let a = getComputedStyle(document.documentElement).getPropertyValue(i).trim();
|
|
14
14
|
return a === "" ? t : a;
|
|
15
15
|
}, _ = () => {
|
|
16
|
-
let
|
|
16
|
+
let n = {
|
|
17
17
|
background: "transparent",
|
|
18
|
-
fontFamily: g(
|
|
19
|
-
lineColor: g(
|
|
20
|
-
primaryBorderColor: g(
|
|
21
|
-
primaryColor: g(
|
|
22
|
-
primaryTextColor: g(
|
|
18
|
+
fontFamily: g(e.fontFamily.sans),
|
|
19
|
+
lineColor: g(e.colors.brandDarkGray, t.brandDarkGray),
|
|
20
|
+
primaryBorderColor: g(e.colors.primaryLight, t.primaryLight),
|
|
21
|
+
primaryColor: g(e.colors.primaryLight, t.primaryLight),
|
|
22
|
+
primaryTextColor: g(e.colors.brandDarkGray, t.brandDarkGray)
|
|
23
23
|
};
|
|
24
24
|
return {
|
|
25
25
|
startOnLoad: !1,
|
|
26
26
|
securityLevel: "strict",
|
|
27
27
|
suppressErrorRendering: !0,
|
|
28
28
|
theme: "base",
|
|
29
|
-
themeVariables: Object.fromEntries(Object.entries(
|
|
29
|
+
themeVariables: Object.fromEntries(Object.entries(n).filter(([, e]) => e != null && e !== ""))
|
|
30
30
|
};
|
|
31
31
|
}, v = null, y = !1, b = async () => {
|
|
32
32
|
v ??= import("../../../../node_modules/mermaid/dist/mermaid.core.js").then((e) => e.default);
|
|
@@ -35,54 +35,54 @@ var h = /^var\((--[^,)+]+)(?:,[^)]+)?\)$/, g = (e, t) => {
|
|
|
35
35
|
}, x = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Mermaid diagram failed to render.", S = /<svg\b([^>]*)>/i, C = /\bclass="([^"]*)"/i, w = (e, t) => e.replace(S, (e, n) => {
|
|
36
36
|
let r = String(n ?? "");
|
|
37
37
|
return C.test(r) ? `<svg${r.replace(C, (e, n) => ` class="${n} ${t}"`)}>` : `<svg class="${t}"${r}>`;
|
|
38
|
-
}), T = ({ code:
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
let
|
|
42
|
-
return _.current = null, y(null), C(null), E(!0),
|
|
43
|
-
|
|
38
|
+
}), T = ({ code: e }) => {
|
|
39
|
+
let t = l(), h = u(() => `mermaid-${t.replace(/:/g, "")}`, [t]), g = d(null), _ = d(null), [v, y] = f(null), [S, C] = f(null), [T, E] = f(!0);
|
|
40
|
+
c(() => {
|
|
41
|
+
let t = !1;
|
|
42
|
+
return _.current = null, y(null), C(null), E(!0), e.trim() === "" ? (C("Mermaid diagram is empty."), E(!1), () => {
|
|
43
|
+
t = !0;
|
|
44
44
|
}) : ((async () => {
|
|
45
45
|
try {
|
|
46
|
-
let n = await (await b()).render(h,
|
|
47
|
-
if (
|
|
46
|
+
let n = await (await b()).render(h, e);
|
|
47
|
+
if (t) return;
|
|
48
48
|
_.current = n.bindFunctions ?? null, y(w(n.svg, i));
|
|
49
|
-
} catch (
|
|
50
|
-
|
|
49
|
+
} catch (e) {
|
|
50
|
+
t || C(x(e));
|
|
51
51
|
} finally {
|
|
52
|
-
|
|
52
|
+
t || E(!1);
|
|
53
53
|
}
|
|
54
|
-
})().catch((
|
|
55
|
-
|
|
54
|
+
})().catch((e) => {
|
|
55
|
+
t || (C(x(e)), E(!1));
|
|
56
56
|
}), () => {
|
|
57
|
-
|
|
57
|
+
t = !0;
|
|
58
58
|
});
|
|
59
|
-
}, [
|
|
59
|
+
}, [e, h]), c(() => {
|
|
60
60
|
let e = g.current, t = _.current;
|
|
61
61
|
e == null || t == null || t(e);
|
|
62
62
|
}, [v]);
|
|
63
63
|
let D = null;
|
|
64
64
|
T && (D = "Rendering Mermaid diagram...");
|
|
65
65
|
let O = null;
|
|
66
|
-
return v == null ? S != null && (O = /* @__PURE__ */
|
|
66
|
+
return v == null ? S != null && (O = /* @__PURE__ */ m("div", {
|
|
67
67
|
className: a,
|
|
68
|
-
children: [/* @__PURE__ */
|
|
68
|
+
children: [/* @__PURE__ */ p("p", {
|
|
69
69
|
className: s,
|
|
70
70
|
children: S
|
|
71
|
-
}), /* @__PURE__ */
|
|
71
|
+
}), /* @__PURE__ */ p("pre", {
|
|
72
72
|
className: o,
|
|
73
|
-
children:
|
|
73
|
+
children: e
|
|
74
74
|
})]
|
|
75
|
-
})) : O = /* @__PURE__ */
|
|
75
|
+
})) : O = /* @__PURE__ */ p("div", {
|
|
76
76
|
className: r,
|
|
77
77
|
ref: g,
|
|
78
78
|
role: "img",
|
|
79
79
|
"aria-label": "Mermaid diagram",
|
|
80
80
|
dangerouslySetInnerHTML: { __html: v }
|
|
81
|
-
}), /* @__PURE__ */
|
|
81
|
+
}), /* @__PURE__ */ p(n, {
|
|
82
82
|
badgeLabel: "MERMAID",
|
|
83
|
-
copyCode:
|
|
83
|
+
copyCode: e,
|
|
84
84
|
highlighted: O,
|
|
85
|
-
fallbackCodeText:
|
|
85
|
+
fallbackCodeText: e,
|
|
86
86
|
placeholderText: D
|
|
87
87
|
});
|
|
88
88
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { HighlightCode as e } from "../../highlight/HighlightCode.js";
|
|
2
2
|
import { useShikiHighlighter2 as t } from "../../../../node_modules/react-shiki/dist/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useDeferredValue as n, useMemo as r } from "react";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/atomic/molecules/markdown/components/MarkdownShikiCodeBlock.tsx
|
|
6
6
|
var a = "github-light", o = ({ badgeLabel: o, code: s, language: c }) => {
|
|
7
|
-
let l = r(
|
|
8
|
-
return /* @__PURE__ */
|
|
7
|
+
let l = n(r(() => s.replace(/\s+$/, ""), [s]));
|
|
8
|
+
return /* @__PURE__ */ i(e, {
|
|
9
9
|
badgeLabel: o,
|
|
10
10
|
copyCode: l,
|
|
11
11
|
fallbackCodeText: l,
|
|
@@ -3,8 +3,8 @@ import { ChevronDownSvg as t } from "../../../icons/ChevronDownSvg.js";
|
|
|
3
3
|
import { ProfileDropdownLogoutSvg as n } from "../../../icons/ProfileDropdownLogoutSvg.js";
|
|
4
4
|
import { ProfileDropdownOrganizationSvg as r } from "../../../icons/ProfileDropdownOrganizationSvg.js";
|
|
5
5
|
import { avatar as i, chevron as a, chevronOpen as o, container as s, dropdown as c, menuIcon as l, menuItem as u, menuLabel as d, organizationName as f, selectButton as p, selectContent as m, selectText as h, userName as g } from "./profileDropdown.css.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { useEffect as _, useRef as v, useState as y } from "react";
|
|
7
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
8
8
|
import { Link as S } from "@plumile/router";
|
|
9
9
|
//#region src/atomic/molecules/profile_dropdown/ProfileDropdown.tsx
|
|
10
10
|
var C = {
|
|
@@ -13,12 +13,12 @@ var C = {
|
|
|
13
13
|
switchOrganizations: "Switch Organizations",
|
|
14
14
|
signOut: "Sign Out"
|
|
15
15
|
}, w = (w) => {
|
|
16
|
-
let [T, E] =
|
|
16
|
+
let [T, E] = y(!1), D = v(null), { viewer: O, organization: k, labels: A = C } = w, j = () => {
|
|
17
17
|
E((e) => !e);
|
|
18
18
|
}, M = () => {
|
|
19
19
|
E(!1);
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
_(() => {
|
|
22
22
|
let e = (e) => {
|
|
23
23
|
D.current != null && !D.current.contains(e.target) && E(!1);
|
|
24
24
|
};
|
|
@@ -27,85 +27,85 @@ var C = {
|
|
|
27
27
|
};
|
|
28
28
|
}, []);
|
|
29
29
|
let N = [O.firstName, O.lastName].filter((e) => e.trim().length > 0).join(" "), P = null;
|
|
30
|
-
return T && (P = /* @__PURE__ */
|
|
30
|
+
return T && (P = /* @__PURE__ */ x("div", {
|
|
31
31
|
className: c,
|
|
32
32
|
role: "menu",
|
|
33
33
|
children: [
|
|
34
|
-
/* @__PURE__ */
|
|
34
|
+
/* @__PURE__ */ x(S, {
|
|
35
35
|
to: w.profilePath,
|
|
36
36
|
className: u,
|
|
37
37
|
onClick: M,
|
|
38
|
-
children: [/* @__PURE__ */
|
|
38
|
+
children: [/* @__PURE__ */ b("span", {
|
|
39
39
|
className: l,
|
|
40
|
-
children: /* @__PURE__ */
|
|
40
|
+
children: /* @__PURE__ */ b(r, {
|
|
41
41
|
width: 16,
|
|
42
42
|
height: 16
|
|
43
43
|
})
|
|
44
|
-
}), /* @__PURE__ */
|
|
44
|
+
}), /* @__PURE__ */ b("span", {
|
|
45
45
|
className: d,
|
|
46
46
|
children: A.profileSecurity
|
|
47
47
|
})]
|
|
48
48
|
}),
|
|
49
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ x(S, {
|
|
50
50
|
to: k.switchPath,
|
|
51
51
|
className: u,
|
|
52
52
|
onClick: M,
|
|
53
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ b("span", {
|
|
54
54
|
className: l,
|
|
55
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ b(r, {
|
|
56
56
|
width: 16,
|
|
57
57
|
height: 16
|
|
58
58
|
})
|
|
59
|
-
}), /* @__PURE__ */
|
|
59
|
+
}), /* @__PURE__ */ b("span", {
|
|
60
60
|
className: d,
|
|
61
61
|
children: A.switchOrganizations
|
|
62
62
|
})]
|
|
63
63
|
}),
|
|
64
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ x("button", {
|
|
65
65
|
className: u,
|
|
66
66
|
onClick: () => {
|
|
67
67
|
w.onSignOut?.(), M();
|
|
68
68
|
},
|
|
69
69
|
type: "button",
|
|
70
70
|
role: "menuitem",
|
|
71
|
-
children: [/* @__PURE__ */
|
|
71
|
+
children: [/* @__PURE__ */ b("span", {
|
|
72
72
|
className: l,
|
|
73
|
-
children: /* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ b(n, {
|
|
74
74
|
width: 16,
|
|
75
75
|
height: 16
|
|
76
76
|
})
|
|
77
|
-
}), /* @__PURE__ */
|
|
77
|
+
}), /* @__PURE__ */ b("span", {
|
|
78
78
|
className: d,
|
|
79
79
|
children: A.signOut
|
|
80
80
|
})]
|
|
81
81
|
})
|
|
82
82
|
]
|
|
83
|
-
})), /* @__PURE__ */
|
|
83
|
+
})), /* @__PURE__ */ x("div", {
|
|
84
84
|
className: e(s, w.className),
|
|
85
85
|
ref: D,
|
|
86
|
-
children: [/* @__PURE__ */
|
|
86
|
+
children: [/* @__PURE__ */ x("button", {
|
|
87
87
|
className: p,
|
|
88
88
|
onClick: j,
|
|
89
89
|
"aria-expanded": T,
|
|
90
90
|
"aria-haspopup": "menu",
|
|
91
91
|
"aria-label": A.menuAriaLabel,
|
|
92
92
|
type: "button",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
93
|
+
children: [/* @__PURE__ */ x("span", {
|
|
94
94
|
className: m,
|
|
95
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ b("span", {
|
|
96
96
|
className: i,
|
|
97
97
|
children: O.initials
|
|
98
|
-
}), /* @__PURE__ */
|
|
98
|
+
}), /* @__PURE__ */ x("span", {
|
|
99
99
|
className: h,
|
|
100
|
-
children: [/* @__PURE__ */
|
|
100
|
+
children: [/* @__PURE__ */ b("span", {
|
|
101
101
|
className: g,
|
|
102
102
|
children: N
|
|
103
|
-
}), /* @__PURE__ */
|
|
103
|
+
}), /* @__PURE__ */ b("span", {
|
|
104
104
|
className: f,
|
|
105
105
|
children: k.name
|
|
106
106
|
})]
|
|
107
107
|
})]
|
|
108
|
-
}), /* @__PURE__ */
|
|
108
|
+
}), /* @__PURE__ */ b(t, {
|
|
109
109
|
width: 16,
|
|
110
110
|
height: 16,
|
|
111
111
|
className: e(a, { [o]: T })
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { INFO_TOAST_DURATION_MS as e } from "./constants.js";
|
|
2
2
|
import { ToastViewport as t } from "./ToastViewport.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { createContext as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
4
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
5
|
//#region src/atomic/molecules/toast/ToastProvider.tsx
|
|
6
|
-
var d =
|
|
6
|
+
var d = n(null), f = (e, t) => (n, r) => e.push({
|
|
7
7
|
kind: t,
|
|
8
8
|
title: n,
|
|
9
9
|
message: r
|
|
10
|
-
}), p = ({ children:
|
|
11
|
-
let [p, m] =
|
|
10
|
+
}), p = ({ children: n, maxToasts: i = 4 }) => {
|
|
11
|
+
let [p, m] = c([]), h = s(0), g = s(/* @__PURE__ */ new Map()), _ = r((e) => {
|
|
12
12
|
let t = g.current.get(e);
|
|
13
13
|
t != null && (clearTimeout(t), g.current.delete(e)), m((t) => t.filter((t) => t.id !== e));
|
|
14
|
-
}, []), v =
|
|
14
|
+
}, []), v = r(() => {
|
|
15
15
|
g.current.forEach((e) => {
|
|
16
16
|
clearTimeout(e);
|
|
17
17
|
}), g.current.clear(), m([]);
|
|
18
|
-
}, []), y =
|
|
18
|
+
}, []), y = r((e) => {
|
|
19
19
|
let t = e.id ?? `toast-${h.current++}`;
|
|
20
20
|
return m((n) => {
|
|
21
21
|
let r = [...n, {
|
|
@@ -23,10 +23,10 @@ var d = i(null), f = (e, t) => (n, r) => e.push({
|
|
|
23
23
|
kind: e.kind ?? "info",
|
|
24
24
|
id: t
|
|
25
25
|
}];
|
|
26
|
-
return r.length >
|
|
26
|
+
return r.length > i ? r.slice(r.length - i) : r;
|
|
27
27
|
}), t;
|
|
28
|
-
}, [
|
|
29
|
-
|
|
28
|
+
}, [i]);
|
|
29
|
+
a(() => {
|
|
30
30
|
let t = /* @__PURE__ */ new Set();
|
|
31
31
|
p.forEach((n) => {
|
|
32
32
|
if (n.kind !== "info" || (t.add(n.id), g.current.has(n.id))) return;
|
|
@@ -37,7 +37,7 @@ var d = i(null), f = (e, t) => (n, r) => e.push({
|
|
|
37
37
|
}), g.current.forEach((e, n) => {
|
|
38
38
|
t.has(n) || (clearTimeout(e), g.current.delete(n));
|
|
39
39
|
});
|
|
40
|
-
}, [p]),
|
|
40
|
+
}, [p]), a(() => {
|
|
41
41
|
let e = g.current;
|
|
42
42
|
return () => {
|
|
43
43
|
e.forEach((e) => {
|
|
@@ -45,7 +45,7 @@ var d = i(null), f = (e, t) => (n, r) => e.push({
|
|
|
45
45
|
}), e.clear();
|
|
46
46
|
};
|
|
47
47
|
}, []);
|
|
48
|
-
let b =
|
|
48
|
+
let b = o(() => {
|
|
49
49
|
let e = {
|
|
50
50
|
push: y,
|
|
51
51
|
dismiss: _,
|
|
@@ -65,15 +65,15 @@ var d = i(null), f = (e, t) => (n, r) => e.push({
|
|
|
65
65
|
_,
|
|
66
66
|
y
|
|
67
67
|
]);
|
|
68
|
-
return /* @__PURE__ */
|
|
68
|
+
return /* @__PURE__ */ u(d.Provider, {
|
|
69
69
|
value: b,
|
|
70
|
-
children: [
|
|
70
|
+
children: [n, /* @__PURE__ */ l(t, {
|
|
71
71
|
toasts: p,
|
|
72
72
|
onDismiss: _
|
|
73
73
|
})]
|
|
74
74
|
});
|
|
75
75
|
}, m = () => {
|
|
76
|
-
let e =
|
|
76
|
+
let e = i(d);
|
|
77
77
|
if (e == null) throw Error("useToast must be used within a ToastProvider");
|
|
78
78
|
return e;
|
|
79
79
|
};
|