@redocly/api-docs 0.2.0-next.5 → 0.2.0-next.7
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/RedocStandalone.d.ts +38 -0
- package/lib/RedocStandalone.js +1 -0
- package/lib/RedoclyApiDocs.js +1 -1
- package/lib/RedoclyApiDocsStandalone.d.ts +2 -0
- package/lib/RedoclyApiDocsStandalone.js +3 -3
- package/lib/adapters/asyncapi/items/overview/content.js +1 -1
- package/lib/adapters/graphql/group/utils.js +1 -1
- package/lib/adapters/graphql/utils/createApiItem.js +1 -1
- package/lib/adapters/openapi/build-code-sample-source.d.ts +1 -1
- package/lib/adapters/openapi/build-code-sample-source.js +1 -1
- package/lib/adapters/openapi/configure/merge-utils.d.ts +1 -1
- package/lib/adapters/openapi/configure/resolve-request-values.js +1 -1
- package/lib/adapters/openapi/index.js +1 -1
- package/lib/adapters/openapi/items/operation/content.js +1 -1
- package/lib/adapters/openapi/items/operation/item.js +1 -1
- package/lib/adapters/openapi/items/overview/content.js +1 -1
- package/lib/adapters/openapi/utils/merge-mock-server.d.ts +2 -2
- package/lib/adapters/utils/markdoc.d.ts +4 -1
- package/lib/adapters/utils/markdoc.js +1 -1
- package/lib/components/ErrorBoundary.d.ts +4 -2
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/Header/HeaderItem.js +5 -5
- package/lib/components/Header/HeaderPageActions.d.ts +4 -0
- package/lib/components/Header/HeaderPageActions.js +1 -0
- package/lib/components/Header/PageActions.d.ts +4 -0
- package/lib/components/Header/PageActions.js +11 -0
- package/lib/components/ItemContent/sections/MessagesSection.js +1 -1
- package/lib/components/Mcp/McpPrompt.js +1 -1
- package/lib/components/Mcp/McpTool.js +1 -1
- package/lib/components/Mcp/utils.d.ts +1 -1
- package/lib/components/Mcp/utils.js +1 -1
- package/lib/components/Schema/styled.js +4 -4
- package/lib/components/Schema/views/ArrayRenderer.js +1 -1
- package/lib/components/Schema/views/DiscriminatorPropertyRow.js +1 -1
- package/lib/components/Schema/views/Examples.js +1 -1
- package/lib/components/Search/index.d.ts +15 -0
- package/lib/components/Search/index.js +1 -0
- package/lib/components/Security/SecurityFlowDetail.js +1 -1
- package/lib/components/Security/styled.js +7 -7
- package/lib/components/StickySidebar/FloatingButton.d.ts +1 -0
- package/lib/components/StickySidebar/FloatingButton.js +32 -0
- package/lib/components/StickySidebar/RedoclyAttributionLogo.d.ts +5 -0
- package/lib/components/StickySidebar/RedoclyAttributionLogo.js +1 -0
- package/lib/components/StickySidebar/StickySidebar.js +33 -9
- package/lib/components/common/Breadcrumbs.js +2 -2
- package/lib/components/common/ResponseCodeTabs.js +1 -1
- package/lib/components/common/Tag.js +1 -1
- package/lib/components/common/ViewNested.js +2 -2
- package/lib/components/graphql/GraphQLFieldView.js +1 -1
- package/lib/components/graphql/RequiresScopesModal.js +3 -3
- package/lib/components/graphql/sections/GraphQLArgsSection.js +1 -1
- package/lib/components/markdoc/SchemaDefinition.js +1 -1
- package/lib/components/panels/ExampleItem/CodeSampleItem.js +1 -1
- package/lib/components/panels/ExampleItem/ResponseExampleItem.js +1 -1
- package/lib/components/panels/ExampleItem/SecuritySchemeSelector.d.ts +9 -0
- package/lib/components/panels/ExampleItem/SecuritySchemeSelector.js +1 -0
- package/lib/components/panels/ExampleItem/ServerDropdown.js +1 -1
- package/lib/components/panels/ExampleItem/generate-request-sample.d.ts +28 -0
- package/lib/components/panels/ExampleItem/generate-request-sample.js +1 -0
- package/lib/components/panels/ExampleItem/styled.d.ts +1 -49
- package/lib/components/panels/ExampleItem/useActiveServer.d.ts +17 -0
- package/lib/components/panels/ExampleItem/useActiveServer.js +1 -0
- package/lib/components/panels/ExampleItem/useCodeSampleLanguages.d.ts +23 -0
- package/lib/components/panels/ExampleItem/useCodeSampleLanguages.js +1 -0
- package/lib/components/panels/ExampleItem/useReplayRequestState.d.ts +18 -0
- package/lib/components/panels/ExampleItem/useReplayRequestState.js +1 -0
- package/lib/components/panels/ExampleItem/useTryItFooter.d.ts +3 -0
- package/lib/components/panels/ExampleItem/useTryItFooter.js +7 -0
- package/lib/components/panels/GroupPanelItem.js +1 -1
- package/lib/components/panels/LanguageItem/LanguagePanelItem.js +5 -1
- package/lib/components/panels/LanguageItem/styled.js +17 -14
- package/lib/components/panels/McpExamplePanelItem.js +2 -2
- package/lib/components/panels/McpPanelItem.js +2 -2
- package/lib/components/panels/ServerItem/ServerItem.js +1 -1
- package/lib/components/panels/asyncapi/BrokerItem/BrokerModal.js +1 -1
- package/lib/components/panels/asyncapi/BrokerItem/BrokerPanelItem.js +1 -1
- package/lib/components/panels/shared-panel-styles.js +1 -1
- package/lib/components/panels/styled.js +1 -1
- package/lib/components/pluggable/RedocResponseSamples.js +1 -1
- package/lib/hoc/withLicenseGate.d.ts +5 -0
- package/lib/hoc/withLicenseGate.js +1 -0
- package/lib/hoc/withStoreProvider.d.ts +2 -0
- package/lib/hoc/withStoreProvider.js +1 -1
- package/lib/hooks/useCopySpecSlice.d.ts +9 -0
- package/lib/hooks/useCopySpecSlice.js +1 -0
- package/lib/hooks/useInitialTelemetry.d.ts +2 -0
- package/lib/hooks/useInitialTelemetry.js +1 -0
- package/lib/hooks/useLicense.js +1 -1
- package/lib/hooks/useLicenseGate.d.ts +6 -0
- package/lib/hooks/useLicenseGate.js +1 -0
- package/lib/hooks/useScrollSpyUrlSync.js +1 -1
- package/lib/index.d.ts +6 -1
- package/lib/index.js +1 -1
- package/lib/jotai/app.d.ts +6 -0
- package/lib/jotai/app.js +1 -1
- package/lib/jotai/examples.js +1 -1
- package/lib/jotai/store.d.ts +4 -0
- package/lib/jotai/store.js +1 -1
- package/lib/options/editionOverrides.d.ts +3 -0
- package/lib/options/editionOverrides.js +1 -0
- package/lib/options/helpers.d.ts +1 -2
- package/lib/options/helpers.js +1 -1
- package/lib/options/normalizeOptions.d.ts +1 -1
- package/lib/options/normalizeOptions.js +1 -1
- package/lib/options/standaloneLayoutVars.d.ts +3 -0
- package/lib/options/standaloneLayoutVars.js +1 -0
- package/lib/pages/ItemPage.js +4 -2
- package/lib/services/code-samples/apply-env-variables.d.ts +8 -0
- package/lib/services/code-samples/apply-env-variables.js +1 -0
- package/lib/services/code-samples/builder.js +1 -1
- package/lib/services/code-samples/language-availability.d.ts +4 -0
- package/lib/services/code-samples/language-availability.js +1 -0
- package/lib/services/code-samples/{replay/normalize-servers.d.ts → normalize-servers.d.ts} +1 -1
- package/lib/services/code-samples/normalize-servers.js +1 -0
- package/lib/services/code-samples/replay/from-openapi-document.d.ts +8 -1
- package/lib/services/code-samples/replay/from-openapi-document.js +1 -1
- package/lib/services/code-samples/replay/index.d.ts +1 -1
- package/lib/services/code-samples/replay/index.js +1 -1
- package/lib/services/code-samples/replay/replay-predefined-env.d.ts +1 -2
- package/lib/services/code-samples/replay/replay-predefined-env.js +1 -1
- package/lib/services/code-samples/server-env.d.ts +3 -0
- package/lib/services/code-samples/server-env.js +1 -0
- package/lib/services/code-samples/source.d.ts +3 -3
- package/lib/services/license/check.d.ts +1 -0
- package/lib/services/license/check.js +1 -1
- package/lib/services/operation-samples/index.js +1 -1
- package/lib/services/search/indexer.d.ts +9 -0
- package/lib/services/search/indexer.js +1 -0
- package/lib/services/search/types.d.ts +27 -0
- package/lib/services/search/types.js +0 -0
- package/lib/services/spec-slice/assistant-links.d.ts +9 -0
- package/lib/services/spec-slice/assistant-links.js +5 -0
- package/lib/services/spec-slice/asyncapi-slice.d.ts +5 -0
- package/lib/services/spec-slice/asyncapi-slice.js +1 -0
- package/lib/services/spec-slice/clone-strip.d.ts +1 -0
- package/lib/services/spec-slice/clone-strip.js +1 -0
- package/lib/services/spec-slice/component-closure.d.ts +6 -0
- package/lib/services/spec-slice/component-closure.js +1 -0
- package/lib/services/spec-slice/graphql-slice.d.ts +2 -0
- package/lib/services/spec-slice/graphql-slice.js +1 -0
- package/lib/services/spec-slice/index.d.ts +6 -0
- package/lib/services/spec-slice/index.js +1 -0
- package/lib/services/spec-slice/openapi-slice.d.ts +6 -0
- package/lib/services/spec-slice/openapi-slice.js +1 -0
- package/lib/services/spec-slice/resolve-scope.d.ts +4 -0
- package/lib/services/spec-slice/resolve-scope.js +1 -0
- package/lib/services/spec-slice/types.d.ts +37 -0
- package/lib/services/spec-slice/types.js +0 -0
- package/lib/standalone.d.ts +19 -0
- package/lib/standalone.js +2 -0
- package/lib/standaloneThemeConfig.d.ts +3 -0
- package/lib/standaloneThemeConfig.js +1 -0
- package/lib/telemetry/RedocTelemetry.d.ts +3 -0
- package/lib/telemetry/RedocTelemetry.js +1 -1
- package/lib/telemetry/defaults.d.ts +2 -0
- package/lib/telemetry/defaults.js +1 -0
- package/lib/types/code-samples-config.d.ts +68 -0
- package/lib/types/code-samples-config.js +0 -0
- package/lib/types/common.d.ts +1 -1
- package/lib/types/content.d.ts +4 -3
- package/lib/types/edition-config.d.ts +4 -0
- package/lib/types/edition-config.js +0 -0
- package/lib/types/events.d.ts +2 -2
- package/lib/types/openapi.d.ts +2 -1
- package/lib/types/options.d.ts +24 -88
- package/lib/utils/compose.d.ts +1 -0
- package/lib/utils/deep-link.d.ts +1 -0
- package/lib/utils/deep-link.js +1 -1
- package/lib/utils/extract-extensions.js +1 -1
- package/lib/utils/x-logo.d.ts +13 -0
- package/lib/utils/x-logo.js +1 -0
- package/package.json +19 -8
- package/lib/services/code-samples/replay/normalize-servers.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as i,jsxs as p}from"react/jsx-runtime";import{useCallback as f,useEffect as P,useMemo as g}from"react";import{useAtom as $,useAtomValue as h}from"jotai";import{styled as S}from"styled-components";import{getOperationColor as D}from"@redocly/theme/core/openapi";import{breakpoints as M}from"@redocly/theme/core/openapi";import{Dropdown as V}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as W}from"@redocly/theme/components/Dropdown/DropdownMenu";import{DropdownMenuItem as B}from"@redocly/theme/components/Dropdown/DropdownMenuItem";import{CopyButton as I}from"@redocly/theme/components/Buttons/CopyButton";import{environmentAtom as L,savedEnvironmentNameAtom as O}from"../../../jotai/app.js";import{resolveServerUrl as w}from"../../../services/code-samples/
|
|
1
|
+
import{jsx as i,jsxs as p}from"react/jsx-runtime";import{useCallback as f,useEffect as P,useMemo as g}from"react";import{useAtom as $,useAtomValue as h}from"jotai";import{styled as S}from"styled-components";import{getOperationColor as D}from"@redocly/theme/core/openapi";import{breakpoints as M}from"@redocly/theme/core/openapi";import{Dropdown as V}from"@redocly/theme/components/Dropdown/Dropdown";import{DropdownMenu as W}from"@redocly/theme/components/Dropdown/DropdownMenu";import{DropdownMenuItem as B}from"@redocly/theme/components/Dropdown/DropdownMenuItem";import{CopyButton as I}from"@redocly/theme/components/Buttons/CopyButton";import{environmentAtom as L,savedEnvironmentNameAtom as O}from"../../../jotai/app.js";import{resolveServerUrl as w}from"../../../services/code-samples/normalize-servers.js";import{replaceServerVariables as q}from"../../../services/code-samples/server-variables.js";import{getServerEnvName as T}from"../../../utils/environments.js";import{globalOptionsAtom as _}from"../../../jotai/store.js";import{useTelemetry as H}from"../../../hooks/useTelemetry.js";import{createTargetServerSwitchEvent as R}from"../../../events/serverSwitch.js";import{PanelItem as z}from"../../common/PanelItem.js";import{HttpVerb as U,PathLabel as C,PathWrapper as F,StaticPathWrapper as G}from"./styled.js";function J(o="",n="",t="/"){return o.endsWith(t)&&o!==t&&(o=o.slice(0,-t.length)),n.startsWith(t)&&(n=n.slice(t.length)),!o||!n||o===t?o+n:o+t+n}const K=S(B)`
|
|
2
2
|
padding: calc(var(--spacing-unit) * 1.5) var(--spacing-xs) calc(var(--spacing-unit) * 1.5)
|
|
3
3
|
var(--spacing-lg);
|
|
4
4
|
@media screen and (max-width: ${M.large}) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CodeSampleSource } from '../../../services/code-samples/index.js';
|
|
2
|
+
import type { HARBuildResolvers, HARBuildSelections } from '../../../services/code-samples/index.js';
|
|
3
|
+
import type { ApiDocsOptions } from '../../../types/options.js';
|
|
4
|
+
type GenerateRequestSampleParams = {
|
|
5
|
+
source: CodeSampleSource;
|
|
6
|
+
activeLanguage: string;
|
|
7
|
+
serverUrl: string | undefined;
|
|
8
|
+
/** Raw (templated) spec URL of the active server — keys the env-variable overrides. */
|
|
9
|
+
activeServerSpecUrl: string | undefined;
|
|
10
|
+
mediaType: string | undefined;
|
|
11
|
+
environment: HARBuildSelections['environment'];
|
|
12
|
+
harRequestValues: HARBuildSelections['requestValues'];
|
|
13
|
+
securityGroups: CodeSampleSource['securityGroups'];
|
|
14
|
+
securityIdx: number;
|
|
15
|
+
replayBody: unknown;
|
|
16
|
+
exampleName: string | undefined;
|
|
17
|
+
options: ApiDocsOptions;
|
|
18
|
+
resolvers: HARBuildResolvers;
|
|
19
|
+
translate: (key: string, fallback: string) => string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Builds the generated (non-`x-codeSamples`) request sample for the active
|
|
23
|
+
* language. Excluded from the community edition — only spec-provided samples
|
|
24
|
+
* and the payload view render there. Returns `undefined` for languages
|
|
25
|
+
* without a generator.
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateRequestSample({ source, activeLanguage, serverUrl, activeServerSpecUrl, mediaType, environment, harRequestValues, securityGroups, securityIdx, replayBody, exampleName, options, resolvers, translate, }: GenerateRequestSampleParams): string | undefined;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getGeneratorKey as C}from"../../../utils/languages.js";import{buildCodeSampleHAR as O,tryGenerateCodeSample as y}from"../../../services/code-samples/index.js";import{applyEnvVariables as b}from"../../../services/code-samples/apply-env-variables.js";function P({source:l,activeLanguage:n,serverUrl:o,activeServerSpecUrl:d,mediaType:m,environment:p,harRequestValues:i,securityGroups:e,securityIdx:s,replayBody:u,exampleName:S,options:a,resolvers:c,translate:f}){const h=e?.length?Object.keys(e.length>1?e[s]??e[0]:e[0]):void 0,g=O(l,{serverUrl:o,mediaType:m,environment:p,requestValues:i,activeSecuritySchemeIds:h,replayBody:u,exampleName:S},{skipOptionalParameters:a.codeSamples?.skipOptionalParameters,withOAuth2Call:a.codeSamples?.withOAuth2Call,generatedPayloadSamplesMaxDepth:a.generatedSamplesMaxDepth},c),r=a.codeSamples?.languages?.find(k=>k.key===n),t=y(r?C(r):n,g,r?.options);if(t.kind!=="unsupported-language")return t.kind==="error"?(console.error(t.error),`// ${f("failedToGenerateCodeSample","Failed to generate code sample.")}`):b(t.source,l.requestValues,d)}export{P as generateRequestSample};
|
|
@@ -21,55 +21,7 @@ export declare const PathLabel: import("styled-components/dist/types").IStyledCo
|
|
|
21
21
|
export declare const ResponsePanelHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
22
22
|
export declare const MediaTypeRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
23
23
|
export declare const DisabledMimeSelect: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, never>>> & string;
|
|
24
|
-
export declare const StyledSelectDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<{
|
|
25
|
-
trigger: React.ReactNode;
|
|
26
|
-
triggerEvent?: 'click' | 'hover';
|
|
27
|
-
placement?: 'top' | 'bottom';
|
|
28
|
-
alignment?: 'start' | 'end';
|
|
29
|
-
active?: boolean;
|
|
30
|
-
closeOnClick?: boolean;
|
|
31
|
-
dataAttributes?: Record<string, string>;
|
|
32
|
-
className?: string;
|
|
33
|
-
withArrow?: boolean;
|
|
34
|
-
portalled?: boolean;
|
|
35
|
-
onClick?: (event: React.UIEvent) => void;
|
|
36
|
-
onClose?: () => void;
|
|
37
|
-
onOpen?: () => void;
|
|
38
|
-
} & {
|
|
39
|
-
children?: React.ReactNode | undefined;
|
|
40
|
-
} & import("react").RefAttributes<HTMLDivElement>, never> & Partial<Pick<{
|
|
41
|
-
trigger: React.ReactNode;
|
|
42
|
-
triggerEvent?: 'click' | 'hover';
|
|
43
|
-
placement?: 'top' | 'bottom';
|
|
44
|
-
alignment?: 'start' | 'end';
|
|
45
|
-
active?: boolean;
|
|
46
|
-
closeOnClick?: boolean;
|
|
47
|
-
dataAttributes?: Record<string, string>;
|
|
48
|
-
className?: string;
|
|
49
|
-
withArrow?: boolean;
|
|
50
|
-
portalled?: boolean;
|
|
51
|
-
onClick?: (event: React.UIEvent) => void;
|
|
52
|
-
onClose?: () => void;
|
|
53
|
-
onOpen?: () => void;
|
|
54
|
-
} & {
|
|
55
|
-
children?: React.ReactNode | undefined;
|
|
56
|
-
} & import("react").RefAttributes<HTMLDivElement>, never>>> & string & Omit<import("react").ForwardRefExoticComponent<{
|
|
57
|
-
trigger: React.ReactNode;
|
|
58
|
-
triggerEvent?: 'click' | 'hover';
|
|
59
|
-
placement?: 'top' | 'bottom';
|
|
60
|
-
alignment?: 'start' | 'end';
|
|
61
|
-
active?: boolean;
|
|
62
|
-
closeOnClick?: boolean;
|
|
63
|
-
dataAttributes?: Record<string, string>;
|
|
64
|
-
className?: string;
|
|
65
|
-
withArrow?: boolean;
|
|
66
|
-
portalled?: boolean;
|
|
67
|
-
onClick?: (event: React.UIEvent) => void;
|
|
68
|
-
onClose?: () => void;
|
|
69
|
-
onOpen?: () => void;
|
|
70
|
-
} & {
|
|
71
|
-
children?: React.ReactNode | undefined;
|
|
72
|
-
} & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
|
24
|
+
export declare const StyledSelectDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@redocly/theme").DropdownProps & import("react").RefAttributes<HTMLDivElement>, never> & Partial<Pick<import("@redocly/theme").DropdownProps & import("react").RefAttributes<HTMLDivElement>, never>>> & string & Omit<import("react").ForwardRefExoticComponent<import("@redocly/theme").DropdownProps & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
|
73
25
|
export declare const SelectDropdownMenu: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@redocly/theme").DropdownMenuProps & import("styled-components/dist/types").BaseObject, never> & Partial<Pick<import("@redocly/theme").DropdownMenuProps & import("styled-components/dist/types").BaseObject, never>>> & string & Omit<typeof DropdownMenu, keyof import("react").Component<any, {}, any>>;
|
|
74
26
|
export declare const SelectDropdownMenuItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Partial<Pick<import("@redocly/theme").LinkProps, "external" | "target" | "to">> & {
|
|
75
27
|
prefix?: import("react").ReactNode;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CodeSamplePanelItem } from '../../../types/content.js';
|
|
2
|
+
type ActiveServer = {
|
|
3
|
+
/** Environment atom value — the first entry holds the active env variables. */
|
|
4
|
+
environment: [Record<string, string>, string];
|
|
5
|
+
/** Variable-substituted URL of the active server. */
|
|
6
|
+
url: string | undefined;
|
|
7
|
+
/** Raw (templated) spec URL — keys `requestValues.serverBody`/`serverEnvVariables`. */
|
|
8
|
+
specUrl: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The active server for the code-sample panel.
|
|
12
|
+
* `requestValues.serverBody`/`serverEnvVariables` are keyed by the raw
|
|
13
|
+
* (templated) spec server URL, while the environment may hold the
|
|
14
|
+
* variable-substituted URL — keep both forms of the active server.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useActiveServer(node: CodeSamplePanelItem): ActiveServer;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as c}from"react";import{useAtomValue as l}from"jotai";import{environmentAtom as v}from"../../../jotai/app.js";import{replaceServerVariables as m,serverMatchesUrl as i}from"../../../services/code-samples/server-variables.js";function A(e){const t=e.source,r=l(v);return c(()=>{const s=r[0].server,u=s?e.servers?.find(n=>i(n,s)):void 0;if(s&&u)return{environment:r,url:s,specUrl:u.url};const o=e.servers?.[0];return o?{environment:r,url:m(o),specUrl:o.url}:{environment:r,url:t.servers[0]?.url,specUrl:t.servers[0]?.url}},[r,e.servers,t.servers])}export{A as useActiveServer};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CodeSamplePanelItem } from '../../../types/content.js';
|
|
2
|
+
export declare const PAYLOAD_LANGUAGE: import("../../../index.js").Language;
|
|
3
|
+
export declare const WEBHOOK_LANGUAGE_SAMPLES: {
|
|
4
|
+
key: string;
|
|
5
|
+
lang: string;
|
|
6
|
+
title: string;
|
|
7
|
+
}[];
|
|
8
|
+
type LanguageTab = {
|
|
9
|
+
key: string;
|
|
10
|
+
lang: string;
|
|
11
|
+
title: string;
|
|
12
|
+
};
|
|
13
|
+
type CodeSampleLanguages = {
|
|
14
|
+
/** Language tabs offered for this panel. */
|
|
15
|
+
languages: LanguageTab[];
|
|
16
|
+
/** `x-codeSamples` limited to the configured languages. */
|
|
17
|
+
filteredDefinitionSamples: CodeSamplePanelItem['definitionSamples'];
|
|
18
|
+
activeLanguage: string;
|
|
19
|
+
setLanguage: (key: string) => void;
|
|
20
|
+
};
|
|
21
|
+
/** Which language tabs the code-sample panel offers and which one is active. */
|
|
22
|
+
export declare function useCodeSampleLanguages(node: CodeSamplePanelItem, hasPayloadData: boolean): CodeSampleLanguages;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as c}from"react";import{useAtom as b}from"jotai";import{filterAvailableLanguages as E}from"../../../services/code-samples/language-availability.js";import{DEFAULT_LANGUAGES as A,getLangKey as y}from"../../../utils/languages.js";import{languageAtom as h}from"../../../jotai/app.js";const l=A.find(n=>n.key==="payload")??A[0],f={key:l.key,lang:l.lang,title:l.label},O=[f];function W(n,u){const[{activeLanguage:L,languages:o},k]=b(h),r=n.isWebhook?"payload":L||"curl",i=n.definitionSamples,s=c(()=>{if(!i?.length)return i;const a=new Set((o??[]).map(t=>t.key));return i.filter(t=>a.has(y(t)))},[i,o]),g=c(()=>{const a=(o??[]).map(({key:e,lang:S,title:G})=>({key:e,lang:S,title:G}));let t=u?a:a.filter(e=>e.key!=="payload");const m=new Set(s?.map(e=>y(e))??[]);n.isWebhook&&(t=t.filter(e=>e.key==="payload"||m.has(e.key)));const p=E(t,m);return p.length?p:[a.find(e=>e.key===f.key)??f]},[u,o,n.isWebhook,s]),d=g.some(a=>a.key===r)?r:g[0]?.key??r;return{languages:g,filteredDefinitionSamples:s,activeLanguage:d,setLanguage:k}}export{l as PAYLOAD_LANGUAGE,O as WEBHOOK_LANGUAGE_SAMPLES,W as useCodeSampleLanguages};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CodeSampleSource } from '../../../services/code-samples/index.js';
|
|
2
|
+
import type { HARBuildResolvers, HARBuildSelections } from '../../../services/code-samples/index.js';
|
|
3
|
+
type ReplayRequestState = {
|
|
4
|
+
/** Raw body the user edited in Replay — feeds sample generation. */
|
|
5
|
+
body: unknown;
|
|
6
|
+
/** Replay body parsed for PayloadDisplay (JSON strings become objects). */
|
|
7
|
+
displayBody: unknown;
|
|
8
|
+
/** Example the user selected in Replay. */
|
|
9
|
+
exampleName: string | undefined;
|
|
10
|
+
harRequestValues: HARBuildSelections['requestValues'];
|
|
11
|
+
resolvers: HARBuildResolvers;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Request values the user edited in Replay (Try It) for this operation.
|
|
15
|
+
* Excluded from the community edition.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useReplayRequestState(source: CodeSampleSource): ReplayRequestState;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as m}from"react";import{useAtomValue as p}from"jotai";import{requestValuesAtom as c}from"../../../jotai/app.js";import{mapReplayAtomValuesToHarRequestValues as y,useCodeSampleResolvers as f}from"../../../services/code-samples/index.js";function x(e){const s=p(c),t=f(),i=`${e.method.toLowerCase()}:${e.path}`,r=s[i],a=m(()=>{const l=y(r??{});return e.requestValues?.security?{...l,security:e.requestValues.security}:l},[r,e.requestValues?.security]),o=r?.body,u=r?.activeExampleName,n=typeof u=="string"?u:void 0;return m(()=>({body:o,displayBody:V(o),exampleName:n,harRequestValues:a,resolvers:t}),[o,n,a,t])}function V(e){if(typeof e!="string")return e;const s=e.trim();if(!s)return e;try{const t=JSON.parse(s);if(t!==null&&typeof t=="object")return t}catch{}return e}export{x as useReplayRequestState};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useMemo as n}from"react";import{useAtomValue as p}from"jotai";import{styled as a}from"styled-components";import{globalOptionsAtom as s}from"../../../jotai/store.js";import{useOpenApiDefinition as l}from"../../../hoc/withReplayPrefetch.js";import{pickReplayDefinitionDownloadUrl as m}from"../../../utils/fetch-openapi-definition.js";import{Replay as d}from"../../Replay/index.js";function A(o){const e=p(s),t=l(),i=!(e.hideReplay||o.hideReplay)&&!o.isWebhook&&!!(t??m(e.downloadUrls));return n(()=>i?r(f,{children:r(d,{node:o})}):void 0,[i,o])}const f=a.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: flex-end;
|
|
4
|
+
align-items: center;
|
|
5
|
+
border-top: var(--panel-border);
|
|
6
|
+
padding: var(--spacing-xs) var(--spacing-md) var(--spacing-sm) var(--spacing-md);
|
|
7
|
+
`;export{A as useTryItFooter};
|
|
@@ -53,7 +53,7 @@ import{Fragment as G,jsx as t,jsxs as l}from"react/jsx-runtime";import{styled as
|
|
|
53
53
|
margin-left: 0;
|
|
54
54
|
}
|
|
55
55
|
`,S=o(z)`
|
|
56
|
-
border-radius: var(--border-radius);
|
|
56
|
+
border-radius: var(--border-radius-lg);
|
|
57
57
|
background: var(--bg-color);
|
|
58
58
|
justify-content: space-between;
|
|
59
59
|
width: 100%;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import{jsx as s}from"react/jsx-runtime";import{useEffect as
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{useEffect as g}from"react";import{useAtom as c}from"jotai";import{styled as f}from"styled-components";import{useSpecTranslate as u}from"../../../hooks/useTranslate.js";import{resolveText as d}from"../../../utils/resolveText.js";import{languageAtom as y}from"../../../jotai/app.js";import{OverviewPanel as L}from"../styled.js";import{LanguageList as v}from"./LanguageList.js";function b({node:t}){const i=t.children[0],m=u(),l=i?.options??[],[{activeLanguage:a},o]=c(y),r=l.map(n=>({title:n.title,key:n.key,lang:n.lang})),e=r[0]?.key;g(()=>{!a&&e&&o(e)},[a,e,o]);const p=d(m,t.titleTranslationKey,t.title);return s(x,{header:p,className:"panel-api-docs",isExpandable:!1,children:s(v,{languages:r,activeLanguage:a||e})})}const x=f(L)`
|
|
2
|
+
[data-component-name='Panel/PanelBody'] {
|
|
3
|
+
padding-top: 0;
|
|
4
|
+
}
|
|
5
|
+
`;export{b as LanguagePanelItem};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import{styled as t,css as
|
|
1
|
+
import{styled as t,css as n}from"styled-components";import{Button as r}from"@redocly/theme/components/Button/Button";import{DropdownMenu as o}from"@redocly/theme/components/Dropdown/DropdownMenu";import{DropdownMenuItem as a}from"@redocly/theme/components/Dropdown/DropdownMenuItem";import{ITEM_WIDTH as s}from"./constants.js";const i="var(--spacing-unit)",f=t(o)`
|
|
2
2
|
position: absolute;
|
|
3
3
|
right: 0;
|
|
4
|
-
`,
|
|
4
|
+
`,u=t.span`
|
|
5
5
|
display: flex;
|
|
6
6
|
justify-content: space-between;
|
|
7
7
|
align-items: center;
|
|
8
|
+
padding-top: ${i};
|
|
8
9
|
`,x=t.span`
|
|
9
10
|
max-width: 150px;
|
|
10
11
|
text-overflow: ellipsis;
|
|
@@ -14,14 +15,14 @@ import{styled as t,css as i}from"styled-components";import{Button as n}from"@red
|
|
|
14
15
|
font-size: var(--font-size-base);
|
|
15
16
|
line-height: var(--line-height-base);
|
|
16
17
|
font-weight: ${({$active:e})=>e?"var(--font-weight-medium)":"var(--font-weight-regular)"};
|
|
17
|
-
`,
|
|
18
|
+
`,l=t.span`
|
|
18
19
|
width: 100%;
|
|
19
20
|
display: inherit;
|
|
20
21
|
gap: inherit;
|
|
21
22
|
flex-direction: inherit;
|
|
22
23
|
justify-content: inherit;
|
|
23
24
|
align-items: inherit;
|
|
24
|
-
`,
|
|
25
|
+
`,v=t.span`
|
|
25
26
|
width: 24px;
|
|
26
27
|
height: 24px;
|
|
27
28
|
display: flex;
|
|
@@ -29,15 +30,15 @@ import{styled as t,css as i}from"styled-components";import{Button as n}from"@red
|
|
|
29
30
|
justify-content: center;
|
|
30
31
|
flex-shrink: 0;
|
|
31
32
|
overflow: hidden;
|
|
32
|
-
`,
|
|
33
|
+
`,m=t.div`
|
|
33
34
|
display: flex;
|
|
34
35
|
justify-content: ${({$justifyContent:e="start"})=>e};
|
|
35
36
|
align-items: center;
|
|
36
37
|
width: 100%;
|
|
37
|
-
`,
|
|
38
|
+
`,w=t.button`
|
|
38
39
|
background: none;
|
|
39
40
|
border: none;
|
|
40
|
-
width: ${
|
|
41
|
+
width: ${s}px;
|
|
41
42
|
flex-shrink: 0;
|
|
42
43
|
display: flex;
|
|
43
44
|
align-items: center;
|
|
@@ -52,12 +53,14 @@ import{styled as t,css as i}from"styled-components";import{Button as n}from"@red
|
|
|
52
53
|
|
|
53
54
|
&:hover {
|
|
54
55
|
color: var(--text-color-primary);
|
|
56
|
+
background-color: var(--layer-color-hover);
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
${({$active:e})=>e&&
|
|
59
|
+
${({$active:e})=>e&&n`
|
|
58
60
|
&::before {
|
|
59
61
|
position: absolute;
|
|
60
|
-
top: calc(-1 *
|
|
62
|
+
top: calc(-1 * ${i} - 1px);
|
|
63
|
+
left: 0;
|
|
61
64
|
border-top: 3px solid var(--text-color-primary);
|
|
62
65
|
width: 100%;
|
|
63
66
|
content: '';
|
|
@@ -65,7 +68,7 @@ import{styled as t,css as i}from"styled-components";import{Button as n}from"@red
|
|
|
65
68
|
border-bottom-right-radius: calc(var(--border-radius) / 2);
|
|
66
69
|
}
|
|
67
70
|
`}
|
|
68
|
-
`,
|
|
71
|
+
`,b=t(a)`
|
|
69
72
|
display: flex;
|
|
70
73
|
justify-content: space-between;
|
|
71
74
|
align-items: center;
|
|
@@ -75,22 +78,22 @@ import{styled as t,css as i}from"styled-components";import{Button as n}from"@red
|
|
|
75
78
|
width: ${({$width:e=204})=>e}px;
|
|
76
79
|
fill: var(--menu-content-color-active);
|
|
77
80
|
|
|
78
|
-
${
|
|
81
|
+
${l} {
|
|
79
82
|
width: auto;
|
|
80
83
|
justify-content: flex-start;
|
|
81
84
|
}
|
|
82
|
-
`,
|
|
85
|
+
`,y=t(r)`
|
|
83
86
|
display: inline-flex;
|
|
84
87
|
|
|
85
88
|
line-height: var(--line-height-base);
|
|
86
89
|
font-size: var(--font-size-base);
|
|
87
90
|
font-weight: var(--font-weight-medium);
|
|
88
91
|
cursor: pointer;
|
|
89
|
-
`,
|
|
92
|
+
`,L=t.span`
|
|
90
93
|
display: inline-flex;
|
|
91
94
|
align-items: center;
|
|
92
95
|
line-height: var(--line-height-base);
|
|
93
96
|
font-size: var(--font-size-base);
|
|
94
97
|
font-weight: var(--font-weight-regular);
|
|
95
98
|
color: var(--text-color-secondary);
|
|
96
|
-
`;export{
|
|
99
|
+
`;export{u as Container,y as DropdownTriggerButton,v as LanguageIcon,m as LanguageListContainer,w as LanguageListItem,x as LanguageTitle,l as LanguageTitleContainer,f as RightAlignedDropdownMenu,L as StaticLanguageLabel,b as StyledDropdownMenuItem};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as r,jsx as a}from"react/jsx-runtime";import{styled as t}from"styled-components";import{CodeBlock as l}from"@redocly/theme/components/CodeBlock/CodeBlock";import{useSpecTranslate as s}from"../../hooks/useTranslate.js";import{CodeBlockPanel as m,StyledJsonViewer as c}from"./styled.js";const i={"openapi.mcp.inputExample":"Input example","openapi.mcp.outputExample":"Output example","openapi.mcp.argumentsExample":"Arguments example","openapi.mcp.exampleTitle":"Resource content"},d=t(l)`
|
|
2
2
|
border: none;
|
|
3
3
|
padding: 0 8px;
|
|
4
4
|
margin-bottom: 0;
|
|
5
5
|
--code-block-padding: var(--spacing-xs) 0 var(--spacing-xs) var(--spacing-sm);
|
|
6
|
-
`;function
|
|
6
|
+
`;function I({node:n}){const p=s();return a(r,{children:n.children.map((e,o)=>a(m,{className:"panel-response-samples",header:p(e.headerTitleTranslationKey,i[e.headerTitleTranslationKey]),isExpandable:!1,children:e.language?a(d,{source:String(e.data),header:{title:e.language,controls:{copy:{}}}}):a(c,{data:e.data,expandLevel:Number.POSITIVE_INFINITY})},o))})}export{I as McpExamplePanelItem};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as n,jsxs as s}from"react/jsx-runtime";import{styled as a}from"styled-components";import{memo as
|
|
1
|
+
import{jsx as n,jsxs as s}from"react/jsx-runtime";import{styled as a}from"styled-components";import{memo as g}from"react";import{PageActions as v}from"@redocly/theme/components/PageActions/PageActions";import{panelKind as o}from"../../types/common.js";import{useSpecTranslate as u}from"../../hooks/useTranslate.js";import{resolveText as d}from"../../utils/resolveText.js";import{OverviewPanel as m}from"./styled.js";function K({node:e}){const r=e,l=u(),i=r.children,c=d(l,e.titleTranslationKey,e.title);return n(m,{header:c,className:"panel-api-docs",isExpandable:!1,children:n(y,{children:i.map((t,h)=>n(b,{item:t,translate:l},x(t,h)))})})}function x(e,r){return e.kind===o.ATTRIBUTE?`${e.label}-${r}`:e.kind===o.TAGS?`${e.title||"tags"}-${r}`:e.kind===o.EXTERNAL_LINK?`${e.url}-${r}`:e.kind===o.CONNECT_MCP_BUTTON?`${e.mcpUrl}-${r}`:`mcp-item-${r}`}const b=g(function({item:r,translate:l}){const i=d(l,r.titleTranslationKey,r.title),c="label"in r?d(l,r.labelTranslationKey,r.label):"";return r.kind===o.ATTRIBUTE?s(p,{children:[n(f,{children:r.title||c}),n(k,{children:r.value})]}):r.kind===o.TAGS?s(p,{children:[n(f,{children:i||"Tags"}),n(P,{children:r.tags.map(t=>s(w,{variant:t.color==="green"?"success":void 0,children:[t.icon==="checkmark"&&n(T,{})," ",t.text]},t.text))})]}):r.kind===o.EXTERNAL_LINK?s(p,{children:[n(f,{children:i||"Link"}),n($,{href:r.url,target:"_blank",rel:"noopener noreferrer",children:r.label})]}):r.kind===o.CONNECT_MCP_BUTTON?n(N,{children:n(v,{actions:r.actions,mcpUrl:r.mcpUrl})}):null});function T(){return n("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:n("polyline",{points:"20 6 9 17 4 12"})})}const y=a.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: var(--spacing-sm);
|
|
@@ -29,7 +29,7 @@ import{jsx as n,jsxs as s}from"react/jsx-runtime";import{styled as a}from"styled
|
|
|
29
29
|
font-size: var(--font-size-sm);
|
|
30
30
|
line-height: var(--line-height-sm);
|
|
31
31
|
padding: 0 var(--spacing-xxs);
|
|
32
|
-
border-radius: var(--border-radius);
|
|
32
|
+
border-radius: var(--tag-border-radius);
|
|
33
33
|
font-family: var(--font-family-monospaced);
|
|
34
34
|
background: ${({variant:e})=>e==="success"?"var(--badge-ok-bg-color, var(--tag-bg-color))":"var(--tag-bg-color, var(--border-color-secondary))"};
|
|
35
35
|
color: ${({variant:e})=>e==="success"?"var(--badge-ok-text-color, var(--text-color-secondary))":"var(--text-color-secondary)"};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as i,jsxs as t}from"react/jsx-runtime";import{styled as o}from"styled-components";import{CopyButton as f}from"@redocly/theme/components/Buttons/CopyButton";import{PanelItem as x,PanelItemDescription as b,Title as v,ServerTitleWrapper as u,TitleWrap as y}from"../../common/PanelItem.js";import{Tag as h}from"../../common/Tag.js";import{useSpecTranslate as w}from"../../../hooks/useTranslate.js";import{Markdown as S}from"../../common/Markdown.js";import{ViewNested as T}from"../../common/ViewNested.js";import{ServerDescriptionTooltip as D}from"./ServerDescriptionTooltip.js";import{resolveServerUrl as j}from"../../../services/code-samples/
|
|
1
|
+
import{jsx as i,jsxs as t}from"react/jsx-runtime";import{styled as o}from"styled-components";import{CopyButton as f}from"@redocly/theme/components/Buttons/CopyButton";import{PanelItem as x,PanelItemDescription as b,Title as v,ServerTitleWrapper as u,TitleWrap as y}from"../../common/PanelItem.js";import{Tag as h}from"../../common/Tag.js";import{useSpecTranslate as w}from"../../../hooks/useTranslate.js";import{Markdown as S}from"../../common/Markdown.js";import{ViewNested as T}from"../../common/ViewNested.js";import{ServerDescriptionTooltip as D}from"./ServerDescriptionTooltip.js";import{resolveServerUrl as j}from"../../../services/code-samples/normalize-servers.js";function U({server:e}){const n=w(),a=j(e.url),p=Object.keys(e.variables||{}).length,l=p===1?"variable":"variables",d=`${p||""} ${n(l,l)}`,g=!!e.name&&!!e.description;return t(x,{children:[t(u,{children:[i(b,{"data-testid":"server-panel-item-name",children:e.name||e.description}),g&&i(D,{description:e.description})]}),t(y,{children:[i(v,{suppressHydrationWarning:!0,children:a}),i(f,{data:a},a)]}),e.variables&&i(T,{expandText:`${n("actions.show","Show")} ${d}`,hideText:`${n("actions.hide","Hide")} ${d}`,expandByDefault:!1,expandable:!0,hideDivider:!0,children:i($,{children:Object.entries(e.variables||{}).map(([c,r])=>t(z,{children:[i(k,{children:c}),t(s,{children:[n("default","Default")," ",i(h,{className:"tag-grey",children:r.default})]}),r.description&&(typeof r.description=="string"?i("div",{children:r.description}):i(W,{source:r.description})),r.enum&&t(s,{children:[n("enum","Enum")," ",i(C,{children:r.enum.map(m=>i(h,{className:"tag-grey",children:m},m))})]})]},c))})})]},e.url)}const $=o.div`
|
|
2
2
|
padding-left: var(--spacing-xxs);
|
|
3
3
|
& > div {
|
|
4
4
|
border-bottom: 1px solid var(--border-color-secondary);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as o,jsxs as i}from"react/jsx-runtime";import{styled as e}from"styled-components";import{useState as d,useRef as m}from"react";import{Button as g}from"@redocly/theme/components/Button/Button";import{Typography as f}from"@redocly/theme/components/Typography/Typography";import{Segmented as h}from"@redocly/theme/components/Segmented/Segmented";import{CloseIcon as v}from"@redocly/theme/icons/CloseIcon/CloseIcon";import{DatabaseIcon as u}from"@redocly/theme/icons/DatabaseIcon/DatabaseIcon";import{KafkaIcon as x}from"@redocly/theme/icons/KafkaIcon/KafkaIcon";import{RabbitMQIcon as b}from"@redocly/theme/icons/RabbitMQIcon/RabbitMQIcon";import{useOutsideClick as k}from"@redocly/theme/core/hooks";import{useFocusTrap as w}from"@redocly/theme/core/
|
|
1
|
+
import{jsx as o,jsxs as i}from"react/jsx-runtime";import{styled as e}from"styled-components";import{useState as d,useRef as m}from"react";import{Button as g}from"@redocly/theme/components/Button/Button";import{Typography as f}from"@redocly/theme/components/Typography/Typography";import{Segmented as h}from"@redocly/theme/components/Segmented/Segmented";import{CloseIcon as v}from"@redocly/theme/icons/CloseIcon/CloseIcon";import{DatabaseIcon as u}from"@redocly/theme/icons/DatabaseIcon/DatabaseIcon";import{KafkaIcon as x}from"@redocly/theme/icons/KafkaIcon/KafkaIcon";import{RabbitMQIcon as b}from"@redocly/theme/icons/RabbitMQIcon/RabbitMQIcon";import{useOutsideClick as k}from"@redocly/theme/core/hooks";import{useFocusTrap as w}from"@redocly/theme/core/openapi";import{BrokerOverviewSection as B}from"./BrokerOverviewSection.js";import{BrokerBindingsSection as z}from"./BrokerBindingsSection.js";const y=[{label:"Overview",value:0}],S=({protocol:t})=>{switch(t){case"kafka":return o(x,{size:"24px"});case"amqp":return o(b,{size:"24px"});default:return o(u,{size:"24px"})}},A=({broker:t,onClose:n,panelLabel:l})=>{const[r,p]=d(0),a=m(null);k(a,n),w(a);const s=[...y];return t.bindings&&s.push({label:"Configuration",value:2}),o(I,{"data-component-name":"BrokerModal/BrokerModal",children:i(C,{ref:a,tabIndex:0,children:[o(M,{onClick:n,"data-testid":"close",variant:"ghost",icon:o(v,{})}),i(O,{children:[o(S,{protocol:t.protocol||""}),o(T,{children:t.protocol}),": ",t.name]}),o(h,{value:r,onChange:({value:c})=>p(c),options:s}),i(j,{children:[r===0&&o(B,{broker:t}),r===2&&o(z,{broker:t,panelLabel:l})]})]})})},I=e.div`
|
|
2
2
|
background: var(--bg-color-modal-overlay);
|
|
3
3
|
position: fixed;
|
|
4
4
|
width: 100vw;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{styled as o}from"styled-components";import{memo as b,useCallback as h,useState as B}from"react";import{CopyButton as k}from"@redocly/theme/components/Buttons/CopyButton";import{DatabaseIcon as y}from"@redocly/theme/icons/DatabaseIcon/DatabaseIcon";import{KafkaIcon as M}from"@redocly/theme/icons/KafkaIcon/KafkaIcon";import{RabbitMQIcon as w}from"@redocly/theme/icons/RabbitMQIcon/RabbitMQIcon";import{useModalScrollLock as I}from"@redocly/theme/core/
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{styled as o}from"styled-components";import{memo as b,useCallback as h,useState as B}from"react";import{CopyButton as k}from"@redocly/theme/components/Buttons/CopyButton";import{DatabaseIcon as y}from"@redocly/theme/icons/DatabaseIcon/DatabaseIcon";import{KafkaIcon as M}from"@redocly/theme/icons/KafkaIcon/KafkaIcon";import{RabbitMQIcon as w}from"@redocly/theme/icons/RabbitMQIcon/RabbitMQIcon";import{useModalScrollLock as I}from"@redocly/theme/core/openapi";import{Portal as L}from"@redocly/theme/components/Portal/Portal";import{Panel as S}from"@redocly/theme/components/Panel/Panel";import{MoreDetailsButton as j}from"../../../common/MoreDetailsButton.js";import{useSpecTranslate as P}from"../../../../hooks/useTranslate.js";import{useTelemetry as z}from"../../../../hooks/useTelemetry.js";import{resolveText as C}from"../../../../utils/resolveText.js";import{BrokerModal as T}from"./BrokerModal.js";import{HostList as D}from"./BrokerPanel.styled.js";function H(t){switch(t){case"kafka":return e(M,{size:"20px"});case"amqp":return e(w,{size:"20px"});default:return e(y,{size:"20px"})}}const O=b(function({broker:r,showMoreDetailsButton:i,onOpenModal:s}){return a(Q,{"data-component-name":"BrokerPanel/BrokerItem",children:[a(_,{children:[e(W,{children:H(r.protocol)}),e(q,{children:r.name})]}),r.url&&a(E,{children:[e(D,{children:r.url.split(" ").map((l,c)=>e("span",{children:l},c))}),e(k,{data:r.url},r.url)]}),!i&&e(N,{onClick:()=>s(r),children:e(j,{expanded:!1})})]})});function ie({node:t}){const r=t.children[0],i=r?.brokers??[],s=P(),l=z(),c=C(s,t.titleTranslationKey,t.title),v=r?.panelLabel||c||"Brokers",p=!t.title,[d,m]=B(null);I(d!==null);const g=h(n=>{l.sendServerModalOpenedMessage([{id:"serverModalButton",object:"button",uri:"urn:redocly:redoc:ui:button:serverModalButton",server:n.name??n.url??"unknown"}]),m(n)},[l]),x=h(()=>{m(null)},[]),u=e(A,{children:i.map(n=>e(O,{broker:n,showMoreDetailsButton:p,onOpenModal:g},n.name))}),f=d&&e(L,{mountId:"api-content",children:e(T,{broker:d,onClose:x,panelLabel:v})});return p?a(K,{children:[u,f]}):a(R,{header:t.title,className:"panel-api-docs",isExpandable:!1,children:[u,f]})}const R=o(S)`
|
|
2
2
|
[data-component-name='Panel/PanelBody'] {
|
|
3
3
|
padding: 0;
|
|
4
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{jsx as r,jsxs as e}from"react/jsx-runtime";import{styled as o}from"styled-components";const s=o.div`
|
|
2
2
|
border: 1px solid var(--border-color-secondary, var(--border-color-primary));
|
|
3
|
-
border-radius: var(--border-radius);
|
|
3
|
+
border-radius: var(--panel-border-radius);
|
|
4
4
|
background-color: var(--panel-bg-color, var(--bg-color));
|
|
5
5
|
margin-top: var(--spacing-base);
|
|
6
6
|
`,l=o.div`
|
|
@@ -5,7 +5,7 @@ import{styled as o}from"styled-components";import{Panel as e}from"@redocly/theme
|
|
|
5
5
|
`,c=o(e)`
|
|
6
6
|
[data-component-name='Panel/PanelHeader'],
|
|
7
7
|
[data-component-name='Panel/PanelBody'] {
|
|
8
|
-
padding: var(--spacing-sm);
|
|
8
|
+
padding: var(--spacing-sm) var(--spacing-md);
|
|
9
9
|
}
|
|
10
10
|
`,l=o(a)`
|
|
11
11
|
border: none;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{useId as l,useMemo as u}from"react";import{useAtomValue as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useId as l,useMemo as u}from"react";import{useAtomValue as c}from"jotai";import{panelKind as a}from"../../types/common.js";import{exampleStoreAtom as I}from"../../jotai/examples.js";import{responseCodesContainingKey as R}from"../../services/code-samples/example-key.js";import{ResponseExampleItem as E}from"../panels/ExampleItem/ResponseExampleItem.js";import{ContentWrapper as S}from"../common/ContentWrapper.js";import{ItemIdContext as x,SYNTHETIC_ITEM_ID_PREFIX as C}from"../../hooks/useDeepLinkSection.js";function N({responseCodes:e,exampleKey:n,schemaId:t}){const m=c(I),s=`${C}${l()}`,i=u(()=>{const o=R(e,n,f=>m[f]);return o.length===1?o:e},[e,n,m]),p=t===void 0?i:i.map(o=>o.schemaId?o:{...o,schemaId:t}),d={kind:a.RESPONSE,responseCodes:p,examples:[],...e.length===0&&t!==void 0&&{schemaId:t},...n!==void 0&&{exampleKey:n}};return r(x.Provider,{value:s,children:r(S,{children:r(E,{node:d})})})}export{N as RedocResponseSamples};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as i,jsx as r,jsxs as a}from"react/jsx-runtime";import{useLicenseGate as m}from"../hooks/useLicenseGate.js";function x(t){return function(e){const{gatedItems:s,overlay:n}=m(e.items??[]);return a(i,{children:[n,r(t,{...e,items:s})]})}}export{x as withLicenseGate};
|
|
@@ -10,6 +10,8 @@ type WithStoreProviderProps = {
|
|
|
10
10
|
options: RawApiDocsOptions;
|
|
11
11
|
layout?: LayoutVariant;
|
|
12
12
|
basePath?: string;
|
|
13
|
+
definition?: Record<string, unknown> | string;
|
|
14
|
+
definitionUrl?: string;
|
|
13
15
|
};
|
|
14
16
|
export type StoreProviderProps = {
|
|
15
17
|
options?: RawApiDocsOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as p}from"react/jsx-runtime";import{memo as
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";import{memo as E,useMemo as v,useEffect as j}from"react";import{createStore as O,Provider as P,useStore as N,getDefaultStore as _}from"jotai";import{LayoutVariant as k}from"@redocly/config";import{createStoreContext as M,toRecord as T}from"../adapters/helpers.js";import{populateOpenApiStore as F}from"../adapters/openapi/store.js";import{DEFAULT_MAX_DISPLAYED_ENUM_VALUES as V}from"../options/constants.js";import{normalizeOptions as w}from"../options/normalizeOptions.js";import{globalStoreAtom as h}from"../jotai/store.js";import{appStore as C,environmentAtom as z,layoutAtom as y}from"../jotai/app.js";import{userClaimsAtom as g}from"../jotai/app.js";import{buildServerEnvValues as I}from"../services/code-samples/server-env.js";const q={ignoreNamedSchemas:["java.io.ObjectStreamField"],maxDisplayedEnumValues:V};function L(e,o){const t={...q,...e,basePath:o};return w(t)}const U=new WeakSet;function b(e){U.has(e)||(U.add(e),e.sub(C,()=>{}))}function D(e,o){if(!o?.servers?.length)return;b(e);const t=I(o.servers),i=e.get(C).environments??{},s={};for(const[n,a]of Object.entries(t)){const m=i[n],r=m?Object.fromEntries(Object.entries(a).filter(([d])=>!(d in m))):a;Object.keys(r).length>0&&(s[n]=r)}Object.keys(s).length!==0&&e.set(z,{environments:s})}function re(e){const o=E(t=>{const{items:i,options:s,store:n,layout:a,basePath:m="",definition:r,definitionUrl:d}=t,x=N(),c=x!==_()?x:void 0,u=v(()=>L(s,m),[s,m]),S=a??u.layout;j(()=>{if(c){const l=c.get(h);D(c,n??l.store),c.set(y,S),c.set(g,u.userClaims??{}),c.set(h,{items:i,store:n??l.store,options:u,definition:r??l.definition,definitionUrl:d??l.definitionUrl,replayDefinition:l.replayDefinition})}},[S,u,c,i,n,r,d]);const A=v(()=>{if(c)return null;const l={items:i,store:n,options:u,definition:r,definitionUrl:d,replayDefinition:null},f=O();return f.set(h,l),b(f),f.set(y,S),u.userClaims&&f.set(g,u.userClaims),D(f,n),f},[c,i,n,u,S]);return c||!A?p(e,{...t}):p(P,{store:A,children:p(e,{...t})})});return o.displayName=`WithStoreProvider(${G(e)})`,o}function G(e){return e.displayName||e.name||"Component"}function K(e,o){const t=M(T(e));return F(e,t,o),{schemaStore:t.schemaStore,exampleStore:t.exampleStore,securitySchemeStore:t.securitySchemeStore,mcp:t.document["x-mcp"],schemaCatalogLink:t.document["x-schema-catalog-link"]}}const oe=E(function({children:o,definition:t,apiStore:i,options:s}){const n=v(()=>{const a=L({specType:"openapi",...s},s?.basePath??"");let m;if(i)m=i;else if(t)m=K(t,a);else throw new Error("StoreProvider requires either apiStore or definition");const r=O();return r.set(h,{items:[],store:m,options:a,replayDefinition:null}),b(r),r.set(y,k.STACKED),a.userClaims&&r.set(g,a.userClaims),D(r,m),r},[i,t,s]);return p(P,{store:n,children:o})});export{oe as StoreProvider,re as withStoreProvider};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SliceContentKind, SpecSliceScope } from '../services/spec-slice/index.js';
|
|
2
|
+
type CopySpecSlice = {
|
|
3
|
+
getText: () => Promise<string>;
|
|
4
|
+
contentKind: SliceContentKind;
|
|
5
|
+
scope: SpecSliceScope;
|
|
6
|
+
specUrl?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function useCopySpecSlice(pageSlug: string): CopySpecSlice | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as a}from"react";import{useAtomValue as r}from"jotai";import{apiSpecType as d}from"../types/common.js";import{definitionAtom as l,definitionUrlAtom as y,routingBasePathAtom as h,specTypeAtom as A}from"../jotai/store.js";import{routeIndexAtom as P}from"../jotai/routes.js";import{buildSpecSlice as S,resolveSpecSliceScope as g}from"../services/spec-slice/index.js";function x(t,n,i){const e=n.toLowerCase(),o=t.routeIndexByPath.get(n)??t.routeIndexByPath.get(e);return o!==void 0?t.allRoutes[o]:e===i.toLowerCase()?t.rootPage:void 0}function R(t){const n=r(l),i=r(y),e=r(P),o=r(A),m=r(h);return a(()=>{if(!n||!e)return null;const c=x(e,t,m??""),p=c?e.tagByPath.get(c.path)?.items.map(s=>s.content):void 0,u=g(o,c?.content,c?.label,p);if(!u)return null;const f=o===d.GRAPHQL?"graphql":"yaml";return{getText:async()=>{const s=await S(o,n,u);if(s===void 0)throw new Error(`Copy for LLM: no content produced for "${t}"`);return s},contentKind:f,scope:u,specUrl:i}},[n,i,e,o,m,t])}export{R as useCopySpecSlice};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){}export{e as useInitialTelemetry};
|
package/lib/hooks/useLicense.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as
|
|
1
|
+
import{useState as a,useEffect as l}from"react";import r,{isLicenseBypassed as u}from"../services/license/check.js";function p(e){const[n,i]=a(u()?{valid:!0,allowed:!0}:null);l(()=>{async function o(){const s=await r(e);i(s)}o()},[e]);const t=n===null;return{licenseInfo:n??{},isValid:n!==null&&c(n),isPending:t}}function c(e){return!!e.valid&&!!e.allowed&&!e.expired||!!e.local}export{p as useLicense};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useAtomValue as t}from"jotai";import{licenseKeyAtom as m}from"../jotai/store.js";import{useLicense as c}from"./useLicense.js";import{LicenseOverlay as l}from"../components/LicenseOverlay.js";function d(o){const s=t(m),{isValid:e,licenseInfo:i,isPending:n}=c(s);return{gatedItems:e?o:[],overlay:!n&&!e?r(l,{licenseInfo:i}):null}}export{d as useLicenseGate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as
|
|
1
|
+
import{useEffect as c}from"react";import{useAtomValue as s,useSetAtom as l}from"jotai";import{useHref as m,useLocation as a}from"react-router";import{IS_BROWSER as f,useActiveSectionId as u}from"@redocly/theme/core/openapi";import{activeScrollSectionAtom as p}from"../jotai/app.js";import{routingBasePathAtom as S}from"../jotai/store.js";import{encodeBackSlashes as d}from"../utils/string.js";import{normalizePath as h}from"../utils/url.js";import{useUserScrollIntent as w}from"./useUserScrollIntent.js";import{URL_REPLACE_EVENT as E}from"./useRouterHashBridge.js";function A(t){window.history.replaceState({},"",t),window.dispatchEvent(new Event(E))}function k(){const t=a(),e=l(p),r=s(S),o=u(t,!1,!1),n=m(h(d(o||"/"))),i=w(t.key);c(()=>{e(null)},[t.pathname,e]),c(()=>{!f||!o||(e(o),i.current&&(o===r||!window.location.pathname.includes(o)&&!window.location.hash.includes(o))&&A(n))},[o,n,r,e,i])}export{k as useScrollSpyUrlSync};
|
package/lib/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export { extractFullText } from './adapters/utils/markdoc.js';
|
|
|
15
15
|
export { normalizeOptions } from './options/normalizeOptions.js';
|
|
16
16
|
export { excludeMockServers } from './adapters/openapi/utils/merge-mock-server.js';
|
|
17
17
|
export { appendUndeclaredConfigureParameters } from './services/code-samples/replay/merge-configure-into-source.js';
|
|
18
|
-
export { isGraphqlDocsSidebarHidden } from './options/helpers.js';
|
|
19
18
|
export { findFirstBinding } from './adapters/asyncapi/build/utils.js';
|
|
20
19
|
export { resolveRequestValues, applyRequestValuesToOperationInfo, type ResolveRequestValuesParams, } from './adapters/openapi/configure/index.js';
|
|
21
20
|
export { updateObjectProperties, isDirectRequestValues, getEffectiveRequestValues, createSecurityUpdates, mergeSecurityIntoScheme, applyServerVariableDefaults, type SchemeForCredentials, } from './adapters/openapi/configure/merge-utils.js';
|
|
@@ -24,6 +23,7 @@ export type { ConfigureRequestValues, ConfigureServerRequestValues, SecurityDeta
|
|
|
24
23
|
export { MarkdownAdapterProvider, useMarkdownAdapter, type MarkdownAdapter, type MarkdownParser, type MarkdownRenderer, } from './contexts/markdownAdapter.js';
|
|
25
24
|
export { markdocParser } from './components/markdoc/markdocParser.js';
|
|
26
25
|
export { createMarkdocAdapter } from './components/markdoc/markdocAdapter.js';
|
|
26
|
+
export { adapterToMarkdownParser } from './components/Replay/adapterToMarkdownParser.js';
|
|
27
27
|
export { parseMarkdown, type ParseMarkdownOptions } from './adapters/utils/parseMarkdown.js';
|
|
28
28
|
export { isPlainText } from './adapters/utils/isPlainText.js';
|
|
29
29
|
export { buildMarkdocOptions } from './components/markdoc/buildMarkdocOptions.js';
|
|
@@ -33,6 +33,9 @@ export { RedoclyApiDocs } from './RedoclyApiDocs.js';
|
|
|
33
33
|
export type { RedoclyApiDocsProps } from './RedoclyApiDocs.js';
|
|
34
34
|
export { RedoclyApiDocsStandalone } from './RedoclyApiDocsStandalone.js';
|
|
35
35
|
export type { RedoclyApiDocsStandaloneProps } from './RedoclyApiDocsStandalone.js';
|
|
36
|
+
export type { RedocStandaloneProps } from './RedocStandalone.js';
|
|
37
|
+
export { ApiDocsSearchIndexer } from './services/search/indexer.js';
|
|
38
|
+
export type { SearchDocument, SearchItemData } from './services/search/types.js';
|
|
36
39
|
export { RedocTelemetry } from './telemetry/RedocTelemetry.js';
|
|
37
40
|
export type { RedocTelemetryConfig, SpecType } from './telemetry/RedocTelemetry.js';
|
|
38
41
|
export { Replay, EmbeddedReplay } from './components/Replay/index.js';
|
|
@@ -51,6 +54,8 @@ export { schemaDefinitionTag } from './components/markdoc/tags/schema-definition
|
|
|
51
54
|
export { withReplayPrefetch, useOpenApiDefinition } from './hoc/withReplayPrefetch.js';
|
|
52
55
|
export { mergeEnvData } from './utils/environments.js';
|
|
53
56
|
export { buildReplayPredefinedEnvValues } from './services/code-samples/replay/replay-predefined-env.js';
|
|
57
|
+
export { createDocumentReplayConverter } from './services/code-samples/replay/from-openapi-document.js';
|
|
58
|
+
export { ReplayCodeSampleHTTPSnippet } from './services/code-samples/replay/har-to-code-sample-har.js';
|
|
54
59
|
export { encodeJsonPointerSegment } from './utils/refPointer.js';
|
|
55
60
|
export { JsonPointer } from './adapters/openapi/utils/JsonPointer.js';
|
|
56
61
|
export { langFromMime, encodeExampleForMediaType } from './utils/media-type.js';
|