@redocly/theme 0.56.0-rc.2 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.js +3 -1
- package/lib/components/Button/ButtonGroup.d.ts +12 -0
- package/lib/components/Button/ButtonGroup.js +38 -0
- package/lib/components/Button/variables.js +32 -5
- package/lib/components/Catalog/Catalog.d.ts +1 -1
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +11 -6
- package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +5 -1
- package/lib/components/Catalog/CatalogEntitiesEmptyState.js +25 -4
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +1 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +17 -13
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.d.ts +4 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +15 -7
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +6 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +18 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +47 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.js +8 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +7 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +12 -5
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +7 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.js +19 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +4 -10
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +3 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +2 -6
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +3 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +5 -5
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +55 -0
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityIcon.js +22 -29
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +11 -23
- package/lib/components/Catalog/CatalogEntityTypeTag.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntityTypeTag.js +40 -0
- package/lib/components/Catalog/CatalogPageDescription.js +3 -3
- package/lib/components/Catalog/CatalogSelector.d.ts +1 -1
- package/lib/components/Catalog/CatalogSelector.js +4 -3
- package/lib/components/Catalog/CatalogSortButton.js +6 -6
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +1 -0
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +3 -15
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +1 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +1 -1
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +1 -5
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +3 -3
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +5 -32
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +0 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +12 -37
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +1 -0
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +8 -4
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +1 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +4 -4
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
- package/lib/components/Catalog/variables.js +42 -8
- package/lib/components/CodeBlock/CodeBlock.d.ts +16 -6
- package/lib/components/CodeBlock/CodeBlock.js +3 -2
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +4 -3
- package/lib/components/CodeBlock/CodeBlockControls.js +35 -8
- package/lib/components/CodeBlock/CodeBlockDropdown.d.ts +3 -0
- package/lib/components/CodeBlock/CodeBlockDropdown.js +35 -0
- package/lib/components/CodeBlock/CodeBlockTabs.d.ts +2 -2
- package/lib/components/CodeBlock/CodeBlockTabs.js +18 -9
- package/lib/components/CodeBlock/variables.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +1 -0
- package/lib/components/Dropdown/DropdownMenu.js +4 -0
- package/lib/components/Dropdown/variables.js +1 -0
- package/lib/components/Feedback/Feedback.js +1 -1
- package/lib/components/Filter/FilterCheckboxes.js +5 -2
- package/lib/components/Footer/FooterItem.js +4 -7
- package/lib/components/Footer/variables.js +2 -2
- package/lib/components/Image/Image.js +2 -0
- package/lib/components/Markdown/Markdown.js +9 -9
- package/lib/components/Markdown/styles/headingAnchor.js +0 -1
- package/lib/components/Menu/MenuItem.js +5 -5
- package/lib/components/Menu/variables.js +3 -1
- package/lib/components/Navbar/NavbarItem.js +8 -39
- package/lib/components/Navbar/variables.js +2 -2
- package/lib/components/PageActions/PageActions.d.ts +6 -0
- package/lib/components/PageActions/PageActions.js +104 -0
- package/lib/components/PageActions/PageActionsMenuItem.d.ts +7 -0
- package/lib/components/PageActions/PageActionsMenuItem.js +58 -0
- package/lib/components/PageActions/variables.d.ts +1 -0
- package/lib/components/PageActions/variables.dark.d.ts +1 -0
- package/lib/components/PageActions/variables.dark.js +9 -0
- package/lib/components/PageActions/variables.js +37 -0
- package/lib/components/Search/SearchDialog.js +2 -2
- package/lib/components/Select/variables.js +2 -2
- package/lib/components/TableOfContent/TableOfContent.js +15 -12
- package/lib/components/Tag/Tag.d.ts +2 -1
- package/lib/components/Tag/Tag.js +3 -3
- package/lib/components/Tag/variables.js +14 -0
- package/lib/core/constants/catalog.d.ts +1 -1
- package/lib/core/constants/common.d.ts +4 -0
- package/lib/core/constants/common.js +5 -1
- package/lib/core/contexts/CodeSnippetContext.d.ts +7 -0
- package/lib/core/contexts/CodeSnippetContext.js +23 -0
- package/lib/core/contexts/index.d.ts +1 -0
- package/lib/core/contexts/index.js +1 -0
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -0
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -0
- package/lib/core/hooks/code-walkthrough/use-renderable-files.d.ts +1 -2
- package/lib/core/hooks/code-walkthrough/use-renderable-files.js +2 -2
- package/lib/core/hooks/index.d.ts +1 -0
- package/lib/core/hooks/index.js +1 -0
- package/lib/core/hooks/use-active-heading.d.ts +7 -2
- package/lib/core/hooks/use-active-heading.js +160 -23
- package/lib/core/hooks/use-active-section-id.d.ts +1 -1
- package/lib/core/hooks/use-active-section-id.js +2 -2
- package/lib/core/hooks/use-codeblock-tabs-controls.d.ts +2 -2
- package/lib/core/hooks/use-codeblock-tabs-controls.js +6 -6
- package/lib/core/hooks/use-local-state.d.ts +1 -0
- package/lib/core/hooks/use-local-state.js +32 -0
- package/lib/core/hooks/use-page-actions.d.ts +2 -0
- package/lib/core/hooks/use-page-actions.js +101 -0
- package/lib/core/hooks/use-theme-hooks.js +2 -0
- package/lib/core/styles/dark.js +2 -0
- package/lib/core/styles/global.js +2 -0
- package/lib/core/types/catalog.d.ts +5 -1
- package/lib/core/types/hooks.d.ts +2 -1
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/index.js +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/page-actions.d.ts +15 -0
- package/lib/core/types/page-actions.js +3 -0
- package/lib/core/types/sidebar.d.ts +1 -0
- package/lib/core/types/telemetry.d.ts +5 -20
- package/lib/core/utils/download-code-walkthrough.js +27 -7
- package/lib/core/utils/enhanced-smoothstep.d.ts +5 -0
- package/lib/core/utils/enhanced-smoothstep.js +15 -0
- package/lib/core/utils/get-file-icon.d.ts +3 -2
- package/lib/core/utils/get-file-icon.js +109 -29
- package/lib/core/utils/icon-resolver.d.ts +28 -0
- package/lib/core/utils/icon-resolver.js +52 -0
- package/lib/core/utils/index.d.ts +4 -1
- package/lib/core/utils/index.js +4 -1
- package/lib/core/utils/lang-to-name.d.ts +1 -0
- package/lib/core/utils/lang-to-name.js +37 -0
- package/lib/core/utils/{text-transform.js → string.js} +1 -1
- package/lib/ext/configure.d.ts +1 -1
- package/lib/icons/CDNIcon/CDNIcon.d.ts +14 -0
- package/lib/icons/CDNIcon/CDNIcon.js +48 -0
- package/lib/icons/ChatGptIcon/ChatGptIcon.d.ts +9 -0
- package/lib/icons/ChatGptIcon/ChatGptIcon.js +22 -0
- package/lib/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon.d.ts +9 -0
- package/lib/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon.js +23 -0
- package/lib/icons/ClaudeIcon/ClaudeIcon.d.ts +9 -0
- package/lib/icons/ClaudeIcon/ClaudeIcon.js +22 -0
- package/lib/icons/GenericIcon/GenericIcon.d.ts +11 -0
- package/lib/icons/GenericIcon/GenericIcon.js +61 -0
- package/lib/icons/GraphqlIcon/GraphqlIcon.d.ts +9 -0
- package/lib/icons/GraphqlIcon/GraphqlIcon.js +36 -0
- package/lib/icons/GraphqlIcon/index.d.ts +1 -0
- package/lib/icons/GraphqlIcon/index.js +6 -0
- package/lib/icons/HexagonIcon/HexagonIcon.d.ts +9 -0
- package/lib/icons/HexagonIcon/HexagonIcon.js +22 -0
- package/lib/icons/MarkdownFullIcon/MarkdownFullIcon.d.ts +9 -0
- package/lib/icons/MarkdownFullIcon/MarkdownFullIcon.js +23 -0
- package/lib/icons/MoleculesIcon/MoleculesIcon.d.ts +9 -0
- package/lib/icons/MoleculesIcon/MoleculesIcon.js +22 -0
- package/lib/icons/NetworkIcon/NetworkIcon.d.ts +9 -0
- package/lib/icons/NetworkIcon/NetworkIcon.js +23 -0
- package/lib/icons/NoneIcon/NoneIcon.d.ts +9 -0
- package/lib/icons/NoneIcon/NoneIcon.js +17 -0
- package/lib/icons/NotesIcon/NotesIcon.d.ts +9 -0
- package/lib/icons/NotesIcon/NotesIcon.js +26 -0
- package/lib/icons/types.d.ts +6 -0
- package/lib/index.d.ts +7 -1
- package/lib/index.js +7 -1
- package/lib/layouts/CodeWalkthroughLayout.js +2 -2
- package/lib/layouts/DocumentationLayout.js +14 -10
- package/lib/markdoc/components/Cards/CardIcon.js +7 -19
- package/lib/markdoc/components/CodeGroup/CodeGroup.d.ts +4 -0
- package/lib/markdoc/components/CodeGroup/CodeGroup.js +72 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +7 -4
- package/lib/markdoc/components/Heading/Heading.d.ts +2 -1
- package/lib/markdoc/components/Heading/Heading.js +21 -3
- package/lib/markdoc/components/Icon/Icon.d.ts +3 -0
- package/lib/markdoc/components/Icon/Icon.js +29 -0
- package/lib/markdoc/components/Tabs/Tab.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tab.js +5 -2
- package/lib/markdoc/components/Tabs/Tabs.d.ts +1 -1
- package/lib/markdoc/components/Tabs/variables.js +2 -0
- package/lib/markdoc/components/default.d.ts +2 -0
- package/lib/markdoc/components/default.js +2 -0
- package/lib/markdoc/default.js +4 -0
- package/lib/markdoc/tags/card.js +1 -1
- package/lib/markdoc/tags/code-group.d.ts +2 -0
- package/lib/markdoc/tags/code-group.js +23 -0
- package/lib/markdoc/tags/code-snippet.js +1 -1
- package/lib/markdoc/tags/icon.d.ts +2 -0
- package/lib/markdoc/tags/icon.js +16 -0
- package/lib/markdoc/tags/tab.js +1 -0
- package/package.json +4 -4
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Button/Button.tsx +4 -2
- package/src/components/Button/ButtonGroup.tsx +53 -0
- package/src/components/Button/variables.ts +32 -5
- package/src/components/Catalog/Catalog.tsx +1 -1
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +12 -6
- package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +38 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +25 -17
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +25 -9
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +12 -15
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +39 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +61 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +12 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +7 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +15 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +2 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +11 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +37 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +2 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +7 -23
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +5 -6
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +21 -13
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +9 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +52 -0
- package/src/components/Catalog/CatalogEntityIcon.tsx +33 -33
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +23 -28
- package/src/components/Catalog/CatalogEntityTypeTag.tsx +49 -0
- package/src/components/Catalog/CatalogPageDescription.tsx +5 -4
- package/src/components/Catalog/CatalogSelector.tsx +3 -1
- package/src/components/Catalog/CatalogSortButton.tsx +19 -20
- package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +1 -0
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +3 -17
- package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +1 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +5 -8
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +6 -36
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +18 -46
- package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +1 -0
- package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +9 -4
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +9 -5
- package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
- package/src/components/Catalog/variables.ts +42 -8
- package/src/components/CodeBlock/CodeBlock.tsx +15 -5
- package/src/components/CodeBlock/CodeBlockControls.tsx +67 -26
- package/src/components/CodeBlock/CodeBlockDropdown.tsx +53 -0
- package/src/components/CodeBlock/CodeBlockTabs.tsx +29 -20
- package/src/components/CodeBlock/variables.ts +1 -1
- package/src/components/Dropdown/Dropdown.tsx +1 -0
- package/src/components/Dropdown/DropdownMenu.tsx +4 -0
- package/src/components/Dropdown/variables.ts +1 -0
- package/src/components/Feedback/Feedback.tsx +1 -1
- package/src/components/Filter/FilterCheckboxes.tsx +9 -2
- package/src/components/Footer/FooterItem.tsx +5 -12
- package/src/components/Footer/variables.ts +2 -2
- package/src/components/Image/Image.tsx +2 -0
- package/src/components/Markdown/Markdown.tsx +3 -3
- package/src/components/Markdown/styles/headingAnchor.ts +0 -1
- package/src/components/Menu/MenuItem.tsx +5 -5
- package/src/components/Menu/variables.ts +3 -1
- package/src/components/Navbar/NavbarItem.tsx +8 -17
- package/src/components/Navbar/variables.ts +2 -2
- package/src/components/PageActions/PageActions.tsx +110 -0
- package/src/components/PageActions/PageActionsMenuItem.tsx +73 -0
- package/src/components/PageActions/variables.dark.ts +6 -0
- package/src/components/PageActions/variables.ts +34 -0
- package/src/components/Search/SearchDialog.tsx +2 -2
- package/src/components/Select/variables.ts +2 -2
- package/src/components/TableOfContent/TableOfContent.tsx +33 -36
- package/src/components/Tag/Tag.tsx +11 -2
- package/src/components/Tag/variables.ts +14 -0
- package/src/core/constants/catalog.ts +1 -1
- package/src/core/constants/common.ts +4 -0
- package/src/core/contexts/CodeSnippetContext.tsx +31 -0
- package/src/core/contexts/index.ts +1 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/code-walkthrough/use-renderable-files.ts +3 -4
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/use-active-heading.ts +199 -28
- package/src/core/hooks/use-active-section-id.ts +2 -1
- package/src/core/hooks/use-codeblock-tabs-controls.ts +8 -8
- package/src/core/hooks/use-local-state.ts +30 -0
- package/src/core/hooks/use-page-actions.ts +115 -0
- package/src/core/hooks/use-theme-hooks.ts +2 -0
- package/src/core/styles/dark.ts +2 -1
- package/src/core/styles/global.ts +2 -0
- package/src/core/types/catalog.ts +5 -1
- package/src/core/types/hooks.ts +2 -0
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +21 -0
- package/src/core/types/page-actions.ts +18 -0
- package/src/core/types/sidebar.ts +1 -0
- package/src/core/types/telemetry.ts +5 -13
- package/src/core/utils/download-code-walkthrough.ts +5 -4
- package/src/core/utils/enhanced-smoothstep.ts +14 -0
- package/src/core/utils/get-file-icon.tsx +94 -0
- package/src/core/utils/icon-resolver.ts +57 -0
- package/src/core/utils/index.ts +4 -1
- package/src/core/utils/lang-to-name.ts +35 -0
- package/src/ext/configure.ts +1 -1
- package/src/icons/CDNIcon/CDNIcon.tsx +47 -0
- package/src/icons/ChatGptIcon/ChatGptIcon.tsx +23 -0
- package/src/icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon.tsx +24 -0
- package/src/icons/ClaudeIcon/ClaudeIcon.tsx +23 -0
- package/src/icons/GenericIcon/GenericIcon.tsx +69 -0
- package/src/icons/GraphqlIcon/GraphqlIcon.tsx +81 -0
- package/src/icons/GraphqlIcon/index.ts +1 -0
- package/src/icons/HexagonIcon/HexagonIcon.tsx +23 -0
- package/src/icons/MarkdownFullIcon/MarkdownFullIcon.tsx +24 -0
- package/src/icons/MoleculesIcon/MoleculesIcon.tsx +23 -0
- package/src/icons/NetworkIcon/NetworkIcon.tsx +31 -0
- package/src/icons/NoneIcon/NoneIcon.tsx +17 -0
- package/src/icons/NotesIcon/NotesIcon.tsx +43 -0
- package/src/icons/types.ts +7 -0
- package/src/index.ts +7 -1
- package/src/layouts/CodeWalkthroughLayout.tsx +1 -1
- package/src/layouts/DocumentationLayout.tsx +23 -13
- package/src/markdoc/components/Cards/CardIcon.tsx +6 -21
- package/src/markdoc/components/CodeGroup/CodeGroup.tsx +78 -0
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +7 -4
- package/src/markdoc/components/Heading/Heading.tsx +22 -3
- package/src/markdoc/components/Icon/Icon.tsx +16 -0
- package/src/markdoc/components/Tabs/Tab.tsx +6 -1
- package/src/markdoc/components/Tabs/Tabs.tsx +1 -1
- package/src/markdoc/components/Tabs/variables.ts +2 -0
- package/src/markdoc/components/default.ts +2 -0
- package/src/markdoc/default.ts +4 -0
- package/src/markdoc/tags/card.ts +1 -1
- package/src/markdoc/tags/code-group.ts +21 -0
- package/src/markdoc/tags/code-snippet.ts +1 -1
- package/src/markdoc/tags/icon.ts +14 -0
- package/src/markdoc/tags/tab.ts +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.d.ts +0 -1
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +0 -5
- package/lib/ext/process-scorecard.d.ts +0 -5
- package/lib/ext/process-scorecard.js +0 -11
- package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +0 -1
- package/src/core/utils/get-file-icon.ts +0 -42
- package/src/ext/process-scorecard.ts +0 -13
- /package/lib/core/utils/{text-transform.d.ts → string.d.ts} +0 -0
- /package/src/core/utils/{text-transform.ts → string.ts} +0 -0
|
@@ -18,6 +18,8 @@ const fallbacks = {
|
|
|
18
18
|
useBreadcrumbs: () => [],
|
|
19
19
|
useCodeHighlight: () => ({ highlight: (rawContent: string) => rawContent }),
|
|
20
20
|
useUserMenu: () => ({}),
|
|
21
|
+
usePageData: () => null,
|
|
22
|
+
usePageProps: () => ({}),
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
export const useThemeHooks = () => {
|
package/src/core/styles/dark.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { statusCodeDarkMode } from '@redocly/theme/components/StatusCode/variabl
|
|
|
11
11
|
import { switcherDarkMode } from '@redocly/theme/components/Switch/variables.dark';
|
|
12
12
|
import { cardsDarkMode } from '@redocly/theme/markdoc/components/Cards/variables.dark';
|
|
13
13
|
import { catalogDarkMode } from '@redocly/theme/components/Catalog/variables.dark';
|
|
14
|
-
|
|
14
|
+
import { pageActionsDarkMode } from '@redocly/theme/components/PageActions/variables.dark';
|
|
15
15
|
|
|
16
16
|
const replayDarkMode = css`
|
|
17
17
|
/**
|
|
@@ -318,6 +318,7 @@ export const darkMode = css`
|
|
|
318
318
|
${switcherDarkMode}
|
|
319
319
|
${cardsDarkMode}
|
|
320
320
|
${catalogDarkMode}
|
|
321
|
+
${pageActionsDarkMode}
|
|
321
322
|
|
|
322
323
|
/**
|
|
323
324
|
* @tokens Dark Theme Scrollbar Config
|
|
@@ -38,6 +38,7 @@ import { switcher } from '@redocly/theme/components/Switch/variables';
|
|
|
38
38
|
import { cards } from '@redocly/theme/markdoc/components/Cards/variables';
|
|
39
39
|
import { codeWalkthrough } from '@redocly/theme/markdoc/components/CodeWalkthrough/variables';
|
|
40
40
|
import { skipContent } from '@redocly/theme/components/SkipContent/variables';
|
|
41
|
+
import { pageActions } from '@redocly/theme/components/PageActions/variables';
|
|
41
42
|
|
|
42
43
|
import { darkMode } from './dark';
|
|
43
44
|
|
|
@@ -1268,6 +1269,7 @@ export const styles = css`
|
|
|
1268
1269
|
${datePicker}
|
|
1269
1270
|
${replay}
|
|
1270
1271
|
${skipContent}
|
|
1272
|
+
${pageActions}
|
|
1271
1273
|
|
|
1272
1274
|
background-color: var(--bg-color);
|
|
1273
1275
|
color: var(--text-color-primary);
|
|
@@ -3,7 +3,7 @@ import { CatalogEntityConfig, LayoutVariant } from '@redocly/config';
|
|
|
3
3
|
|
|
4
4
|
import type { CatalogFilterConfig } from '@redocly/theme/config';
|
|
5
5
|
|
|
6
|
-
import { ENTITY_RELATION_TYPES } from '
|
|
6
|
+
import { ENTITY_RELATION_TYPES } from '../constants/catalog';
|
|
7
7
|
|
|
8
8
|
export type SortOption = 'title' | '-title' | 'type' | '-type';
|
|
9
9
|
|
|
@@ -54,6 +54,10 @@ export type ResolvedFilter = Omit<CatalogFilterConfig, 'options'> & {
|
|
|
54
54
|
selectOption: (option: string) => void;
|
|
55
55
|
parentUsed: boolean;
|
|
56
56
|
selectedOptions: Set<string> | { from?: string; to?: string };
|
|
57
|
+
filteredOptions?: {
|
|
58
|
+
value: string;
|
|
59
|
+
count: number;
|
|
60
|
+
}[];
|
|
57
61
|
};
|
|
58
62
|
|
|
59
63
|
export type CatalogItem = {
|
package/src/core/types/hooks.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
CatalogEntityConfig,
|
|
3
|
+
PageData,
|
|
3
4
|
PageProps,
|
|
4
5
|
ResolvedNavItemWithLink,
|
|
5
6
|
Version,
|
|
@@ -151,6 +152,7 @@ export type ThemeHooks = {
|
|
|
151
152
|
send<TEventType extends EventType>(event: SendEventParams<TEventType>): void;
|
|
152
153
|
};
|
|
153
154
|
useUserTeams: () => string[];
|
|
155
|
+
usePageData: () => PageData | null;
|
|
154
156
|
usePageProps: <T extends Record<string, unknown>>() => PageProps & T;
|
|
155
157
|
useCodeHighlight: () => {
|
|
156
158
|
highlight: (
|
package/src/core/types/index.ts
CHANGED
package/src/core/types/l10n.ts
CHANGED
|
@@ -136,7 +136,14 @@ export type TranslationKey =
|
|
|
136
136
|
| 'catalog.catalogs.apiDescription.title'
|
|
137
137
|
| 'catalog.catalogs.apiDescription.description'
|
|
138
138
|
| 'catalog.catalogs.apiDescription.switcherLabel'
|
|
139
|
+
| 'catalog.catalogs.dataSchema.title'
|
|
140
|
+
| 'catalog.catalogs.dataSchema.description'
|
|
141
|
+
| 'catalog.catalogs.dataSchema.switcherLabel'
|
|
142
|
+
| 'catalog.catalogs.apiOperation.title'
|
|
143
|
+
| 'catalog.catalogs.apiOperation.description'
|
|
144
|
+
| 'catalog.catalogs.apiOperation.switcherLabel'
|
|
139
145
|
| 'catalog.entity.metadata.title'
|
|
146
|
+
| 'catalog.entity.schema.title'
|
|
140
147
|
| 'catalog.entity.properties.apiDescription.title'
|
|
141
148
|
| 'sidebar.menu.backLabel'
|
|
142
149
|
| 'sidebar.menu.backToLabel'
|
|
@@ -172,6 +179,8 @@ export type TranslationKey =
|
|
|
172
179
|
| 'codeSnippet.report.buttonText'
|
|
173
180
|
| 'codeSnippet.report.tooltipText'
|
|
174
181
|
| 'codeSnippet.report.label'
|
|
182
|
+
| 'codeSnippet.expand.tooltipText'
|
|
183
|
+
| 'codeSnippet.collapse.tooltipText'
|
|
175
184
|
| 'userMenu.login'
|
|
176
185
|
| 'userMenu.logout'
|
|
177
186
|
| 'userMenu.devOnboardingLabel'
|
|
@@ -182,6 +191,18 @@ export type TranslationKey =
|
|
|
182
191
|
| 'navbar.products'
|
|
183
192
|
| 'page.nextButton'
|
|
184
193
|
| 'page.previousButton'
|
|
194
|
+
| 'page.actions.copyButtonText'
|
|
195
|
+
| 'page.actions.copyTitle'
|
|
196
|
+
| 'page.actions.copyDescription'
|
|
197
|
+
| 'page.actions.viewAsMdTitle'
|
|
198
|
+
| 'page.actions.viewAsMdButtonText'
|
|
199
|
+
| 'page.actions.viewAsMdDescription'
|
|
200
|
+
| 'page.actions.chatGptTitle'
|
|
201
|
+
| 'page.actions.chatGptButtonText'
|
|
202
|
+
| 'page.actions.chatGptDescription'
|
|
203
|
+
| 'page.actions.claudeTitle'
|
|
204
|
+
| 'page.actions.claudeButtonText'
|
|
205
|
+
| 'page.actions.claudeDescription'
|
|
185
206
|
| 'openapi.download.description.title'
|
|
186
207
|
| 'openapi.info.title'
|
|
187
208
|
| 'openapi.info.contact.url'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
|
|
3
|
+
type BaseAction = {
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
iconComponent: ComponentType;
|
|
7
|
+
buttonText: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type LinkPageAction = BaseAction & {
|
|
11
|
+
link: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type ClickPageAction = BaseAction & {
|
|
15
|
+
onClick: () => Promise<void> | void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type PageAction = LinkPageAction | ClickPageAction;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncApiRealm } from '@redocly/realm-asyncapi-sdk';
|
|
2
2
|
|
|
3
3
|
type ExtractEventType<T> = T extends {
|
|
4
|
-
|
|
4
|
+
type: infer EventType;
|
|
5
5
|
}
|
|
6
6
|
? EventType
|
|
7
7
|
: never;
|
|
@@ -10,25 +10,17 @@ export type EventType = ExtractEventType<AsyncApiRealm.Messages>;
|
|
|
10
10
|
|
|
11
11
|
type GetMessageForEventType<TEventType extends EventType> = Extract<
|
|
12
12
|
AsyncApiRealm.Messages,
|
|
13
|
-
{
|
|
13
|
+
{ type: TEventType }
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
16
|
type ExtractEventDataForType<TEventType extends EventType> =
|
|
17
17
|
GetMessageForEventType<TEventType> extends {
|
|
18
|
-
|
|
18
|
+
data: infer Data;
|
|
19
19
|
}
|
|
20
|
-
?
|
|
21
|
-
[K in keyof Attrs as K extends `cloudevents.event_data.${string}` ? K : never]: Attrs[K];
|
|
22
|
-
}
|
|
20
|
+
? Data
|
|
23
21
|
: never;
|
|
24
22
|
|
|
25
|
-
export type
|
|
26
|
-
[K in keyof T as K extends `cloudevents.event_data.${infer FieldName}` ? FieldName : never]: T[K];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type EventPayload<TEventType extends EventType> = ConvertEventDataToPayload<
|
|
30
|
-
ExtractEventDataForType<TEventType>
|
|
31
|
-
>;
|
|
23
|
+
export type EventPayload<TEventType extends EventType> = ExtractEventDataForType<TEventType>;
|
|
32
24
|
|
|
33
25
|
export interface SendEventParams<TEventType extends EventType> {
|
|
34
26
|
type: TEventType;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { saveAs } from 'file-saver';
|
|
2
|
-
import JSZip from 'jszip';
|
|
3
2
|
|
|
4
3
|
import type { CodeWalkthroughFile } from '@redocly/config';
|
|
5
4
|
|
|
@@ -7,14 +6,16 @@ import { removeLeadingSlash } from './urls';
|
|
|
7
6
|
import { findClosestCommonDirectory } from './find-closest-common-directory';
|
|
8
7
|
import { getCodeWalkthroughFileText } from './get-code-walkthrough-file-text';
|
|
9
8
|
|
|
10
|
-
// https://github.com/Stuk/jszip/issues/196#issuecomment-69503828
|
|
11
|
-
JSZip.support.nodebuffer = false;
|
|
12
|
-
|
|
13
9
|
export async function downloadCodeWalkthrough(
|
|
14
10
|
files: CodeWalkthroughFile[],
|
|
15
11
|
state: Record<string, { value: string | boolean }>,
|
|
16
12
|
inputsState: Record<string, { value: string }>,
|
|
17
13
|
) {
|
|
14
|
+
const JSZip = (await import('jszip')).default;
|
|
15
|
+
|
|
16
|
+
// https://github.com/Stuk/jszip/issues/196#issuecomment-69503828
|
|
17
|
+
JSZip.support.nodebuffer = false;
|
|
18
|
+
|
|
18
19
|
const zip = new JSZip();
|
|
19
20
|
|
|
20
21
|
const filePaths = files.map(({ path }) => path);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced smoothstep function for smooth interpolation with configurable threshold.
|
|
3
|
+
* Used in active heading detection to create virtual positions for better scroll behavior.
|
|
4
|
+
*/
|
|
5
|
+
export function enhancedSmoothstep(input: number, threshold: number = 0.4): number {
|
|
6
|
+
if (input <= threshold) {
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const normalizedValue = Math.min(Math.max((input - threshold) / (1 - threshold), 0), 1);
|
|
11
|
+
return (
|
|
12
|
+
3 * normalizedValue * normalizedValue - 2 * normalizedValue * normalizedValue * normalizedValue
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { CDNIcon } from '@redocly/theme/icons/CDNIcon/CDNIcon';
|
|
4
|
+
|
|
5
|
+
// extension to icon name
|
|
6
|
+
const fileIconMap: Record<string, string> = {
|
|
7
|
+
yaml: 'yaml',
|
|
8
|
+
yml: 'yaml',
|
|
9
|
+
json: 'json',
|
|
10
|
+
js: 'javascript',
|
|
11
|
+
ts: 'typescript',
|
|
12
|
+
css: 'css',
|
|
13
|
+
html: 'html',
|
|
14
|
+
jsx: 'react',
|
|
15
|
+
tsx: 'react',
|
|
16
|
+
md: 'markdown',
|
|
17
|
+
graphql: 'graphql',
|
|
18
|
+
gql: 'graphql',
|
|
19
|
+
py: 'python',
|
|
20
|
+
sh: 'console',
|
|
21
|
+
xsh: 'console',
|
|
22
|
+
nu: 'console',
|
|
23
|
+
java: 'java',
|
|
24
|
+
ps: 'powershell',
|
|
25
|
+
php: 'php_elephant',
|
|
26
|
+
go: 'go',
|
|
27
|
+
ruby: 'ruby',
|
|
28
|
+
swift: 'swift',
|
|
29
|
+
kotlin: 'kotlin',
|
|
30
|
+
rust: 'rust',
|
|
31
|
+
scala: 'scala',
|
|
32
|
+
elixir: 'elixir',
|
|
33
|
+
dart: 'dart',
|
|
34
|
+
http: 'http',
|
|
35
|
+
rest: 'http',
|
|
36
|
+
c: 'c',
|
|
37
|
+
h: 'c',
|
|
38
|
+
hpp: 'c',
|
|
39
|
+
cc: 'c',
|
|
40
|
+
cpp: 'c',
|
|
41
|
+
cxx: 'c',
|
|
42
|
+
'c++': 'c',
|
|
43
|
+
sql: 'database',
|
|
44
|
+
hbs: 'handlebars',
|
|
45
|
+
cs: 'csharp',
|
|
46
|
+
csx: 'csharp',
|
|
47
|
+
csharp: 'csharp',
|
|
48
|
+
markdoc: 'markdoc',
|
|
49
|
+
mdoc: 'markdoc',
|
|
50
|
+
mdx: 'mdx',
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// code block language to icon name, only for those when code extension is not available
|
|
54
|
+
const languageIconMap: Record<string, string> = {
|
|
55
|
+
bash: 'console',
|
|
56
|
+
python: 'python',
|
|
57
|
+
java: 'java',
|
|
58
|
+
graphql: 'graphql',
|
|
59
|
+
javascript: 'javascript',
|
|
60
|
+
typescript: 'typescript',
|
|
61
|
+
react: 'react',
|
|
62
|
+
markdown: 'markdown',
|
|
63
|
+
php: 'php_elephant',
|
|
64
|
+
ruby: 'ruby',
|
|
65
|
+
swift: 'swift',
|
|
66
|
+
kotlin: 'kotlin',
|
|
67
|
+
rust: 'rust',
|
|
68
|
+
scala: 'scala',
|
|
69
|
+
elixir: 'elixir',
|
|
70
|
+
dart: 'dart',
|
|
71
|
+
csharp: 'csharp',
|
|
72
|
+
objectivec: 'c',
|
|
73
|
+
perl: 'perl',
|
|
74
|
+
sql: 'database',
|
|
75
|
+
xml: 'xml',
|
|
76
|
+
vim: 'vim',
|
|
77
|
+
lua: 'lua',
|
|
78
|
+
zsh: 'console',
|
|
79
|
+
fish: 'console',
|
|
80
|
+
powershell: 'console',
|
|
81
|
+
handlebars: 'handlebars',
|
|
82
|
+
markdoc: 'markdoc',
|
|
83
|
+
mdx: 'mdx',
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export function getFileIconByExt(ext: string) {
|
|
87
|
+
const iconName = fileIconMap[ext] || 'document';
|
|
88
|
+
return <CDNIcon name={iconName} pack="code" mode="background" />;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function getFileIconByLanguage(language: string) {
|
|
92
|
+
const iconName = fileIconMap[language] || languageIconMap[language] || 'document';
|
|
93
|
+
return <CDNIcon name={iconName} pack="code" mode="background" />;
|
|
94
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type ResolvedIcon =
|
|
2
|
+
| { type: 'link'; value: string }
|
|
3
|
+
| { type: 'font-awesome'; name: string; style: string }
|
|
4
|
+
| { type: 'invalid'; reason: string };
|
|
5
|
+
|
|
6
|
+
const FA_ICON_STYLES = ['solid', 'regular', 'duotone', 'brands'] as string[];
|
|
7
|
+
const FA_ICON_NAME_PATTERN = /^[a-z0-9-]+$/i;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Resolves an icon value from configuration into a structured object.
|
|
11
|
+
*
|
|
12
|
+
* Supports:
|
|
13
|
+
* - URLs (absolute or relative paths to image files)
|
|
14
|
+
* - Font Awesome icons in formats:
|
|
15
|
+
* - "solid camera" (style + name)
|
|
16
|
+
* - "camera" (name only, default style: 'regular')
|
|
17
|
+
*
|
|
18
|
+
* @param icon - The icon string from config.
|
|
19
|
+
* @returns A structured object describing the icon:
|
|
20
|
+
* - type: 'url' | 'font-awesome' | 'invalid'
|
|
21
|
+
* - value: for URLs
|
|
22
|
+
* - name and style: for Font Awesome icons
|
|
23
|
+
* - reason: for invalid entries
|
|
24
|
+
*/
|
|
25
|
+
export function resolveIcon(icon?: string): ResolvedIcon {
|
|
26
|
+
if (!icon || typeof icon !== 'string') {
|
|
27
|
+
return { type: 'invalid', reason: 'Icon must be a non-empty string' };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const trimmed = icon.trim();
|
|
31
|
+
const isLink =
|
|
32
|
+
trimmed.match(/\.(svg|png|jpg|jpeg|gif|ico|webp)$/) || /^https?:\/\//.test(trimmed);
|
|
33
|
+
|
|
34
|
+
if (isLink) {
|
|
35
|
+
return { type: 'link', value: trimmed };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const [first, second] = trimmed.split(/\s+/);
|
|
39
|
+
|
|
40
|
+
if (first) {
|
|
41
|
+
if (second) {
|
|
42
|
+
// Format: "style name" (e.g., "solid camera")
|
|
43
|
+
if (FA_ICON_STYLES.includes(first) && FA_ICON_NAME_PATTERN.test(second)) {
|
|
44
|
+
return { type: 'font-awesome', style: first, name: second };
|
|
45
|
+
} else {
|
|
46
|
+
return { type: 'invalid', reason: 'Unrecognized icon format' };
|
|
47
|
+
}
|
|
48
|
+
} else if (!FA_ICON_STYLES.includes(first) && FA_ICON_NAME_PATTERN.test(first)) {
|
|
49
|
+
return {
|
|
50
|
+
type: 'font-awesome',
|
|
51
|
+
name: first,
|
|
52
|
+
style: 'regular',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { type: 'invalid', reason: 'Unrecognized icon format' };
|
|
57
|
+
}
|
package/src/core/utils/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from './color';
|
|
|
9
9
|
export * from './urls';
|
|
10
10
|
export * from './js-utils';
|
|
11
11
|
export * from './tags-parser';
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './string';
|
|
13
13
|
export * from './dom';
|
|
14
14
|
export * from './markdoc';
|
|
15
15
|
export * from './attribute-parser';
|
|
@@ -33,3 +33,6 @@ export * from './replace-inputs-with-value';
|
|
|
33
33
|
export * from './find-closest-common-directory';
|
|
34
34
|
export * from './get-user-agent';
|
|
35
35
|
export * from './parse-style-string';
|
|
36
|
+
export * from './lang-to-name';
|
|
37
|
+
export * from './enhanced-smoothstep';
|
|
38
|
+
export * from './icon-resolver';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { capitalize } from './string';
|
|
2
|
+
|
|
3
|
+
const languages = {
|
|
4
|
+
js: 'JavaScript',
|
|
5
|
+
ts: 'TypeScript',
|
|
6
|
+
jsx: 'React',
|
|
7
|
+
tsx: 'React',
|
|
8
|
+
html: 'HTML',
|
|
9
|
+
css: 'CSS',
|
|
10
|
+
sh: 'Shell',
|
|
11
|
+
java: 'Java',
|
|
12
|
+
py: 'Python',
|
|
13
|
+
graphql: 'GraphQL',
|
|
14
|
+
gql: 'GraphQL',
|
|
15
|
+
yaml: 'YAML',
|
|
16
|
+
yml: 'YAML',
|
|
17
|
+
json: 'JSON',
|
|
18
|
+
md: 'Markdown',
|
|
19
|
+
markdown: 'Markdown',
|
|
20
|
+
mermaid: 'Mermaid',
|
|
21
|
+
php: 'PHP',
|
|
22
|
+
javascript: 'JavaScript',
|
|
23
|
+
typescript: 'TypeScript',
|
|
24
|
+
react: 'React',
|
|
25
|
+
mdoc: 'Markdoc',
|
|
26
|
+
'objective-c': 'Objective-C',
|
|
27
|
+
objectivec: 'Objective-C',
|
|
28
|
+
sql: 'SQL',
|
|
29
|
+
xml: 'XML',
|
|
30
|
+
csharp: 'C#',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export function langToName(lang: string) {
|
|
34
|
+
return languages[lang as keyof typeof languages] || capitalize(lang);
|
|
35
|
+
}
|
package/src/ext/configure.ts
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { CDNIconProps } from '@redocly/theme/icons/types';
|
|
5
|
+
|
|
6
|
+
import { getCssColorVariable } from '@redocly/theme/core/utils';
|
|
7
|
+
import { ICONS_CDN_URL } from '@redocly/theme/core/constants';
|
|
8
|
+
|
|
9
|
+
const Icon = (props: CDNIconProps) => {
|
|
10
|
+
const { name, type, pack, mode, color, ...rest } = props;
|
|
11
|
+
const cdnUrl = ICONS_CDN_URL[pack || 'font-awesome'];
|
|
12
|
+
const typeSegment = pack === 'code' ? '' : type ? type + '/' : 'regular/';
|
|
13
|
+
|
|
14
|
+
const styleProps =
|
|
15
|
+
mode === 'background'
|
|
16
|
+
? {
|
|
17
|
+
backgroundImage: `url(${cdnUrl}/${typeSegment}${name}.svg)`,
|
|
18
|
+
backgroundRepeat: 'no-repeat',
|
|
19
|
+
backgroundPosition: 'center',
|
|
20
|
+
backgroundSize: 'contain',
|
|
21
|
+
}
|
|
22
|
+
: {
|
|
23
|
+
backgroundColor: color ? getCssColorVariable(color) : 'currentColor',
|
|
24
|
+
maskImage: `url(${cdnUrl}/${typeSegment}${name}.svg)`,
|
|
25
|
+
maskRepeat: 'no-repeat',
|
|
26
|
+
maskPosition: 'center',
|
|
27
|
+
maskSize: 'contain',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<svg
|
|
32
|
+
{...rest}
|
|
33
|
+
style={{
|
|
34
|
+
...styleProps,
|
|
35
|
+
display: 'inline-block',
|
|
36
|
+
verticalAlign: 'middle',
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const CDNIcon = styled(Icon).attrs(() => ({
|
|
43
|
+
'data-component-name': 'icons/CDNIcon/CDNIcon',
|
|
44
|
+
}))<CDNIconProps>`
|
|
45
|
+
height: ${({ size }) => size || 'var(--icon-height, 1em)'};
|
|
46
|
+
width: ${({ size }) => size || 'var(--icon-width, 1em)'};
|
|
47
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { IconProps } from '@redocly/theme/icons/types';
|
|
5
|
+
|
|
6
|
+
import { getCssColorVariable } from '@redocly/theme/core/utils';
|
|
7
|
+
|
|
8
|
+
const Icon = (props: IconProps) => (
|
|
9
|
+
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path d="M6.74887 6.55188V5.54033C6.74887 5.45514 6.78085 5.39123 6.85535 5.34869L8.88914 4.17742C9.16598 4.01771 9.49608 3.94322 9.83676 3.94322C11.1145 3.94322 11.9238 4.93348 11.9238 5.98758C11.9238 6.06209 11.9238 6.14729 11.9131 6.23248L9.80481 4.99731C9.67705 4.92281 9.54923 4.92281 9.42147 4.99731L6.74887 6.55188ZM11.4978 10.4916V8.0745C11.4978 7.9254 11.4339 7.81892 11.3061 7.7444L8.63354 6.18983L9.50666 5.68935C9.58118 5.64681 9.64509 5.64681 9.71961 5.68935L11.7534 6.86061C12.3391 7.20138 12.733 7.9254 12.733 8.62811C12.733 9.43732 12.2539 10.1827 11.4978 10.4915V10.4916ZM6.12066 8.36206L5.24754 7.85099C5.17304 7.80845 5.14106 7.74451 5.14106 7.65932V5.31682C5.14106 4.17753 6.01418 3.315 7.19612 3.315C7.64339 3.315 8.05856 3.4641 8.41003 3.73029L6.31241 4.94418C6.18468 5.01868 6.12077 5.12515 6.12077 5.27428V8.36214L6.12066 8.36206ZM8.00002 9.4481L6.74887 8.74537V7.25473L8.00002 6.55199L9.25109 7.25473V8.74537L8.00002 9.4481ZM8.80393 12.6851C8.35668 12.6851 7.9415 12.536 7.59004 12.2698L9.68764 11.0559C9.81539 10.9814 9.8793 10.8749 9.8793 10.7258V7.63795L10.7631 8.14902C10.8376 8.19156 10.8696 8.25547 10.8696 8.34069V10.6832C10.8696 11.8225 9.98578 12.685 8.80393 12.685V12.6851ZM6.28037 10.3106L4.24657 9.1394C3.66089 8.7986 3.26698 8.07461 3.26698 7.37188C3.26698 6.55199 3.75678 5.8173 4.51273 5.50849V7.93618C4.51273 8.08528 4.57667 8.19176 4.7044 8.26628L7.36642 9.81016L6.49329 10.3106C6.4188 10.3532 6.35486 10.3532 6.28037 10.3106ZM6.16331 12.0569C4.96009 12.0569 4.0763 11.1518 4.0763 10.0338C4.0763 9.94859 4.08697 9.86339 4.09756 9.7782L6.19518 10.9921C6.32291 11.0666 6.45075 11.0666 6.57849 10.9921L9.25109 9.44821V10.4598C9.25109 10.545 9.21913 10.6089 9.14461 10.6514L7.11084 11.8227C6.83398 11.9824 6.50388 12.0569 6.1632 12.0569H6.16331ZM8.80393 13.3239C10.0923 13.3239 11.1677 12.4082 11.4127 11.1943C12.6052 10.8855 13.3719 9.7675 13.3719 8.62822C13.3719 7.88283 13.0525 7.15884 12.4775 6.63707C12.5307 6.41345 12.5627 6.18983 12.5627 5.96632C12.5627 4.4437 11.3275 3.3043 9.90067 3.3043C9.61325 3.3043 9.33639 3.34684 9.05953 3.44273C8.58031 2.97421 7.92013 2.67609 7.19612 2.67609C5.90773 2.67609 4.83236 3.59175 4.58736 4.80564C3.39482 5.11446 2.62817 6.23248 2.62817 7.37176C2.62817 8.11715 2.94757 8.84115 3.52258 9.36291C3.46934 9.58653 3.43738 9.81016 3.43738 10.0337C3.43738 11.5563 4.67256 12.6957 6.09937 12.6957C6.38682 12.6957 6.66368 12.6531 6.94054 12.5573C7.41965 13.0258 8.07982 13.3239 8.80393 13.3239Z" />
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const ChatGptIcon = styled(Icon).attrs(() => ({
|
|
15
|
+
'data-component-name': 'icons/ChatGptIcon/ChatGptIcon',
|
|
16
|
+
}))<IconProps>`
|
|
17
|
+
path {
|
|
18
|
+
fill: ${({ color }) => getCssColorVariable(color)};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
height: ${({ size }) => size || '16px'};
|
|
22
|
+
width: ${({ size }) => size || '16px'};
|
|
23
|
+
`;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { IconProps } from '@redocly/theme/icons/types';
|
|
5
|
+
|
|
6
|
+
import { getCssColorVariable } from '@redocly/theme/core/utils';
|
|
7
|
+
|
|
8
|
+
const Icon = (props: IconProps) => (
|
|
9
|
+
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path d="M7 10.707L4.5 8.2065L5.2065 7.5L7 9.293L10.7925 5.5L11.5 6.2075L7 10.707Z" />
|
|
11
|
+
<path d="M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14Z" />
|
|
12
|
+
</svg>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const CheckmarkOutlineIcon = styled(Icon).attrs(() => ({
|
|
16
|
+
'data-component-name': 'icons/CheckmarkOutlineIcon/CheckmarkOutlineIcon',
|
|
17
|
+
}))<IconProps>`
|
|
18
|
+
path {
|
|
19
|
+
fill: ${({ color }) => getCssColorVariable(color)};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
height: ${({ size }) => size || '16px'};
|
|
23
|
+
width: ${({ size }) => size || '16px'};
|
|
24
|
+
`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { IconProps } from '@redocly/theme/icons/types';
|
|
5
|
+
|
|
6
|
+
import { getCssColorVariable } from '@redocly/theme/core/utils';
|
|
7
|
+
|
|
8
|
+
const Icon = (props: IconProps) => (
|
|
9
|
+
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
10
|
+
<path d="M4.03188 9.88255L6.60172 8.62367L6.64494 8.51434L6.60172 8.45352H6.47649L6.04701 8.43042L4.57865 8.39577L3.3052 8.34957L2.07142 8.29182L1.761 8.23408L1.46997 7.89915L1.49996 7.73207L1.761 7.57884L2.13492 7.60733L2.96126 7.65661L4.2012 7.7313L5.10074 7.77749L6.43328 7.89838H6.64494L6.67492 7.82369L6.60261 7.77749L6.54616 7.7313L5.26301 6.97212L3.87402 6.16983L3.14646 5.70785L2.75313 5.47379L2.5547 5.25435L2.46916 4.77544L2.82633 4.43204L3.30608 4.46052L3.42866 4.48901L3.91459 4.81548L4.95258 5.5169L6.30805 6.38849L6.50648 6.53248L6.58585 6.4832L6.59555 6.44855L6.50648 6.31843L5.76921 5.15503L4.98256 3.9716L4.63245 3.48114L4.53985 3.18702C4.50722 3.06614 4.48341 2.9645 4.48341 2.84054L4.88996 2.35855L5.11485 2.29541L5.65721 2.35855L5.88562 2.53179L6.22251 3.20473L6.7684 4.26419L7.61502 5.70477L7.86284 6.1321L7.99512 6.52786L8.04451 6.64874H8.13005V6.57944L8.19972 5.76791L8.32848 4.77159L8.45371 3.48961L8.49692 3.1285L8.70152 2.69579L9.10807 2.46172L9.42556 2.59415L9.6866 2.92061L9.65044 3.13158L9.49523 4.01241L9.19097 5.39217L8.99254 6.31612H9.10807L9.24036 6.20062L9.77567 5.58004L10.6752 4.59835L11.0721 4.20875L11.5351 3.77834L11.8323 3.57354H12.394L12.8076 4.1102L12.6224 4.66456L12.0439 5.30517L11.5642 5.84799L10.8763 6.65644L10.4468 7.3032L10.4865 7.35479L10.5888 7.34632L12.1427 7.05759L12.9822 6.92515L13.9841 6.77501L14.4374 6.9598L14.4868 7.14767L14.3086 7.53188L13.2371 7.76287L11.9804 7.9823L10.109 8.36882L10.0861 8.38345L10.1126 8.41194L10.9556 8.48123L11.3163 8.49817H12.1991L13.843 8.6052L14.2725 8.85312L14.53 9.15649L14.4868 9.38747L13.8253 9.68159L12.9329 9.4968L10.8498 9.06409L10.1355 8.90856H10.0367V8.96014L10.632 9.46832L11.7229 10.3284L13.089 11.4371L13.1586 11.7112L12.9831 11.9276L12.7979 11.9045L11.5977 11.116L11.1347 10.7611L10.0861 9.99035H10.0164V10.0712L10.2581 10.3799L11.5342 12.0546L11.6003 12.5682L11.5077 12.7352L11.177 12.8361L10.8137 12.7784L10.0667 11.8629L9.29592 10.8319L8.67418 9.90796L8.59834 9.94569L8.23147 13.3959L8.0595 13.5722L7.66264 13.7046L7.33193 13.4852L7.15644 13.1302L7.33193 12.4288L7.54359 11.5133L7.71556 10.7857L7.87077 9.88178L7.96337 9.5815L7.9572 9.56148L7.88136 9.56995L7.10088 10.5054L5.91385 11.906L4.97463 12.7837L4.74974 12.8615L4.35994 12.6852L4.3961 12.3703L4.61393 12.09L5.91385 10.6463L6.69785 9.75166L7.20406 9.23502L7.20053 9.16033H7.17055L3.71792 11.1176L3.10324 11.1869L2.83867 10.9705L2.8713 10.6155L2.99653 10.5001L4.03452 9.87639L4.031 9.87947L4.03188 9.88255Z" />
|
|
11
|
+
</svg>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
export const ClaudeIcon = styled(Icon).attrs(() => ({
|
|
15
|
+
'data-component-name': 'icons/ClaudeIcon/ClaudeIcon',
|
|
16
|
+
}))<IconProps>`
|
|
17
|
+
path {
|
|
18
|
+
fill: ${({ color }) => getCssColorVariable(color)};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
height: ${({ size }) => size || '16px'};
|
|
22
|
+
width: ${({ size }) => size || '16px'};
|
|
23
|
+
`;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { CDNIcon } from '@redocly/theme/icons/CDNIcon/CDNIcon';
|
|
5
|
+
import { resolveIcon } from '@redocly/theme/core/utils';
|
|
6
|
+
import { InlineSvg } from '@redocly/theme/markdoc/components/InlineSvg/InlineSvg';
|
|
7
|
+
import { Image } from '@redocly/theme/components/Image/Image';
|
|
8
|
+
|
|
9
|
+
export interface GenericIconProps {
|
|
10
|
+
icon: string | React.ReactNode;
|
|
11
|
+
srcSet?: string;
|
|
12
|
+
rawContent?: string;
|
|
13
|
+
size?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
alt?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function GenericIcon({
|
|
20
|
+
icon,
|
|
21
|
+
srcSet,
|
|
22
|
+
rawContent,
|
|
23
|
+
size,
|
|
24
|
+
color,
|
|
25
|
+
alt,
|
|
26
|
+
className,
|
|
27
|
+
}: GenericIconProps) {
|
|
28
|
+
if (srcSet) {
|
|
29
|
+
return <Image srcSet={srcSet} alt={alt} className={className} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const resolvedIcon = icon && typeof icon === 'string' ? resolveIcon(icon) : null;
|
|
33
|
+
const iconComponent = rawContent ? (
|
|
34
|
+
<IconSvg fileRawContent={rawContent} className={className} />
|
|
35
|
+
) : resolvedIcon?.type === 'link' ? (
|
|
36
|
+
<IconImg src={resolvedIcon.value} alt={alt} className={className} />
|
|
37
|
+
) : resolvedIcon?.type === 'font-awesome' ? (
|
|
38
|
+
<CDNIcon
|
|
39
|
+
name={resolvedIcon.name}
|
|
40
|
+
type={resolvedIcon.style}
|
|
41
|
+
size={size}
|
|
42
|
+
color={color}
|
|
43
|
+
className={className}
|
|
44
|
+
/>
|
|
45
|
+
) : (
|
|
46
|
+
icon
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return iconComponent;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const IconImg = styled.img`
|
|
53
|
+
width: var(--icon-width, 16px);
|
|
54
|
+
height: var(--icon-height, 16px);
|
|
55
|
+
display: inline-block;
|
|
56
|
+
object-fit: cover;
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
const IconSvg = styled(InlineSvg)`
|
|
60
|
+
width: var(--icon-width, 16px);
|
|
61
|
+
height: var(--icon-height, 16px);
|
|
62
|
+
display: inline-block;
|
|
63
|
+
|
|
64
|
+
svg {
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
fill: var(--icon-color, currentColor);
|
|
68
|
+
}
|
|
69
|
+
`;
|