@redocly/theme 0.57.0-next.3 → 0.57.0-next.4
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 +4 -7
- package/lib/components/Buttons/EditPageButton.js +1 -1
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +1 -35
- package/lib/components/CatalogClassic/CatalogClassicActions.js +1 -1
- package/lib/components/CatalogClassic/CatalogClassicCard.js +1 -1
- package/lib/components/CatalogClassic/CatalogClassicInfoBlock.js +1 -1
- package/lib/components/CodeBlock/CodeBlockControls.js +1 -4
- package/lib/components/Feedback/Feedback.js +1 -1
- package/lib/components/Feedback/ReportDialog.js +1 -1
- package/lib/components/Filter/FilterCheckboxes.js +1 -1
- package/lib/components/Footer/FooterItem.js +1 -1
- package/lib/components/LanguagePicker/LanguagePicker.js +1 -4
- package/lib/components/Logo/Logo.js +1 -1
- package/lib/components/Menu/MenuItem.js +3 -6
- package/lib/components/Navbar/Navbar.js +2 -2
- package/lib/components/Navbar/NavbarItem.js +1 -1
- package/lib/components/Search/SearchDialog.js +9 -15
- package/lib/components/Search/SearchInput.js +1 -1
- package/lib/components/Search/SearchRecent.js +1 -1
- package/lib/components/SidebarActions/SidebarActions.js +3 -3
- package/lib/components/Switch/Switch.d.ts +4 -1
- package/lib/components/Switch/Switch.js +12 -3
- package/lib/components/TableOfContent/TableOfContent.js +1 -1
- package/lib/components/UserMenu/LoginButton.js +1 -1
- package/lib/components/UserMenu/LogoutMenuItem.js +1 -1
- 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/search/use-search-dialog.js +2 -2
- package/lib/core/hooks/use-color-switcher.js +1 -4
- package/lib/core/hooks/use-product-picker.js +1 -1
- package/lib/core/hooks/use-telemetry-fallback.d.ts +60 -0
- package/lib/core/hooks/use-telemetry-fallback.js +66 -0
- package/lib/core/hooks/use-theme-hooks.js +2 -1
- package/lib/core/types/hooks.d.ts +2 -4
- package/lib/core/types/index.d.ts +0 -1
- package/lib/core/types/index.js +0 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +1 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeToggle.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +7 -8
- package/package.json +3 -3
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +4 -7
- package/src/components/Buttons/EditPageButton.tsx +1 -1
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +4 -76
- package/src/components/CatalogClassic/CatalogClassicActions.tsx +1 -1
- package/src/components/CatalogClassic/CatalogClassicCard.tsx +1 -1
- package/src/components/CatalogClassic/CatalogClassicInfoBlock.tsx +1 -3
- package/src/components/CodeBlock/CodeBlockControls.tsx +1 -4
- package/src/components/Feedback/Feedback.tsx +1 -1
- package/src/components/Feedback/ReportDialog.tsx +1 -1
- package/src/components/Filter/FilterCheckboxes.tsx +1 -1
- package/src/components/Footer/FooterItem.tsx +1 -1
- package/src/components/LanguagePicker/LanguagePicker.tsx +1 -4
- package/src/components/Logo/Logo.tsx +1 -1
- package/src/components/Menu/MenuItem.tsx +3 -6
- package/src/components/Navbar/Navbar.tsx +2 -2
- package/src/components/Navbar/NavbarItem.tsx +1 -3
- package/src/components/Search/SearchDialog.tsx +9 -15
- package/src/components/Search/SearchInput.tsx +1 -1
- package/src/components/Search/SearchRecent.tsx +1 -1
- package/src/components/SidebarActions/SidebarActions.tsx +3 -3
- package/src/components/Switch/Switch.tsx +34 -3
- package/src/components/TableOfContent/TableOfContent.tsx +1 -1
- package/src/components/UserMenu/LoginButton.tsx +1 -1
- package/src/components/UserMenu/LogoutMenuItem.tsx +1 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/search/use-search-dialog.ts +2 -2
- package/src/core/hooks/use-color-switcher.ts +1 -4
- package/src/core/hooks/use-product-picker.ts +1 -1
- package/src/core/hooks/use-telemetry-fallback.ts +61 -0
- package/src/core/hooks/use-theme-hooks.ts +2 -1
- package/src/core/types/hooks.ts +10 -4
- package/src/core/types/index.ts +0 -1
- package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +2 -2
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +1 -0
- package/src/markdoc/components/CodeWalkthrough/CodeToggle.tsx +5 -1
- package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +7 -8
- package/lib/core/types/telemetry.d.ts +0 -17
- package/lib/core/types/telemetry.js +0 -3
- package/src/core/types/telemetry.ts +0 -28
|
@@ -18,7 +18,7 @@ export function useSearchDialog() {
|
|
|
18
18
|
if (hotKeys) {
|
|
19
19
|
hotkeys(hotKeys, (ev) => {
|
|
20
20
|
setIsOpen(true);
|
|
21
|
-
telemetry.
|
|
21
|
+
telemetry.sendSearchOpenedMessage({ method: 'shortcut' });
|
|
22
22
|
ev.preventDefault();
|
|
23
23
|
});
|
|
24
24
|
|
|
@@ -28,7 +28,7 @@ export function useSearchDialog() {
|
|
|
28
28
|
}, [hotKeys]);
|
|
29
29
|
|
|
30
30
|
const onOpen = useCallback(function () {
|
|
31
|
-
telemetry.
|
|
31
|
+
telemetry.sendSearchOpenedMessage({ method: 'click' });
|
|
32
32
|
setIsOpen(true);
|
|
33
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
34
|
}, []);
|
|
@@ -34,10 +34,7 @@ export const useColorSwitcher = () => {
|
|
|
34
34
|
window.requestAnimationFrame(() => {
|
|
35
35
|
document.documentElement.classList.remove('notransition');
|
|
36
36
|
});
|
|
37
|
-
telemetry.
|
|
38
|
-
type: 'color_mode.switched',
|
|
39
|
-
payload: { from: activeColorMode, to: newMode },
|
|
40
|
-
});
|
|
37
|
+
telemetry.sendColorModeSwitchedMessage({ from: activeColorMode, to: newMode });
|
|
41
38
|
|
|
42
39
|
setActiveColorMode(newMode);
|
|
43
40
|
};
|
|
@@ -11,7 +11,7 @@ export function useProductPicker() {
|
|
|
11
11
|
const loadAndNavigate = useLoadAndNavigate();
|
|
12
12
|
function setProduct(product: typeof currentProduct) {
|
|
13
13
|
if (!product) return;
|
|
14
|
-
telemetry.
|
|
14
|
+
telemetry.sendProductPickedMessage({ product: product.slug });
|
|
15
15
|
loadAndNavigate({ navigate, to: product.link });
|
|
16
16
|
}
|
|
17
17
|
return {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// TODO we need to create some common way to do this.
|
|
2
|
+
export const useTelemetryFallback = () => ({
|
|
3
|
+
send: () => {},
|
|
4
|
+
sendPageViewedMessage: () => {},
|
|
5
|
+
sendErrorMessage: () => {},
|
|
6
|
+
sendClientErrorMessage: () => {},
|
|
7
|
+
sendBreadcrumbClickedMessage: () => {},
|
|
8
|
+
sendColorModeSwitchedMessage: () => {},
|
|
9
|
+
sendSidebarItemClickedMessage: () => {},
|
|
10
|
+
sendSidebarItemExpandedMessage: () => {},
|
|
11
|
+
sendSidebarItemCollapsedMessage: () => {},
|
|
12
|
+
sendChangeLayoutButtonClickedMessage: () => {},
|
|
13
|
+
sendEditPageLinkClickedMessage: () => {},
|
|
14
|
+
sendCodeSnippetReportedMessage: () => {},
|
|
15
|
+
sendNavbarMenuItemClickedMessage: () => {},
|
|
16
|
+
sendLoginButtonClickedMessage: () => {},
|
|
17
|
+
sendLoginProviderButtonClickedMessage: () => {},
|
|
18
|
+
sendLogoutMenuItemClickedMessage: () => {},
|
|
19
|
+
sendLogoClickedMessage: () => {},
|
|
20
|
+
sendTocItemClickedMessage: () => {},
|
|
21
|
+
sendCatalogFilterChangedMessage: () => {},
|
|
22
|
+
sendCatalogItemClickedMessage: () => {},
|
|
23
|
+
sendScorecardLinkClickedMessage: () => {},
|
|
24
|
+
sendBackToCatalogButtonClickedMessage: () => {},
|
|
25
|
+
sendSidebarDrilldownBackButtonClickedMessage: () => {},
|
|
26
|
+
sendFooterItemClickedMessage: () => {},
|
|
27
|
+
sendCatalogActionsButtonClickedMessage: () => {},
|
|
28
|
+
sendMobileMenuButtonCloseClickedMessage: () => {},
|
|
29
|
+
sendMobileMenuButtonOpenClickedMessage: () => {},
|
|
30
|
+
sendSearchInputResetButtonClickedMessage: () => {},
|
|
31
|
+
sendSearchRecentRemoveButtonClickedMessage: () => {},
|
|
32
|
+
sendSearchRecentClickedMessage: () => {},
|
|
33
|
+
sendRequestApiAccessButtonClickedMessage: () => {},
|
|
34
|
+
sendVersionPickerSelectionChangeMessage: () => {},
|
|
35
|
+
sendProductPickedMessage: () => {},
|
|
36
|
+
sendFilterCheckboxToggledMessage: () => {},
|
|
37
|
+
sendLanguagePickerLocaleChangedMessage: () => {},
|
|
38
|
+
sendSearchOpenedMessage: () => {},
|
|
39
|
+
sendSearchQueryMessage: () => {},
|
|
40
|
+
sendSearchAIQueryMessage: () => {},
|
|
41
|
+
sendFeedbackMessage: () => {},
|
|
42
|
+
sendSearchResultClickedMessage: () => {},
|
|
43
|
+
sendRedirectMessage: () => {},
|
|
44
|
+
sendOpenapiDocsMessage: () => {},
|
|
45
|
+
sendCopyCodeSnippetClickedMessage: () => {},
|
|
46
|
+
sendOpenapiDocsViewedMessage: () => {},
|
|
47
|
+
sendOpenapiDocsPerformanceMetricsMessage: () => {},
|
|
48
|
+
sendOpenapiDocsDownloadDefinitionClickedMessage: () => {},
|
|
49
|
+
sendOpenapiDocsSelectLanguageClickedMessage: () => {},
|
|
50
|
+
sendOpenapiDocsExpandCollapseAllClickedMessage: () => {},
|
|
51
|
+
sendOpenapiDocsSwitchServersClickedMessage: () => {},
|
|
52
|
+
sendOpenapiDocsExamplesSwitcherClickedMessage: () => {},
|
|
53
|
+
sendOpenapiDocsTryItOpenedMessage: () => {},
|
|
54
|
+
sendAsyncapiDocsViewedMessage: () => {},
|
|
55
|
+
sendAsyncapiDocsPerformanceMetricsMessage: () => {},
|
|
56
|
+
sendAsyncapiDocsSwitchMessageClickedMessage: () => {},
|
|
57
|
+
sendAsyncapiDocsSwitchExampleClickedMessage: () => {},
|
|
58
|
+
sendAsyncapiDocsMessageClickedMessage: () => {},
|
|
59
|
+
sendAsyncapiDocsServerModalOpenedMessage: () => {},
|
|
60
|
+
sendAsyncapiDocsDownloadDefinitionClickedMessage: () => {},
|
|
61
|
+
});
|
|
@@ -3,6 +3,7 @@ import { useContext } from 'react';
|
|
|
3
3
|
import type { ThemeHooks } from '../types/hooks';
|
|
4
4
|
|
|
5
5
|
import { ThemeDataContext } from '../contexts/ThemeDataContext';
|
|
6
|
+
import { useTelemetryFallback } from './use-telemetry-fallback';
|
|
6
7
|
|
|
7
8
|
const fallbacks = {
|
|
8
9
|
useTranslate: () => ({
|
|
@@ -10,7 +11,7 @@ const fallbacks = {
|
|
|
10
11
|
(typeof options === 'string' ? options : options?.defaultValue) || value || '',
|
|
11
12
|
}),
|
|
12
13
|
useSubmitFeedback: () => ({ submitFeedback: () => {} }),
|
|
13
|
-
useTelemetry:
|
|
14
|
+
useTelemetry: useTelemetryFallback,
|
|
14
15
|
/**
|
|
15
16
|
* @deprecated use `useTelemetry` instead
|
|
16
17
|
**/
|
package/src/core/types/hooks.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AsyncApiRealmUI } from '@redocly/realm-asyncapi-sdk';
|
|
1
2
|
import type {
|
|
2
3
|
CatalogEntityConfig,
|
|
3
4
|
PageData,
|
|
@@ -26,7 +27,6 @@ import type {
|
|
|
26
27
|
SearchFacetQuery,
|
|
27
28
|
AiSearchConversationItem,
|
|
28
29
|
} from './search';
|
|
29
|
-
import type { EventType, SendEventParams } from './telemetry';
|
|
30
30
|
import type { SubmitFeedbackParams } from './feedback';
|
|
31
31
|
import type { TFunction } from './l10n';
|
|
32
32
|
import type { BreadcrumbItem } from './breadcrumb';
|
|
@@ -148,9 +148,15 @@ export type ThemeHooks = {
|
|
|
148
148
|
initialData?: BffCatalogRelatedEntityList,
|
|
149
149
|
) => CatalogApiResults<BffCatalogRelatedEntity, BffCatalogRelatedEntityList>;
|
|
150
150
|
useCatalogClassic: (config: CatalogConfig) => FilteredCatalog;
|
|
151
|
-
useTelemetry: () =>
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
useTelemetry: () => Omit<
|
|
152
|
+
AsyncApiRealmUI.Telemetry,
|
|
153
|
+
| 'init'
|
|
154
|
+
| 'updateCloudEventData'
|
|
155
|
+
| 'forceFlush'
|
|
156
|
+
| 'startSpan'
|
|
157
|
+
| 'constructCloudEvent'
|
|
158
|
+
| 'sendToOtelService'
|
|
159
|
+
>;
|
|
154
160
|
useUserTeams: () => string[];
|
|
155
161
|
usePageData: () => PageData | null;
|
|
156
162
|
usePageProps: <T extends Record<string, unknown>>() => PageProps & T;
|
package/src/core/types/index.ts
CHANGED
|
@@ -72,11 +72,11 @@ const FilterWrapper = styled.div`
|
|
|
72
72
|
flex-wrap: wrap;
|
|
73
73
|
position: sticky;
|
|
74
74
|
|
|
75
|
-
padding-top:
|
|
75
|
+
padding-top: var(--spacing-xl);
|
|
76
76
|
padding-right: var(--spacing-xl);
|
|
77
77
|
padding-left: var(--spacing-xl);
|
|
78
78
|
padding-bottom: var(--spacing-xs);
|
|
79
|
-
top:
|
|
79
|
+
top: var(--navbar-height);
|
|
80
80
|
background-color: var(--bg-color);
|
|
81
81
|
z-index: 1;
|
|
82
82
|
max-width: var(--md-content-max-width);
|
|
@@ -26,7 +26,11 @@ export function CodeToggle(props: CodeToggleProps) {
|
|
|
26
26
|
<ToggleWrapper data-component-name="Markdoc/CodeWalkthrough/CodeToggle">
|
|
27
27
|
<ToggleContentWrapper>
|
|
28
28
|
<ToggleSubtitle>
|
|
29
|
-
<Switch
|
|
29
|
+
<Switch
|
|
30
|
+
value={checked}
|
|
31
|
+
onChange={(newValue) => changeControlState(id, newValue)}
|
|
32
|
+
stopPropagation
|
|
33
|
+
/>
|
|
30
34
|
<div>{label}</div>
|
|
31
35
|
</ToggleSubtitle>
|
|
32
36
|
{description ? (
|
|
@@ -82,9 +82,14 @@ const DocsPanel = styled.div`
|
|
|
82
82
|
min-height: 0;
|
|
83
83
|
min-height: calc(100vh - var(--navbar-height));
|
|
84
84
|
|
|
85
|
+
padding-top: var(--spacing-xl);
|
|
85
86
|
padding-right: var(--spacing-xs);
|
|
86
87
|
padding-bottom: calc(var(--spacing-xs) + var(--spacing-xl));
|
|
87
88
|
gap: var(--spacing-xl);
|
|
89
|
+
|
|
90
|
+
&:has([data-component-name='Markdoc/CodeWalkthrough/CodeFilters']) {
|
|
91
|
+
padding-top: 0;
|
|
92
|
+
}
|
|
88
93
|
`;
|
|
89
94
|
|
|
90
95
|
const ContentWrapper = styled.div`
|
|
@@ -111,13 +116,7 @@ const ContentWrapper = styled.div`
|
|
|
111
116
|
-ms-overflow-style: none; /* IE and Edge */
|
|
112
117
|
scrollbar-width: none; /* Firefox */
|
|
113
118
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&:not(:first-child) {
|
|
119
|
-
& > *:first-child {
|
|
120
|
-
margin-top: 0;
|
|
121
|
-
}
|
|
119
|
+
&& > *:first-child {
|
|
120
|
+
margin-top: 0;
|
|
122
121
|
}
|
|
123
122
|
`;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AsyncApiRealm } from '@redocly/realm-asyncapi-sdk';
|
|
2
|
-
type ExtractEventType<T> = T extends {
|
|
3
|
-
type: infer EventType;
|
|
4
|
-
} ? EventType : never;
|
|
5
|
-
export type EventType = ExtractEventType<AsyncApiRealm.Messages>;
|
|
6
|
-
type GetMessageForEventType<TEventType extends EventType> = Extract<AsyncApiRealm.Messages, {
|
|
7
|
-
type: TEventType;
|
|
8
|
-
}>;
|
|
9
|
-
type ExtractEventDataForType<TEventType extends EventType> = GetMessageForEventType<TEventType> extends {
|
|
10
|
-
data: infer Data;
|
|
11
|
-
} ? Data : never;
|
|
12
|
-
export type EventPayload<TEventType extends EventType> = ExtractEventDataForType<TEventType>;
|
|
13
|
-
export interface SendEventParams<TEventType extends EventType> {
|
|
14
|
-
type: TEventType;
|
|
15
|
-
payload?: EventPayload<TEventType>;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { AsyncApiRealm } from '@redocly/realm-asyncapi-sdk';
|
|
2
|
-
|
|
3
|
-
type ExtractEventType<T> = T extends {
|
|
4
|
-
type: infer EventType;
|
|
5
|
-
}
|
|
6
|
-
? EventType
|
|
7
|
-
: never;
|
|
8
|
-
|
|
9
|
-
export type EventType = ExtractEventType<AsyncApiRealm.Messages>;
|
|
10
|
-
|
|
11
|
-
type GetMessageForEventType<TEventType extends EventType> = Extract<
|
|
12
|
-
AsyncApiRealm.Messages,
|
|
13
|
-
{ type: TEventType }
|
|
14
|
-
>;
|
|
15
|
-
|
|
16
|
-
type ExtractEventDataForType<TEventType extends EventType> =
|
|
17
|
-
GetMessageForEventType<TEventType> extends {
|
|
18
|
-
data: infer Data;
|
|
19
|
-
}
|
|
20
|
-
? Data
|
|
21
|
-
: never;
|
|
22
|
-
|
|
23
|
-
export type EventPayload<TEventType extends EventType> = ExtractEventDataForType<TEventType>;
|
|
24
|
-
|
|
25
|
-
export interface SendEventParams<TEventType extends EventType> {
|
|
26
|
-
type: TEventType;
|
|
27
|
-
payload?: EventPayload<TEventType>;
|
|
28
|
-
}
|