@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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PageActionsMenuItem = PageActionsMenuItem;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const LaunchIcon_1 = require("../../icons/LaunchIcon/LaunchIcon");
|
|
10
|
+
function PageActionsMenuItem(props) {
|
|
11
|
+
const { pageAction } = props;
|
|
12
|
+
return (react_1.default.createElement(MenuItemWrapper, { "data-component-name": "PageActions/PageActionsMenuItem" },
|
|
13
|
+
react_1.default.createElement(IconWrapper, null,
|
|
14
|
+
react_1.default.createElement(pageAction.iconComponent, null)),
|
|
15
|
+
react_1.default.createElement(ContentWrapper, null,
|
|
16
|
+
react_1.default.createElement(Title, null,
|
|
17
|
+
pageAction.title,
|
|
18
|
+
'link' in pageAction ? (react_1.default.createElement(LaunchIcon_1.LaunchIcon, { color: "var(--page-actions-menu-item-title-icon-color)", size: "14px" })) : null),
|
|
19
|
+
react_1.default.createElement(Description, null, pageAction.description))));
|
|
20
|
+
}
|
|
21
|
+
const MenuItemWrapper = styled_components_1.default.div `
|
|
22
|
+
padding: var(--page-actions-menu-item-padding);
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: var(--page-actions-menu-item-gap);
|
|
27
|
+
`;
|
|
28
|
+
const IconWrapper = styled_components_1.default.div `
|
|
29
|
+
color: var(--page-actions-menu-item-icon-color);
|
|
30
|
+
border: 1px solid var(--page-actions-menu-item-icon-border-color);
|
|
31
|
+
border-radius: var(--page-actions-menu-item-icon-border-radius);
|
|
32
|
+
width: var(--page-actions-menu-item-icon-wrapper-size);
|
|
33
|
+
height: var(--page-actions-menu-item-icon-wrapper-size);
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
`;
|
|
38
|
+
const ContentWrapper = styled_components_1.default.div `
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: var(--page-actions-menu-item-text-gap);
|
|
42
|
+
`;
|
|
43
|
+
const Title = styled_components_1.default.div `
|
|
44
|
+
font-weight: var(--page-actions-menu-item-title-font-weight);
|
|
45
|
+
font-size: var(--page-actions-menu-item-title-font-size);
|
|
46
|
+
line-height: var(--page-actions-menu-item-title-line-height);
|
|
47
|
+
color: var(--page-actions-menu-item-title-color);
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: var(--page-actions-menu-item-title-icon-gap);
|
|
51
|
+
`;
|
|
52
|
+
const Description = styled_components_1.default.div `
|
|
53
|
+
font-weight: var(--page-actions-menu-item-description-font-weight);
|
|
54
|
+
font-size: var(--page-actions-menu-item-description-font-size);
|
|
55
|
+
line-height: var(--page-actions-menu-item-description-line-height);
|
|
56
|
+
color: var(--page-actions-menu-item-description-color);
|
|
57
|
+
`;
|
|
58
|
+
//# sourceMappingURL=PageActionsMenuItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pageActions: import("styled-components").FlattenSimpleInterpolation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pageActionsDarkMode: import("styled-components").FlattenSimpleInterpolation;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pageActionsDarkMode = void 0;
|
|
4
|
+
const styled_components_1 = require("styled-components");
|
|
5
|
+
exports.pageActionsDarkMode = (0, styled_components_1.css) `
|
|
6
|
+
--page-actions-menu-item-icon-border-color: var(--color-warm-grey-5);
|
|
7
|
+
--page-actions-menu-item-description-color: var(--text-color-secondary);
|
|
8
|
+
`;
|
|
9
|
+
//# sourceMappingURL=variables.dark.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pageActions = void 0;
|
|
4
|
+
const styled_components_1 = require("styled-components");
|
|
5
|
+
exports.pageActions = (0, styled_components_1.css) `
|
|
6
|
+
/* Minimum spacing between page actions and heading text */
|
|
7
|
+
--page-actions-padding-left: var(--spacing-sm);
|
|
8
|
+
|
|
9
|
+
--page-actions-button-text-color: var(--text-color-secondary);
|
|
10
|
+
--page-actions-button-padding: 5px 14px 5px var(--spacing-sm);
|
|
11
|
+
|
|
12
|
+
--page-actions-menu-item-padding: 3px 0;
|
|
13
|
+
--page-actions-menu-item-gap: var(--spacing-xs);
|
|
14
|
+
--page-actions-menu-item-icon-color: var(--icon-color-secondary);
|
|
15
|
+
--page-actions-menu-item-icon-border-color: var(--color-warm-grey-3);
|
|
16
|
+
--page-actions-menu-item-icon-border-radius: var(--border-radius);
|
|
17
|
+
--page-actions-menu-item-icon-wrapper-size: 28px;
|
|
18
|
+
|
|
19
|
+
--page-actions-menu-item-text-gap: 2px;
|
|
20
|
+
|
|
21
|
+
--page-actions-menu-item-title-font-weight: var(--font-weight-regular);
|
|
22
|
+
--page-actions-menu-item-title-font-size: var(--font-size-base);
|
|
23
|
+
--page-actions-menu-item-title-line-height: var(--line-height-base);
|
|
24
|
+
--page-actions-menu-item-title-color: var(--text-color-secondary);
|
|
25
|
+
|
|
26
|
+
--page-actions-menu-item-title-icon-gap: var(--spacing-xxs);
|
|
27
|
+
--page-actions-menu-item-title-icon-color: var(--icon-color-secondary);
|
|
28
|
+
|
|
29
|
+
--page-actions-menu-item-description-font-weight: var(--font-weight-regular);
|
|
30
|
+
--page-actions-menu-item-description-font-size: var(--font-size-sm);
|
|
31
|
+
--page-actions-menu-item-description-line-height: var(--line-height-sm);
|
|
32
|
+
--page-actions-menu-item-description-color: var(--text-color-description);
|
|
33
|
+
|
|
34
|
+
--page-actions-processing-icon-color: var(--icon-color-interactive);
|
|
35
|
+
--page-actions-done-icon-color: var(--color-success-base);
|
|
36
|
+
`;
|
|
37
|
+
//# sourceMappingURL=variables.js.map
|
|
@@ -115,9 +115,9 @@ function SearchDialog({ onClose, className }) {
|
|
|
115
115
|
payload: {
|
|
116
116
|
query,
|
|
117
117
|
url: item.document.url,
|
|
118
|
-
|
|
118
|
+
totalResults: results.length.toString(),
|
|
119
119
|
index: index.toString(),
|
|
120
|
-
|
|
120
|
+
searchEngine: mode,
|
|
121
121
|
},
|
|
122
122
|
});
|
|
123
123
|
onClose();
|
|
@@ -12,7 +12,7 @@ exports.select = (0, styled_components_1.css) `
|
|
|
12
12
|
--select-text-color: var(--text-color-secondary); // @presenter Color
|
|
13
13
|
--select-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
14
14
|
--select-border: var(--border-width) var(--border-style) var(--border-color-primary); // @presenter Border
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
--select-input-padding-vertical: 6px; // @presenter Spacing
|
|
17
17
|
--select-input-padding-horizontal: 6px; // @presenter Spacing
|
|
18
18
|
--select-input-padding: var(--select-input-padding-vertical) var(--select-input-padding-horizontal);
|
|
@@ -40,7 +40,7 @@ exports.select = (0, styled_components_1.css) `
|
|
|
40
40
|
--select-list-item-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
41
41
|
--select-list-item-bg-color-active: transparent; // @presenter Color
|
|
42
42
|
--select-list-item-bg-color-hover: var(--menu-item-bg-color-hover); // @presenter Color
|
|
43
|
-
--select-list-item-font-weight-active: var(--font-weight-medium); // @presenter Color
|
|
43
|
+
--select-list-item-font-weight-active: var(--font-weight-medium); // @presenter Color
|
|
44
44
|
|
|
45
45
|
--select-placeholder-color: var(--color-warm-grey-6); // @presenter Color
|
|
46
46
|
// @tokens End
|
|
@@ -41,21 +41,24 @@ function TableOfContent(props) {
|
|
|
41
41
|
const { markdown: { toc = {} } = {} } = (0, hooks_1.useThemeConfig)();
|
|
42
42
|
const displayedHeadings = (0, utils_1.getDisplayedHeadings)(headings, toc.depth || 3);
|
|
43
43
|
const leastDepth = (0, utils_1.getLeastDepth)(displayedHeadings);
|
|
44
|
-
const
|
|
44
|
+
const { heading: activeHeading, handleHeadingClick } = (0, hooks_1.useActiveHeading)(contentWrapper, displayedHeadings);
|
|
45
45
|
if (toc === null || toc === void 0 ? void 0 : toc.hide) {
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
|
-
return (React.createElement(
|
|
49
|
-
React.createElement(
|
|
50
|
-
React.createElement(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
return (React.createElement(TableOfContentMenu, { "data-component-name": "TableOfContent/TableOfContent", className: className },
|
|
49
|
+
React.createElement(TableOfContentItems, { ref: sidebar },
|
|
50
|
+
displayedHeadings.length ? (React.createElement(TableOfContentHeader, { "data-translation-key": "toc.header" }, translate('toc.header', toc.header || 'On this page'))) : null,
|
|
51
|
+
displayedHeadings.map((heading, idx) => {
|
|
52
|
+
if (!heading) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const href = '#' + heading.id;
|
|
56
|
+
return (React.createElement(TableOfContentMenuItem, { key: href + idx, href: href, depth: heading.depth - leastDepth + 1 || 0, className: activeHeading === heading.id ? 'active' : '', dangerouslySetInnerHTML: { __html: heading.value || '' }, "data-testid": `toc-${heading.value}`, onClick: (e) => {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
telemetry.send({ type: 'toc_item.clicked' });
|
|
59
|
+
handleHeadingClick(heading.id);
|
|
60
|
+
} }));
|
|
61
|
+
}))));
|
|
59
62
|
}
|
|
60
63
|
const TableOfContentMenu = styled_components_1.default.aside `
|
|
61
64
|
background-color: var(--toc-bg-color);
|
|
@@ -26,7 +26,8 @@ export type TagProps = {
|
|
|
26
26
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
27
27
|
onClose?: (event: React.MouseEvent) => void;
|
|
28
28
|
maxLength?: number;
|
|
29
|
+
textTransform?: 'uppercase' | 'lowercase' | 'capitalize' | 'none';
|
|
29
30
|
};
|
|
30
|
-
export declare function Tag({ children, color, icon, active, closable, tabIndex, onClick, onKeyDown, onClose, size, borderless, withStatusDot, statusDotColor, maxLength, ...otherProps }: TagProps): JSX.Element;
|
|
31
|
+
export declare function Tag({ children, color, icon, active, closable, tabIndex, onClick, onKeyDown, onClose, size, borderless, withStatusDot, statusDotColor, maxLength, textTransform, ...otherProps }: TagProps): JSX.Element;
|
|
31
32
|
export declare const ContentWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
32
33
|
export {};
|
|
@@ -21,7 +21,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
21
21
|
const CloseIcon_1 = require("../../icons/CloseIcon/CloseIcon");
|
|
22
22
|
const CheckmarkFilledIcon_1 = require("../../icons/CheckmarkFilledIcon/CheckmarkFilledIcon");
|
|
23
23
|
function Tag(_a) {
|
|
24
|
-
var { children, color, icon, active, closable, tabIndex, onClick, onKeyDown, onClose, size, borderless, withStatusDot, statusDotColor = 'var(--tag-status-dot-color-default)', maxLength } = _a, otherProps = __rest(_a, ["children", "color", "icon", "active", "closable", "tabIndex", "onClick", "onKeyDown", "onClose", "size", "borderless", "withStatusDot", "statusDotColor", "maxLength"]);
|
|
24
|
+
var { children, color, icon, active, closable, tabIndex, onClick, onKeyDown, onClose, size, borderless, withStatusDot, statusDotColor = 'var(--tag-status-dot-color-default)', maxLength, textTransform } = _a, otherProps = __rest(_a, ["children", "color", "icon", "active", "closable", "tabIndex", "onClick", "onKeyDown", "onClose", "size", "borderless", "withStatusDot", "statusDotColor", "maxLength", "textTransform"]);
|
|
25
25
|
const truncateText = (text, maxLen) => {
|
|
26
26
|
if (text.length <= maxLen)
|
|
27
27
|
return text;
|
|
@@ -74,7 +74,7 @@ function Tag(_a) {
|
|
|
74
74
|
}
|
|
75
75
|
return children;
|
|
76
76
|
};
|
|
77
|
-
return (react_1.default.createElement(TagWrapper, Object.assign({ tabIndex: tabIndex, "data-component-name": "Tag/Tag", borderless: borderless, color: color, size: size, onClick: onClick, onKeyDown: onKeyDown, hasCloseButton: closable }, otherProps),
|
|
77
|
+
return (react_1.default.createElement(TagWrapper, Object.assign({ tabIndex: tabIndex, "data-component-name": "Tag/Tag", borderless: borderless, color: color, size: size, onClick: onClick, onKeyDown: onKeyDown, hasCloseButton: closable, textTransform: textTransform }, otherProps),
|
|
78
78
|
withStatusDot ? react_1.default.createElement(StatusDot, { color: statusDotColor }) : icon ? icon : null,
|
|
79
79
|
react_1.default.createElement(exports.ContentWrapper, null, renderChildren()),
|
|
80
80
|
closable && (react_1.default.createElement(CloseButton, { onClick: (event) => {
|
|
@@ -128,7 +128,7 @@ const TagWrapper = styled_components_1.default.div.attrs(({ className, color, si
|
|
|
128
128
|
font-weight: var(--tag-font-weight);
|
|
129
129
|
line-height: var(--tag-line-height);
|
|
130
130
|
box-shadow: var(--tag-box-shadow);
|
|
131
|
-
text-transform: var(--tag-text-transform)
|
|
131
|
+
${({ textTransform }) => `text-transform: ${textTransform ? `${textTransform}` : 'var(--tag-text-transform)'};`}
|
|
132
132
|
|
|
133
133
|
color: var(--tag-color);
|
|
134
134
|
background-color: var(--tag-bg-color);
|
|
@@ -183,6 +183,20 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
183
183
|
--tag-close-button-bg-color-hover: var(--color-sky-2); // @presenter Color
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
.tag-raspberry {
|
|
187
|
+
--tag-color: var(--color-raspberry-7); // @presenter Color
|
|
188
|
+
--tag-bg-color: transparent; // @presenter Color
|
|
189
|
+
--tag-border-color: var(--color-raspberry-3); // @presenter Color
|
|
190
|
+
--tag-close-button-bg-color-hover: var(--color-raspberry-1); // @presenter Color
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.tag-carrot {
|
|
194
|
+
--tag-color: var(--color-carrot-8); // @presenter Color
|
|
195
|
+
--tag-bg-color: transparent; // @presenter Color
|
|
196
|
+
--tag-border-color: var(--color-carrot-6); // @presenter Color
|
|
197
|
+
--tag-close-button-bg-color-hover: var(--color-carrot-3); // @presenter Color
|
|
198
|
+
}
|
|
199
|
+
|
|
186
200
|
/**
|
|
187
201
|
* @tokens Tag http
|
|
188
202
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EntityRelationType } from '
|
|
1
|
+
import type { EntityRelationType } from '../types/catalog';
|
|
2
2
|
export declare const CATALOG_TAG_MAX_LENGTH = 15;
|
|
3
3
|
export declare const ENTITY_RELATION_TYPES: readonly ["partOf", "hasParts", "creates", "createdBy", "owns", "ownedBy", "implements", "implementedBy", "dependsOn", "dependencyOf", "uses", "usedBy", "produces", "consumes", "linksTo", "supersedes", "supersededBy", "compatibleWith", "extends", "extendedBy", "relatesTo", "hasMember", "memberOf", "triggers", "triggeredBy"];
|
|
4
4
|
export declare const reverseRelationMap: Record<EntityRelationType, EntityRelationType>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export { REDOCLY_TEAMS_RBAC } from '@redocly/config';
|
|
2
2
|
export declare const DEFAULT_LOCALE_PLACEHOLDER = "default_locale";
|
|
3
3
|
export declare const CONTENT_ID = "content";
|
|
4
|
+
export declare const ICONS_CDN_URL: {
|
|
5
|
+
'font-awesome': string;
|
|
6
|
+
code: string;
|
|
7
|
+
};
|
|
4
8
|
export declare enum FEEDBACK_TYPES {
|
|
5
9
|
RATING = "rating",
|
|
6
10
|
SENTIMENT = "sentiment",
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MobileMenuType = exports.MenuItemType = exports.DEFAULT_FEEDBACK_TYPE = exports.FEEDBACK_TYPES = exports.CONTENT_ID = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.REDOCLY_TEAMS_RBAC = void 0;
|
|
3
|
+
exports.MobileMenuType = exports.MenuItemType = exports.DEFAULT_FEEDBACK_TYPE = exports.FEEDBACK_TYPES = exports.ICONS_CDN_URL = exports.CONTENT_ID = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.REDOCLY_TEAMS_RBAC = void 0;
|
|
4
4
|
var config_1 = require("@redocly/config");
|
|
5
5
|
Object.defineProperty(exports, "REDOCLY_TEAMS_RBAC", { enumerable: true, get: function () { return config_1.REDOCLY_TEAMS_RBAC; } });
|
|
6
6
|
exports.DEFAULT_LOCALE_PLACEHOLDER = 'default_locale';
|
|
7
7
|
exports.CONTENT_ID = 'content';
|
|
8
|
+
exports.ICONS_CDN_URL = {
|
|
9
|
+
'font-awesome': 'https://cdn.redocly.com/icons/fa/7.0.0',
|
|
10
|
+
code: 'https://cdn.redocly.com/icons/code/5.24.0',
|
|
11
|
+
};
|
|
8
12
|
var FEEDBACK_TYPES;
|
|
9
13
|
(function (FEEDBACK_TYPES) {
|
|
10
14
|
FEEDBACK_TYPES["RATING"] = "rating";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type CodeSnippetContextType = {
|
|
2
|
+
activeSnippetName: string;
|
|
3
|
+
setActiveSnippetName: (name: string) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const CODE_GROUP_SNIPPET_NAME_KEY = "redocly:codeGroupSnippetName";
|
|
6
|
+
export declare const CodeSnippetContext: import("react").Context<CodeSnippetContextType | null>;
|
|
7
|
+
export declare function useActiveCodeSnippetName(mode: 'tabs' | 'dropdown'): [string, (name: string) => void];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeSnippetContext = exports.CODE_GROUP_SNIPPET_NAME_KEY = void 0;
|
|
4
|
+
exports.useActiveCodeSnippetName = useActiveCodeSnippetName;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.CODE_GROUP_SNIPPET_NAME_KEY = 'redocly:codeGroupSnippetName';
|
|
7
|
+
exports.CodeSnippetContext = (0, react_1.createContext)(null);
|
|
8
|
+
function useActiveCodeSnippetName(mode) {
|
|
9
|
+
const context = (0, react_1.useContext)(exports.CodeSnippetContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('useCodeSnippetContext must be used within a CodeSnippetContext');
|
|
12
|
+
}
|
|
13
|
+
const [activeSnippetName, setActiveSnippetName] = (0, react_1.useState)(mode === 'tabs' ? '' : context.activeSnippetName);
|
|
14
|
+
if (mode === 'tabs') {
|
|
15
|
+
// use non-synced state for tabs mode
|
|
16
|
+
return [activeSnippetName, setActiveSnippetName];
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// use global synced state for dropdown mode
|
|
20
|
+
return [context.activeSnippetName, context.setActiveSnippetName];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=CodeSnippetContext.js.map
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ThemeDataContext"), exports);
|
|
18
18
|
__exportStar(require("./CodeWalkthrough/CodeWalkthroughControlsContext"), exports);
|
|
19
19
|
__exportStar(require("./CodeWalkthrough/CodeWalkthroughStepsContext"), exports);
|
|
20
|
+
__exportStar(require("./CodeSnippetContext"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { CodeWalkthroughFile } from '@redocly/config';
|
|
2
|
-
import type { IconProps } from '../../../icons/types';
|
|
3
2
|
export type RenderableFile = CodeWalkthroughFile & {
|
|
4
|
-
|
|
3
|
+
fileIcon: React.JSX.Element;
|
|
5
4
|
parentFolder: string;
|
|
6
5
|
isNameDuplicate: boolean;
|
|
7
6
|
inRootDir: boolean;
|
|
@@ -10,11 +10,11 @@ function useRenderableFiles(files) {
|
|
|
10
10
|
const filePaths = files.map(({ path }) => path);
|
|
11
11
|
const rootDir = (0, find_closest_common_directory_1.findClosestCommonDirectory)(filePaths);
|
|
12
12
|
const renderableFiles = files.map((file) => {
|
|
13
|
-
const
|
|
13
|
+
const fileIcon = getFileTypeIcon(file.basename);
|
|
14
14
|
const parentFolder = file.path.split('/').slice(-2, -1)[0];
|
|
15
15
|
const isNameDuplicate = files.some((_file) => file.basename === _file.basename && file.path !== _file.path);
|
|
16
16
|
const inRootDir = file.path === `${(0, urls_1.removeLeadingSlash)(rootDir)}/${file.basename}`;
|
|
17
|
-
return Object.assign(Object.assign({}, file), {
|
|
17
|
+
return Object.assign(Object.assign({}, file), { fileIcon,
|
|
18
18
|
inRootDir,
|
|
19
19
|
parentFolder,
|
|
20
20
|
isNameDuplicate });
|
package/lib/core/hooks/index.js
CHANGED
|
@@ -56,4 +56,5 @@ __exportStar(require("./catalog/useCatalogEntities"), exports);
|
|
|
56
56
|
__exportStar(require("./use-active-page-version"), exports);
|
|
57
57
|
__exportStar(require("./use-page-versions"), exports);
|
|
58
58
|
__exportStar(require("./use-user-teams"), exports);
|
|
59
|
+
__exportStar(require("./use-page-actions"), exports);
|
|
59
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export declare function useActiveHeading(contentElement: HTMLDivElement | null, displayedHeadings?: Array<{
|
|
2
|
+
id: string;
|
|
3
|
+
depth: number;
|
|
4
|
+
} | null>): {
|
|
5
|
+
heading: string | undefined;
|
|
6
|
+
handleHeadingClick: (headingId: string) => void;
|
|
7
|
+
};
|
|
@@ -3,11 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useActiveHeading = useActiveHeading;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_router_dom_1 = require("react-router-dom");
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
function useActiveHeading(contentElement, displayedHeadings) {
|
|
8
|
+
const [heading, setHeading] = (0, react_1.useState)(undefined);
|
|
8
9
|
const [headingElements, setHeadingElements] = (0, react_1.useState)([]);
|
|
9
10
|
const headingElementsRef = (0, react_1.useRef)({});
|
|
11
|
+
const displayedHeadingsRef = (0, react_1.useRef)(displayedHeadings);
|
|
12
|
+
const lockObserver = (0, react_1.useRef)(false);
|
|
10
13
|
const location = (0, react_router_dom_1.useLocation)();
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
setHeading(undefined);
|
|
16
|
+
headingElementsRef.current = {};
|
|
17
|
+
}, [location.pathname]);
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
19
|
+
displayedHeadingsRef.current = displayedHeadings;
|
|
20
|
+
}, [displayedHeadings]);
|
|
11
21
|
const getVisibleHeadings = () => {
|
|
12
22
|
const visibleHeadings = [];
|
|
13
23
|
for (const key in headingElementsRef.current) {
|
|
@@ -18,28 +28,98 @@ function useActiveHeading(contentElement, displayedHeaders) {
|
|
|
18
28
|
}
|
|
19
29
|
return visibleHeadings;
|
|
20
30
|
};
|
|
31
|
+
const isTopOfPage = () => window.scrollY <= 50;
|
|
32
|
+
// Returns viewport ratio for intersection observer based on screen height
|
|
33
|
+
const getViewportRatio = () => {
|
|
34
|
+
const vh = window.innerHeight;
|
|
35
|
+
if (vh >= 1400)
|
|
36
|
+
return 0.4;
|
|
37
|
+
if (vh >= 1000)
|
|
38
|
+
return 0.3;
|
|
39
|
+
return 0.25;
|
|
40
|
+
};
|
|
21
41
|
const getIndexFromId = (0, react_1.useCallback)((id) => {
|
|
22
42
|
return headingElements.findIndex((item) => item.id === id);
|
|
23
43
|
}, [headingElements]);
|
|
24
44
|
const findHeaders = (allContent) => {
|
|
25
45
|
const allHeaders = allContent.querySelectorAll('.heading-anchor');
|
|
26
|
-
|
|
46
|
+
const headers = Array.from(allHeaders);
|
|
47
|
+
if (displayedHeadingsRef.current && displayedHeadingsRef.current.length > 0) {
|
|
48
|
+
const displayedIds = displayedHeadingsRef.current.map((h) => h === null || h === void 0 ? void 0 : h.id).filter(Boolean);
|
|
49
|
+
return headers.filter((header) => displayedIds.includes(header.id));
|
|
50
|
+
}
|
|
51
|
+
return headers;
|
|
27
52
|
};
|
|
28
|
-
const
|
|
53
|
+
const calculateVirtualPositions = (0, react_1.useCallback)((headers) => {
|
|
54
|
+
var _a;
|
|
55
|
+
if (!headers.length)
|
|
56
|
+
return {};
|
|
57
|
+
const navbarHeight = ((_a = document.querySelector('nav')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height) || 0;
|
|
58
|
+
const viewportHeight = window.innerHeight;
|
|
59
|
+
const triggerOffset = navbarHeight + viewportHeight * 0.25;
|
|
60
|
+
const lastHeader = headers[headers.length - 1];
|
|
61
|
+
const lastHeaderTop = lastHeader.offsetTop;
|
|
62
|
+
const maxScrollableHeight = document.body.scrollHeight - viewportHeight;
|
|
63
|
+
const requiredUplift = Math.max(0, lastHeaderTop - maxScrollableHeight + triggerOffset);
|
|
64
|
+
const virtualPositions = {};
|
|
65
|
+
for (let i = 0; i < headers.length; i++) {
|
|
66
|
+
const header = headers[i];
|
|
67
|
+
const headerTop = header.offsetTop;
|
|
68
|
+
const normalizedPosition = headers.length === 1 ? 0 : i / (headers.length - 1);
|
|
69
|
+
const adjustmentFactor = (0, utils_1.enhancedSmoothstep)(normalizedPosition, 0.4);
|
|
70
|
+
const uplift = requiredUplift * adjustmentFactor;
|
|
71
|
+
const virtualTop = headerTop - uplift;
|
|
72
|
+
virtualPositions[header.id] = virtualTop;
|
|
73
|
+
}
|
|
74
|
+
return virtualPositions;
|
|
75
|
+
}, []);
|
|
76
|
+
const getTriggerOffset = (0, react_1.useCallback)(() => {
|
|
29
77
|
var _a;
|
|
30
|
-
|
|
31
|
-
|
|
78
|
+
const navbarHeight = ((_a = document.querySelector('nav')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height) || 0;
|
|
79
|
+
return navbarHeight + window.innerHeight * getViewportRatio();
|
|
80
|
+
}, []);
|
|
81
|
+
const findActiveHeaderByVirtualPosition = (0, react_1.useCallback)((headers, scrollY, triggerOffset) => {
|
|
82
|
+
const virtualPositions = calculateVirtualPositions(headers);
|
|
83
|
+
let activeHeader = headers[0];
|
|
84
|
+
for (const header of headers) {
|
|
85
|
+
const virtualTop = virtualPositions[header.id] || header.offsetTop;
|
|
86
|
+
if (virtualTop <= scrollY + triggerOffset) {
|
|
87
|
+
activeHeader = header;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return activeHeader;
|
|
94
|
+
}, [calculateVirtualPositions]);
|
|
95
|
+
const intersectionCallback = (0, react_1.useCallback)((entries) => {
|
|
96
|
+
var _a, _b, _c;
|
|
97
|
+
if (lockObserver.current) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
headingElementsRef.current = entries.reduce((map, entry) => {
|
|
101
|
+
map[entry.target.id] = entry;
|
|
32
102
|
return map;
|
|
33
103
|
}, headingElementsRef.current);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (totalHeight >= document.body.scrollHeight) {
|
|
37
|
-
const newHeading = ((_a = headingElements[(headingElements === null || headingElements === void 0 ? void 0 : headingElements.length) - 1]) === null || _a === void 0 ? void 0 : _a.id) || undefined;
|
|
104
|
+
if (isTopOfPage()) {
|
|
105
|
+
const newHeading = ((_a = headingElements[0]) === null || _a === void 0 ? void 0 : _a.id) || undefined;
|
|
38
106
|
setHeading(newHeading);
|
|
39
107
|
return;
|
|
40
108
|
}
|
|
41
109
|
const visibleHeadings = getVisibleHeadings();
|
|
42
110
|
if (!visibleHeadings.length) {
|
|
111
|
+
const triggerOffset = getTriggerOffset();
|
|
112
|
+
if (isTopOfPage()) {
|
|
113
|
+
setHeading(((_b = headingElements[0]) === null || _b === void 0 ? void 0 : _b.id) || undefined);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const totalHeight = window.scrollY + window.innerHeight;
|
|
117
|
+
if (totalHeight >= document.body.scrollHeight - 10) {
|
|
118
|
+
setHeading(((_c = headingElements[headingElements.length - 1]) === null || _c === void 0 ? void 0 : _c.id) || undefined);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const activeHeader = findActiveHeaderByVirtualPosition(headingElements, window.scrollY, triggerOffset);
|
|
122
|
+
setHeading(activeHeader.id);
|
|
43
123
|
return;
|
|
44
124
|
}
|
|
45
125
|
if (visibleHeadings.length === 1) {
|
|
@@ -49,31 +129,88 @@ function useActiveHeading(contentElement, displayedHeaders) {
|
|
|
49
129
|
visibleHeadings.sort((a, b) => {
|
|
50
130
|
return getIndexFromId(a.target.id) - getIndexFromId(b.target.id);
|
|
51
131
|
});
|
|
132
|
+
const firstVisibleHeading = visibleHeadings[0];
|
|
133
|
+
if (getIndexFromId(firstVisibleHeading.target.id) === 0 && isTopOfPage()) {
|
|
134
|
+
setHeading(firstVisibleHeading.target.id);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const totalHeight = scrollY + window.innerHeight;
|
|
138
|
+
if (totalHeight >= document.body.scrollHeight - 10) {
|
|
139
|
+
setHeading(visibleHeadings[visibleHeadings.length - 1].target.id);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
52
142
|
setHeading(visibleHeadings[0].target.id);
|
|
53
|
-
}, [getIndexFromId, headingElements]);
|
|
143
|
+
}, [getIndexFromId, headingElements, getTriggerOffset, findActiveHeaderByVirtualPosition]);
|
|
144
|
+
const handleHeadingClick = (0, react_1.useCallback)((headingId) => {
|
|
145
|
+
lockObserver.current = true;
|
|
146
|
+
setHeading(headingId);
|
|
147
|
+
const headingElement = headingElements.find((el) => el.id === headingId);
|
|
148
|
+
if (headingElement && headingElement.scrollIntoView) {
|
|
149
|
+
headingElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
150
|
+
}
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
headingElementsRef.current = {};
|
|
153
|
+
lockObserver.current = false;
|
|
154
|
+
}, 300);
|
|
155
|
+
}, [headingElements]);
|
|
54
156
|
(0, react_1.useEffect)(() => {
|
|
157
|
+
var _a;
|
|
55
158
|
if (!contentElement) {
|
|
56
159
|
return;
|
|
57
160
|
}
|
|
58
|
-
|
|
59
|
-
|
|
161
|
+
const headers = findHeaders(contentElement);
|
|
162
|
+
setHeadingElements(headers);
|
|
163
|
+
if (headers.length > 0 && !heading) {
|
|
164
|
+
if (isTopOfPage()) {
|
|
165
|
+
setHeading(headers[0].id);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const totalHeight = scrollY + window.innerHeight;
|
|
169
|
+
if (totalHeight >= document.body.scrollHeight - 10) {
|
|
170
|
+
setHeading(((_a = headers[headers.length - 1]) === null || _a === void 0 ? void 0 : _a.id) || undefined);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
const triggerOffset = getTriggerOffset();
|
|
174
|
+
const activeHeader = findActiveHeaderByVirtualPosition(headers, scrollY, triggerOffset);
|
|
175
|
+
setHeading(activeHeader.id);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}, [
|
|
180
|
+
contentElement,
|
|
181
|
+
location,
|
|
182
|
+
heading,
|
|
183
|
+
calculateVirtualPositions,
|
|
184
|
+
getTriggerOffset,
|
|
185
|
+
findActiveHeaderByVirtualPosition,
|
|
186
|
+
]);
|
|
60
187
|
(0, react_1.useEffect)(() => {
|
|
61
188
|
if (!(headingElements === null || headingElements === void 0 ? void 0 : headingElements.length)) {
|
|
62
189
|
return;
|
|
63
190
|
}
|
|
64
191
|
headingElementsRef.current = {};
|
|
65
|
-
|
|
192
|
+
const triggerOffset = getTriggerOffset();
|
|
66
193
|
const observer = new IntersectionObserver(intersectionCallback, {
|
|
67
|
-
rootMargin:
|
|
68
|
-
threshold: 1,
|
|
194
|
+
rootMargin: `-${triggerOffset}px 0px -${window.innerHeight * getViewportRatio()}px 0px`,
|
|
195
|
+
threshold: [0, 0.1, 0.3, 0.5, 0.7, 1],
|
|
69
196
|
});
|
|
70
|
-
headingElements
|
|
71
|
-
|
|
72
|
-
observer.observe(element);
|
|
73
|
-
}
|
|
197
|
+
headingElements.forEach((element) => {
|
|
198
|
+
observer.observe(element);
|
|
74
199
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
200
|
+
const handleScroll = () => {
|
|
201
|
+
var _a;
|
|
202
|
+
if (lockObserver.current)
|
|
203
|
+
return;
|
|
204
|
+
if (isTopOfPage()) {
|
|
205
|
+
setHeading(((_a = headingElements[0]) === null || _a === void 0 ? void 0 : _a.id) || undefined);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
window.addEventListener('scroll', handleScroll, { passive: true });
|
|
209
|
+
return () => {
|
|
210
|
+
observer.disconnect();
|
|
211
|
+
window.removeEventListener('scroll', handleScroll);
|
|
212
|
+
};
|
|
213
|
+
}, [headingElements, intersectionCallback, getTriggerOffset]);
|
|
214
|
+
return { heading, handleHeadingClick };
|
|
78
215
|
}
|
|
79
216
|
//# sourceMappingURL=use-active-heading.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Location } from 'react-router-dom';
|
|
2
2
|
export type UseActiveSectionIdReturnType = string;
|
|
3
|
-
export declare function useActiveSectionId(location: Location, hasOverviewPage?: boolean, withNavbar?: boolean): UseActiveSectionIdReturnType;
|
|
3
|
+
export declare function useActiveSectionId(location: Location, hasOverviewPage?: boolean, withNavbar?: boolean, sectionOffset?: number): UseActiveSectionIdReturnType;
|