@redocly/theme 0.66.0-next.0 → 0.66.0-next.2
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/CodeBlock/CodeBlockControls.js +6 -1
- package/lib/core/hooks/__tests__/mocks/mock-intersection-observer.d.ts +1 -0
- package/lib/core/hooks/__tests__/mocks/mock-intersection-observer.js +7 -0
- package/lib/core/hooks/use-banner-telemetry.js +3 -12
- package/lib/core/hooks/use-product-picker.d.ts +3 -3
- package/lib/markdoc/default.d.ts +21 -105
- package/lib/markdoc/tags/types.d.ts +12 -6
- package/package.json +6 -6
- package/src/components/CodeBlock/CodeBlockControls.tsx +6 -1
- package/src/core/hooks/__tests__/mocks/mock-intersection-observer.ts +2 -0
- package/src/core/hooks/code-walkthrough/__mocks__/mock-intersection-observer.ts +2 -0
- package/src/core/hooks/use-banner-telemetry.ts +3 -13
- package/src/markdoc/tags/types.ts +13 -4
|
@@ -55,7 +55,12 @@ function CodeBlockControls({ children, className, title, controls, tabs, dropdow
|
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
57
|
telemetry.sendCopyCodeSnippetClickedMessage([
|
|
58
|
-
{
|
|
58
|
+
{
|
|
59
|
+
id: 'copyCodeSnippetButton',
|
|
60
|
+
object: 'button',
|
|
61
|
+
uri: 'urn:redocly:redoc:ui:button:copyCodeSnippetButton',
|
|
62
|
+
snippetType: 'copy',
|
|
63
|
+
},
|
|
59
64
|
]);
|
|
60
65
|
}
|
|
61
66
|
} }))) : null))) : null;
|
|
@@ -15,6 +15,12 @@ class MockIntersectionObserver {
|
|
|
15
15
|
writable: true,
|
|
16
16
|
value: void 0
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(this, "scrollMargin", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(this, "thresholds", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
configurable: true,
|
|
@@ -52,6 +58,7 @@ class MockIntersectionObserver {
|
|
|
52
58
|
this.entries = [];
|
|
53
59
|
this.root = null;
|
|
54
60
|
this.rootMargin = '0px';
|
|
61
|
+
this.scrollMargin = '';
|
|
55
62
|
this.thresholds = [1];
|
|
56
63
|
this.callback = callback;
|
|
57
64
|
this.viewPort.addEventListener('scroll', this.intersect);
|
|
@@ -16,9 +16,6 @@ const react_1 = require("react");
|
|
|
16
16
|
const use_theme_hooks_1 = require("./use-theme-hooks");
|
|
17
17
|
const noop = () => { };
|
|
18
18
|
const noopLink = (_href) => { };
|
|
19
|
-
function getCurrentPageUri() {
|
|
20
|
-
return window.location.href;
|
|
21
|
-
}
|
|
22
19
|
function useBannerTelemetry(displayBanner) {
|
|
23
20
|
const { useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
24
21
|
const telemetry = useTelemetry();
|
|
@@ -43,20 +40,14 @@ function useBannerTelemetry(displayBanner) {
|
|
|
43
40
|
};
|
|
44
41
|
return {
|
|
45
42
|
sendBannerViewedMessage: () => {
|
|
46
|
-
|
|
47
|
-
const page = { id: pageUri, object: 'page', uri: pageUri };
|
|
48
|
-
telemetry.sendBannerViewedMessage([payload, page]);
|
|
43
|
+
telemetry.sendBannerViewedMessage([payload]);
|
|
49
44
|
},
|
|
50
45
|
sendBannerDismissedMessage: () => {
|
|
51
|
-
const pageUri = getCurrentPageUri();
|
|
52
|
-
const page = { id: pageUri, object: 'page', uri: pageUri };
|
|
53
46
|
const { dismissible: _ } = payload, dismissedPayload = __rest(payload, ["dismissible"]);
|
|
54
|
-
telemetry.sendBannerDismissedMessage([dismissedPayload
|
|
47
|
+
telemetry.sendBannerDismissedMessage([dismissedPayload]);
|
|
55
48
|
},
|
|
56
49
|
sendBannerLinkClickedMessage: (href) => {
|
|
57
|
-
|
|
58
|
-
const page = { id: pageUri, object: 'page', uri: pageUri };
|
|
59
|
-
telemetry.sendBannerLinkClickedMessage([Object.assign(Object.assign({}, payload), { href }), page]);
|
|
50
|
+
telemetry.sendBannerLinkClickedMessage([Object.assign(Object.assign({}, payload), { href })]);
|
|
60
51
|
},
|
|
61
52
|
};
|
|
62
53
|
}, [displayBanner, telemetry]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function useProductPicker(): {
|
|
2
|
-
currentProduct: import("
|
|
3
|
-
products: import("
|
|
4
|
-
setProduct: (product: import("
|
|
2
|
+
currentProduct: import("../..").ProductUiConfig | undefined;
|
|
3
|
+
products: import("../..").ProductUiConfig[];
|
|
4
|
+
setProduct: (product: import("../..").ProductUiConfig | undefined) => void;
|
|
5
5
|
};
|
package/lib/markdoc/default.d.ts
CHANGED
|
@@ -27,109 +27,25 @@ import { connectMcp } from '../markdoc/tags/connect-mcp';
|
|
|
27
27
|
import { loginButton } from '../markdoc/tags/login-button';
|
|
28
28
|
import { diagram } from '../markdoc/tags/diagram';
|
|
29
29
|
export declare const tags: {
|
|
30
|
-
[admonition.tagName]: import("
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
[
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
[
|
|
51
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
52
|
-
resolver?: string;
|
|
53
|
-
}>;
|
|
54
|
-
};
|
|
55
|
-
[tab.tagName]: import("@markdoc/markdoc").Schema & {
|
|
56
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
57
|
-
resolver?: string;
|
|
58
|
-
}>;
|
|
59
|
-
};
|
|
60
|
-
[tabs.tagName]: import("@markdoc/markdoc").Schema & {
|
|
61
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
62
|
-
resolver?: string;
|
|
63
|
-
}>;
|
|
64
|
-
};
|
|
65
|
-
[codeSnippet.tagName]: import("@markdoc/markdoc").Schema & {
|
|
66
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
67
|
-
resolver?: string;
|
|
68
|
-
}>;
|
|
69
|
-
};
|
|
70
|
-
[inlineSvg.tagName]: import("@markdoc/markdoc").Schema & {
|
|
71
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
72
|
-
resolver?: string;
|
|
73
|
-
}>;
|
|
74
|
-
};
|
|
75
|
-
[cards.tagName]: import("@markdoc/markdoc").Schema & {
|
|
76
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
77
|
-
resolver?: string;
|
|
78
|
-
}>;
|
|
79
|
-
};
|
|
80
|
-
[card.tagName]: import("@markdoc/markdoc").Schema & {
|
|
81
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
82
|
-
resolver?: string;
|
|
83
|
-
}>;
|
|
84
|
-
};
|
|
85
|
-
[img.tagName]: import("@markdoc/markdoc").Schema & {
|
|
86
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
87
|
-
resolver?: string;
|
|
88
|
-
}>;
|
|
89
|
-
};
|
|
90
|
-
[codeWalkthrough.tagName]: import("@markdoc/markdoc").Schema & {
|
|
91
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
92
|
-
resolver?: string;
|
|
93
|
-
}>;
|
|
94
|
-
};
|
|
95
|
-
[codeStep.tagName]: import("@markdoc/markdoc").Schema & {
|
|
96
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
97
|
-
resolver?: string;
|
|
98
|
-
}>;
|
|
99
|
-
};
|
|
100
|
-
[toggle.tagName]: import("@markdoc/markdoc").Schema & {
|
|
101
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
102
|
-
resolver?: string;
|
|
103
|
-
}>;
|
|
104
|
-
};
|
|
105
|
-
[input.tagName]: import("@markdoc/markdoc").Schema & {
|
|
106
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
107
|
-
resolver?: string;
|
|
108
|
-
}>;
|
|
109
|
-
};
|
|
110
|
-
[codeGroup.tagName]: import("@markdoc/markdoc").Schema & {
|
|
111
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
112
|
-
resolver?: string;
|
|
113
|
-
}>;
|
|
114
|
-
};
|
|
115
|
-
[icon.tagName]: import("@markdoc/markdoc").Schema & {
|
|
116
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
117
|
-
resolver?: string;
|
|
118
|
-
}>;
|
|
119
|
-
};
|
|
120
|
-
[connectMcp.tagName]: import("@markdoc/markdoc").Schema & {
|
|
121
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
122
|
-
resolver?: string;
|
|
123
|
-
}>;
|
|
124
|
-
};
|
|
125
|
-
[loginButton.tagName]: import("@markdoc/markdoc").Schema & {
|
|
126
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
127
|
-
resolver?: string;
|
|
128
|
-
}>;
|
|
129
|
-
};
|
|
130
|
-
[diagram.tagName]: import("@markdoc/markdoc").Schema & {
|
|
131
|
-
attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
|
|
132
|
-
resolver?: string;
|
|
133
|
-
}>;
|
|
134
|
-
};
|
|
30
|
+
[admonition.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
31
|
+
[debug.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
32
|
+
[html.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
33
|
+
[markdocExample.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
34
|
+
[partial.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
35
|
+
[tab.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
36
|
+
[tabs.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
37
|
+
[codeSnippet.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
38
|
+
[inlineSvg.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
39
|
+
[cards.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
40
|
+
[card.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
41
|
+
[img.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
42
|
+
[codeWalkthrough.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
43
|
+
[codeStep.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
44
|
+
[toggle.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
45
|
+
[input.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
46
|
+
[codeGroup.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
47
|
+
[icon.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
48
|
+
[connectMcp.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
49
|
+
[loginButton.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
50
|
+
[diagram.tagName]: import("./tags/types").MarkdocTagSchema;
|
|
135
51
|
};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import type { Schema, SchemaAttribute } from '@markdoc/markdoc';
|
|
1
|
+
import type { Node, Schema, SchemaAttribute } from '@markdoc/markdoc';
|
|
2
|
+
export type RenderForLlmsContext = {
|
|
3
|
+
getBody: () => string;
|
|
4
|
+
};
|
|
5
|
+
export type RenderForLlmsFn = (node: Node, context: RenderForLlmsContext) => string;
|
|
6
|
+
export type MarkdocTagSchema = Schema & {
|
|
7
|
+
attributes?: Record<string, SchemaAttribute & {
|
|
8
|
+
resolver?: string;
|
|
9
|
+
}>;
|
|
10
|
+
renderForLlms?: RenderForLlmsFn;
|
|
11
|
+
};
|
|
2
12
|
export type MarkdocSchemaWrapper = {
|
|
3
|
-
schema:
|
|
4
|
-
attributes?: Record<string, SchemaAttribute & {
|
|
5
|
-
resolver?: string;
|
|
6
|
-
}>;
|
|
7
|
-
};
|
|
13
|
+
schema: MarkdocTagSchema;
|
|
8
14
|
tagName: string;
|
|
9
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.66.0-next.
|
|
3
|
+
"version": "0.66.0-next.2",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@types/highlight-words-core": "1.2.3",
|
|
44
44
|
"@types/lodash.debounce": "4.0.9",
|
|
45
45
|
"@types/lodash.throttle": "4.1.9",
|
|
46
|
-
"@types/node": "
|
|
46
|
+
"@types/node": "24.1.0",
|
|
47
47
|
"@types/nprogress": "0.2.3",
|
|
48
48
|
"@types/react": "^19.2.7",
|
|
49
49
|
"@types/react-dom": "^19.2.3",
|
|
50
50
|
"@types/styled-components": "5.1.34",
|
|
51
51
|
"@vitest/coverage-v8": "4.0.10",
|
|
52
|
-
"@vitest/ui": "
|
|
52
|
+
"@vitest/ui": "4.0.10",
|
|
53
53
|
"concurrently": "7.6.0",
|
|
54
54
|
"react-router-dom": "^6.30.3",
|
|
55
55
|
"resize-observer-polyfill": "1.5.1",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"tsc-alias": "1.8.16",
|
|
60
60
|
"tsconfig-paths": "4.2.0",
|
|
61
61
|
"tsconfig-paths-webpack-plugin": "3.5.2",
|
|
62
|
-
"typescript": "
|
|
62
|
+
"typescript": "6.0.3",
|
|
63
63
|
"vitest": "4.0.10",
|
|
64
64
|
"vitest-when": "0.6.2",
|
|
65
65
|
"webpack": "5.105.2",
|
|
66
|
-
"@redocly/realm-asyncapi-sdk": "0.12.0-next.
|
|
66
|
+
"@redocly/realm-asyncapi-sdk": "0.12.0-next.2"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@tanstack/react-query": "5.62.3",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"openapi-sampler": "^1.7.2",
|
|
82
82
|
"react-calendar": "5.1.0",
|
|
83
83
|
"react-date-picker": "11.0.0",
|
|
84
|
-
"@redocly/config": "0.
|
|
84
|
+
"@redocly/config": "0.49.0"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"watch": "tsc -p tsconfig.build.json && (concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\")",
|
|
@@ -186,7 +186,12 @@ export function CodeBlockControls({
|
|
|
186
186
|
copy?.onClick?.();
|
|
187
187
|
} else {
|
|
188
188
|
telemetry.sendCopyCodeSnippetClickedMessage([
|
|
189
|
-
{
|
|
189
|
+
{
|
|
190
|
+
id: 'copyCodeSnippetButton',
|
|
191
|
+
object: 'button',
|
|
192
|
+
uri: 'urn:redocly:redoc:ui:button:copyCodeSnippetButton',
|
|
193
|
+
snippetType: 'copy',
|
|
194
|
+
},
|
|
190
195
|
]);
|
|
191
196
|
}
|
|
192
197
|
}}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export class MockIntersectionObserver {
|
|
2
2
|
public readonly root: Element | Document | null;
|
|
3
3
|
public readonly rootMargin: string;
|
|
4
|
+
public readonly scrollMargin: string;
|
|
4
5
|
public readonly thresholds: ReadonlyArray<number>;
|
|
5
6
|
|
|
6
7
|
private viewPort: Element | Document | Window;
|
|
@@ -12,6 +13,7 @@ export class MockIntersectionObserver {
|
|
|
12
13
|
this.entries = [];
|
|
13
14
|
this.root = null;
|
|
14
15
|
this.rootMargin = '0px';
|
|
16
|
+
this.scrollMargin = '';
|
|
15
17
|
this.thresholds = [1];
|
|
16
18
|
this.callback = callback;
|
|
17
19
|
|
|
@@ -3,6 +3,7 @@ import { vi } from 'vitest';
|
|
|
3
3
|
export class MockIntersectionObserver {
|
|
4
4
|
public readonly root: Element | Document | null;
|
|
5
5
|
public readonly rootMargin: string;
|
|
6
|
+
public readonly scrollMargin: string;
|
|
6
7
|
public readonly thresholds: ReadonlyArray<number>;
|
|
7
8
|
observe: (target: HTMLElement) => void;
|
|
8
9
|
unobserve: (target: HTMLElement) => void;
|
|
@@ -12,6 +13,7 @@ export class MockIntersectionObserver {
|
|
|
12
13
|
constructor(callback: IntersectionObserverCallback, options?: IntersectionObserverInit) {
|
|
13
14
|
this.root = null;
|
|
14
15
|
this.rootMargin = '0px';
|
|
16
|
+
this.scrollMargin = '';
|
|
15
17
|
this.thresholds = [1];
|
|
16
18
|
this.observe = vi.fn();
|
|
17
19
|
this.unobserve = vi.fn();
|
|
@@ -13,10 +13,6 @@ export type BannerTelemetryActions = {
|
|
|
13
13
|
sendBannerLinkClickedMessage: (href: string) => void;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
function getCurrentPageUri(): string {
|
|
17
|
-
return window.location.href;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
export function useBannerTelemetry(
|
|
21
17
|
displayBanner: DisplayBanner | undefined,
|
|
22
18
|
): BannerTelemetryActions {
|
|
@@ -46,20 +42,14 @@ export function useBannerTelemetry(
|
|
|
46
42
|
|
|
47
43
|
return {
|
|
48
44
|
sendBannerViewedMessage: () => {
|
|
49
|
-
|
|
50
|
-
const page = { id: pageUri, object: 'page' as const, uri: pageUri };
|
|
51
|
-
telemetry.sendBannerViewedMessage([payload, page]);
|
|
45
|
+
telemetry.sendBannerViewedMessage([payload]);
|
|
52
46
|
},
|
|
53
47
|
sendBannerDismissedMessage: () => {
|
|
54
|
-
const pageUri = getCurrentPageUri();
|
|
55
|
-
const page = { id: pageUri, object: 'page' as const, uri: pageUri };
|
|
56
48
|
const { dismissible: _, ...dismissedPayload } = payload;
|
|
57
|
-
telemetry.sendBannerDismissedMessage([dismissedPayload
|
|
49
|
+
telemetry.sendBannerDismissedMessage([dismissedPayload]);
|
|
58
50
|
},
|
|
59
51
|
sendBannerLinkClickedMessage: (href: string) => {
|
|
60
|
-
|
|
61
|
-
const page = { id: pageUri, object: 'page' as const, uri: pageUri };
|
|
62
|
-
telemetry.sendBannerLinkClickedMessage([{ ...payload, href }, page]);
|
|
52
|
+
telemetry.sendBannerLinkClickedMessage([{ ...payload, href }]);
|
|
63
53
|
},
|
|
64
54
|
};
|
|
65
55
|
}, [displayBanner, telemetry]);
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import type { Schema, SchemaAttribute } from '@markdoc/markdoc';
|
|
1
|
+
import type { Node, Schema, SchemaAttribute } from '@markdoc/markdoc';
|
|
2
|
+
|
|
3
|
+
export type RenderForLlmsContext = {
|
|
4
|
+
getBody: () => string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type RenderForLlmsFn = (node: Node, context: RenderForLlmsContext) => string;
|
|
8
|
+
|
|
9
|
+
export type MarkdocTagSchema = Schema & {
|
|
10
|
+
attributes?: Record<string, SchemaAttribute & { resolver?: string }>;
|
|
11
|
+
renderForLlms?: RenderForLlmsFn;
|
|
12
|
+
};
|
|
2
13
|
|
|
3
14
|
export type MarkdocSchemaWrapper = {
|
|
4
|
-
schema:
|
|
5
|
-
attributes?: Record<string, SchemaAttribute & { resolver?: string }>;
|
|
6
|
-
};
|
|
15
|
+
schema: MarkdocTagSchema;
|
|
7
16
|
tagName: string;
|
|
8
17
|
};
|