@redocly/theme 0.58.0-next.1 → 0.58.0-next.3
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/Catalog/Catalog.js +3 -1
- package/lib/components/Search/SearchDialog.js +6 -2
- package/lib/core/hooks/catalog/useCatalogTableViewRow.js +1 -1
- package/lib/core/hooks/use-active-section-id.js +4 -0
- package/lib/core/openapi/index.d.ts +7 -3
- package/lib/core/openapi/index.js +7 -7
- package/lib/core/utils/urls.js +1 -1
- package/package.json +3 -3
- package/src/components/Catalog/Catalog.tsx +3 -1
- package/src/components/Search/SearchDialog.tsx +8 -1
- package/src/core/hooks/catalog/useCatalogTableViewRow.ts +1 -1
- package/src/core/hooks/use-active-section-id.ts +6 -0
- package/src/core/openapi/index.ts +7 -3
- package/src/core/utils/urls.ts +2 -1
|
@@ -43,7 +43,9 @@ function Catalog(props) {
|
|
|
43
43
|
react_1.default.createElement(CatalogPageDescription, null,
|
|
44
44
|
react_1.default.createElement(CatalogTitleWrapper, null,
|
|
45
45
|
react_1.default.createElement(CatalogTitle, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey },
|
|
46
|
-
|
|
46
|
+
(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey)
|
|
47
|
+
? translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.titleTranslationKey)
|
|
48
|
+
: catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.slug,
|
|
47
49
|
' '),
|
|
48
50
|
react_1.default.createElement(CounterTag_1.CounterTag, { borderless: true }, entitiesCounter)),
|
|
49
51
|
react_1.default.createElement(CatalogDescription, { "data-translation-key": catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey }, translate(catalogConfig === null || catalogConfig === void 0 ? void 0 : catalogConfig.descriptionTranslationKey))),
|
|
@@ -190,8 +190,9 @@ function SearchDialog({ onClose, className }) {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
}, ref: aiQueryRef, tabIndex: 0, role: "option", "aria-selected": "true" },
|
|
193
|
-
react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { color: "var(--search-ai-icon-color)", size: "36px", background: "var(--search-ai-icon-bg-color)", margin: "0 var(--spacing-md) 0 0", borderRadius: "var(--border-radius-lg)" }),
|
|
194
|
-
react_1.default.createElement(
|
|
193
|
+
react_1.default.createElement(AiStarsIcon_1.AiStarsIcon, { style: { flexShrink: 0 }, color: "var(--search-ai-icon-color)", size: "36px", background: "var(--search-ai-icon-bg-color)", margin: "0 var(--spacing-md) 0 0", borderRadius: "var(--border-radius-lg)" }),
|
|
194
|
+
react_1.default.createElement(QueryWrapper, null,
|
|
195
|
+
react_1.default.createElement(Typography_1.Typography, { fontWeight: "var(--font-weight-semibold)" }, query)),
|
|
195
196
|
react_1.default.createElement(Typography_1.Typography, null,
|
|
196
197
|
"- ",
|
|
197
198
|
translate('search.ai.label', 'Ask AI assistant')),
|
|
@@ -439,4 +440,7 @@ const SearchWithAI = styled_components_1.default.div `
|
|
|
439
440
|
margin-right: var(--spacing-xs);
|
|
440
441
|
}
|
|
441
442
|
`;
|
|
443
|
+
const QueryWrapper = styled_components_1.default.div `
|
|
444
|
+
word-break: break-word;
|
|
445
|
+
`;
|
|
442
446
|
//# sourceMappingURL=SearchDialog.js.map
|
|
@@ -10,7 +10,7 @@ function useCatalogTableViewRow({ entityKey, entityType, catalogConfig, entities
|
|
|
10
10
|
}
|
|
11
11
|
return Object.values((_a = entitiesCatalogConfig.catalogs) !== null && _a !== void 0 ? _a : {}).find((catalog) => {
|
|
12
12
|
var _a;
|
|
13
|
-
return (_a = catalog.includes) === null || _a === void 0 ? void 0 : _a.some((include) => include.type === entityType);
|
|
13
|
+
return (_a = catalog === null || catalog === void 0 ? void 0 : catalog.includes) === null || _a === void 0 ? void 0 : _a.some((include) => include.type === entityType);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
const getEntityDetailsLink = () => {
|
|
@@ -17,6 +17,10 @@ function useActiveSectionId(location, hasOverviewPage = false, withNavbar = true
|
|
|
17
17
|
setItemId('');
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
+
if (window.scrollY <= 0) {
|
|
21
|
+
setItemId(sections[0].getAttribute('data-section-id') || '');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
20
24
|
for (let i = 0; i < sections.length; i++) {
|
|
21
25
|
const section = sections[i];
|
|
22
26
|
const rect = section.getBoundingClientRect();
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export type { UserClaims } from '../types/user-claims';
|
|
2
|
+
export type { SearchDocument, SearchItemData, OperationParameter } from '../types/search';
|
|
3
|
+
export type { TFunction, TOptions } from '../types/l10n';
|
|
4
|
+
export type { SelectOption, SelectProps } from '../types/select';
|
|
1
5
|
export { IS_BROWSER } from '../utils/dom';
|
|
2
6
|
export { addLeadingSlash, removeLeadingSlash, getPathPrefix, combineUrls, addTrailingSlash, withPathPrefix, } from '../utils/urls';
|
|
3
7
|
export { typedMemo } from '../hoc/typedMemo';
|
|
@@ -5,14 +9,14 @@ export { useMount } from '../hooks/use-mount';
|
|
|
5
9
|
export { GlobalStyle } from '../styles/global';
|
|
6
10
|
export { breakpoints } from '../utils/media-css';
|
|
7
11
|
export { isPrimitive } from '../utils/args-typecheck';
|
|
8
|
-
export
|
|
12
|
+
export { getUserAgent } from '../utils/get-user-agent';
|
|
9
13
|
export { useFocusTrap } from '../hooks/use-focus-trap';
|
|
10
|
-
export type { TFunction, TOptions } from '../types/l10n';
|
|
11
14
|
export { useThemeHooks } from '../hooks/use-theme-hooks';
|
|
12
15
|
export { useOutsideClick } from '../hooks/use-outside-click';
|
|
13
|
-
export type { SelectOption, SelectProps } from '../types/select';
|
|
14
16
|
export { useActiveSectionId } from '../hooks/use-active-section-id';
|
|
15
17
|
export { useModalScrollLock } from '../hooks/use-modal-scroll-lock';
|
|
18
|
+
export { useSearchDialog } from '../hooks/search/use-search-dialog';
|
|
19
|
+
export { useDialogHotKeys } from '../hooks/use-dialog-hotkeys';
|
|
16
20
|
export { SecurityVariablesEnvSuffix } from '../constants/environments';
|
|
17
21
|
export { isUndefined, isString, isNotNull, isObject } from '../utils/type-guards';
|
|
18
22
|
export { ThemeDataContext, type ThemeDataTransferObject } from '../contexts/ThemeDataContext';
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENTITY_RELATION_TYPES = exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
|
|
4
|
-
// This file is intended to provide selective imports from @redocly/theme/core
|
|
5
|
-
// to reduce bundle size by exporting only functionality used in the @redocly/openapi-docs package.
|
|
6
|
-
//
|
|
7
|
-
// This selective import approach will help with tree shaking and reduce
|
|
8
|
-
// the overall bundle size by avoiding importing the entire theme package
|
|
9
|
-
// when only specific functionality is needed.
|
|
3
|
+
exports.ENTITY_RELATION_TYPES = exports.ThemeDataContext = exports.isObject = exports.isNotNull = exports.isString = exports.isUndefined = exports.SecurityVariablesEnvSuffix = exports.useDialogHotKeys = exports.useSearchDialog = exports.useModalScrollLock = exports.useActiveSectionId = exports.useOutsideClick = exports.useThemeHooks = exports.useFocusTrap = exports.getUserAgent = exports.isPrimitive = exports.breakpoints = exports.GlobalStyle = exports.useMount = exports.typedMemo = exports.withPathPrefix = exports.addTrailingSlash = exports.combineUrls = exports.getPathPrefix = exports.removeLeadingSlash = exports.addLeadingSlash = exports.IS_BROWSER = void 0;
|
|
10
4
|
var dom_1 = require("../utils/dom");
|
|
11
5
|
Object.defineProperty(exports, "IS_BROWSER", { enumerable: true, get: function () { return dom_1.IS_BROWSER; } });
|
|
12
6
|
var urls_1 = require("../utils/urls");
|
|
@@ -26,6 +20,8 @@ var media_css_1 = require("../utils/media-css");
|
|
|
26
20
|
Object.defineProperty(exports, "breakpoints", { enumerable: true, get: function () { return media_css_1.breakpoints; } });
|
|
27
21
|
var args_typecheck_1 = require("../utils/args-typecheck");
|
|
28
22
|
Object.defineProperty(exports, "isPrimitive", { enumerable: true, get: function () { return args_typecheck_1.isPrimitive; } });
|
|
23
|
+
var get_user_agent_1 = require("../utils/get-user-agent");
|
|
24
|
+
Object.defineProperty(exports, "getUserAgent", { enumerable: true, get: function () { return get_user_agent_1.getUserAgent; } });
|
|
29
25
|
var use_focus_trap_1 = require("../hooks/use-focus-trap");
|
|
30
26
|
Object.defineProperty(exports, "useFocusTrap", { enumerable: true, get: function () { return use_focus_trap_1.useFocusTrap; } });
|
|
31
27
|
var use_theme_hooks_1 = require("../hooks/use-theme-hooks");
|
|
@@ -36,6 +32,10 @@ var use_active_section_id_1 = require("../hooks/use-active-section-id");
|
|
|
36
32
|
Object.defineProperty(exports, "useActiveSectionId", { enumerable: true, get: function () { return use_active_section_id_1.useActiveSectionId; } });
|
|
37
33
|
var use_modal_scroll_lock_1 = require("../hooks/use-modal-scroll-lock");
|
|
38
34
|
Object.defineProperty(exports, "useModalScrollLock", { enumerable: true, get: function () { return use_modal_scroll_lock_1.useModalScrollLock; } });
|
|
35
|
+
var use_search_dialog_1 = require("../hooks/search/use-search-dialog");
|
|
36
|
+
Object.defineProperty(exports, "useSearchDialog", { enumerable: true, get: function () { return use_search_dialog_1.useSearchDialog; } });
|
|
37
|
+
var use_dialog_hotkeys_1 = require("../hooks/use-dialog-hotkeys");
|
|
38
|
+
Object.defineProperty(exports, "useDialogHotKeys", { enumerable: true, get: function () { return use_dialog_hotkeys_1.useDialogHotKeys; } });
|
|
39
39
|
var environments_1 = require("../constants/environments");
|
|
40
40
|
Object.defineProperty(exports, "SecurityVariablesEnvSuffix", { enumerable: true, get: function () { return environments_1.SecurityVariablesEnvSuffix; } });
|
|
41
41
|
var type_guards_1 = require("../utils/type-guards");
|
package/lib/core/utils/urls.js
CHANGED
|
@@ -56,7 +56,7 @@ function addLeadingSlash(url) {
|
|
|
56
56
|
return url.startsWith('/') ? url : `/${url}`;
|
|
57
57
|
}
|
|
58
58
|
function removeTrailingSlash(url) {
|
|
59
|
-
return url.endsWith('/') ? url.substring(0, url.length - 1) : url;
|
|
59
|
+
return url.endsWith('/') && url !== '/' ? url.substring(0, url.length - 1) : url;
|
|
60
60
|
}
|
|
61
61
|
function removeLeadingSlash(url) {
|
|
62
62
|
return url.startsWith('/') ? url.substring(1) : url;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.58.0-next.
|
|
3
|
+
"version": "0.58.0-next.3",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"openapi-sampler": "1.6.1",
|
|
88
88
|
"react-calendar": "5.1.0",
|
|
89
89
|
"react-date-picker": "11.0.0",
|
|
90
|
-
"@redocly/config": "0.
|
|
91
|
-
"@redocly/realm-asyncapi-sdk": "0.4.0-next.
|
|
90
|
+
"@redocly/config": "0.31.0",
|
|
91
|
+
"@redocly/realm-asyncapi-sdk": "0.4.0-next.1"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
|
|
@@ -102,7 +102,9 @@ export function Catalog(props: CatalogProps): JSX.Element {
|
|
|
102
102
|
<CatalogPageDescription>
|
|
103
103
|
<CatalogTitleWrapper>
|
|
104
104
|
<CatalogTitle data-translation-key={catalogConfig?.titleTranslationKey}>
|
|
105
|
-
{
|
|
105
|
+
{catalogConfig?.titleTranslationKey
|
|
106
|
+
? translate(catalogConfig?.titleTranslationKey)
|
|
107
|
+
: catalogConfig?.slug}{' '}
|
|
106
108
|
</CatalogTitle>
|
|
107
109
|
<CounterTag borderless>{entitiesCounter}</CounterTag>
|
|
108
110
|
</CatalogTitleWrapper>
|
|
@@ -306,13 +306,16 @@ export function SearchDialog({ onClose, className }: SearchDialogProps): JSX.Ele
|
|
|
306
306
|
aria-selected="true"
|
|
307
307
|
>
|
|
308
308
|
<AiStarsIcon
|
|
309
|
+
style={{ flexShrink: 0 }}
|
|
309
310
|
color="var(--search-ai-icon-color)"
|
|
310
311
|
size="36px"
|
|
311
312
|
background="var(--search-ai-icon-bg-color)"
|
|
312
313
|
margin="0 var(--spacing-md) 0 0"
|
|
313
314
|
borderRadius="var(--border-radius-lg)"
|
|
314
315
|
/>
|
|
315
|
-
<
|
|
316
|
+
<QueryWrapper>
|
|
317
|
+
<Typography fontWeight="var(--font-weight-semibold)">{query}</Typography>
|
|
318
|
+
</QueryWrapper>
|
|
316
319
|
<Typography>- {translate('search.ai.label', 'Ask AI assistant')}</Typography>
|
|
317
320
|
<ReturnKeyIcon color="var(--search-item-text-color)" />
|
|
318
321
|
</SearchWithAI>
|
|
@@ -673,3 +676,7 @@ const SearchWithAI = styled.div`
|
|
|
673
676
|
margin-right: var(--spacing-xs);
|
|
674
677
|
}
|
|
675
678
|
`;
|
|
679
|
+
|
|
680
|
+
const QueryWrapper = styled.div`
|
|
681
|
+
word-break: break-word;
|
|
682
|
+
`;
|
|
@@ -21,7 +21,7 @@ export function useCatalogTableViewRow({
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
return Object.values(entitiesCatalogConfig.catalogs ?? {}).find((catalog) => {
|
|
24
|
-
return catalog
|
|
24
|
+
return catalog?.includes?.some((include) => include.type === entityType);
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -25,6 +25,12 @@ export function useActiveSectionId(
|
|
|
25
25
|
setItemId('');
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
if (window.scrollY <= 0) {
|
|
30
|
+
setItemId(sections[0].getAttribute('data-section-id') || '');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
for (let i = 0; i < sections.length; i++) {
|
|
29
35
|
const section = sections[i];
|
|
30
36
|
const rect = section.getBoundingClientRect();
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
// This selective import approach will help with tree shaking and reduce
|
|
5
5
|
// the overall bundle size by avoiding importing the entire theme package
|
|
6
6
|
// when only specific functionality is needed.
|
|
7
|
+
export type { UserClaims } from '../types/user-claims';
|
|
8
|
+
export type { SearchDocument, SearchItemData, OperationParameter } from '../types/search';
|
|
9
|
+
export type { TFunction, TOptions } from '../types/l10n';
|
|
10
|
+
export type { SelectOption, SelectProps } from '../types/select';
|
|
7
11
|
export { IS_BROWSER } from '../utils/dom';
|
|
8
12
|
export {
|
|
9
13
|
addLeadingSlash,
|
|
@@ -18,14 +22,14 @@ export { useMount } from '../hooks/use-mount';
|
|
|
18
22
|
export { GlobalStyle } from '../styles/global';
|
|
19
23
|
export { breakpoints } from '../utils/media-css';
|
|
20
24
|
export { isPrimitive } from '../utils/args-typecheck';
|
|
21
|
-
export
|
|
25
|
+
export { getUserAgent } from '../utils/get-user-agent';
|
|
22
26
|
export { useFocusTrap } from '../hooks/use-focus-trap';
|
|
23
|
-
export type { TFunction, TOptions } from '../types/l10n';
|
|
24
27
|
export { useThemeHooks } from '../hooks/use-theme-hooks';
|
|
25
28
|
export { useOutsideClick } from '../hooks/use-outside-click';
|
|
26
|
-
export type { SelectOption, SelectProps } from '../types/select';
|
|
27
29
|
export { useActiveSectionId } from '../hooks/use-active-section-id';
|
|
28
30
|
export { useModalScrollLock } from '../hooks/use-modal-scroll-lock';
|
|
31
|
+
export { useSearchDialog } from '../hooks/search/use-search-dialog';
|
|
32
|
+
export { useDialogHotKeys } from '../hooks/use-dialog-hotkeys';
|
|
29
33
|
export { SecurityVariablesEnvSuffix } from '../constants/environments';
|
|
30
34
|
export { isUndefined, isString, isNotNull, isObject } from '../utils/type-guards';
|
|
31
35
|
export { ThemeDataContext, type ThemeDataTransferObject } from '../contexts/ThemeDataContext';
|
package/src/core/utils/urls.ts
CHANGED
|
@@ -54,8 +54,9 @@ export function addLeadingSlash(url: string): string {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export function removeTrailingSlash(url: string): string {
|
|
57
|
-
return url.endsWith('/') ? url.substring(0, url.length - 1) : url;
|
|
57
|
+
return url.endsWith('/') && url !== '/' ? url.substring(0, url.length - 1) : url;
|
|
58
58
|
}
|
|
59
|
+
|
|
59
60
|
export function removeLeadingSlash(url: string): string {
|
|
60
61
|
return url.startsWith('/') ? url.substring(1) : url;
|
|
61
62
|
}
|