@apiboost/omnispec 1.0.0 → 1.1.0-next.1
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/dist/cjs/asyncapi/index.js +3 -3
- package/dist/cjs/chunks/AsyncApiSpec-CHvM1swf.js +1880 -0
- package/dist/cjs/chunks/AsyncApiSpec-CHvM1swf.js.map +1 -0
- package/dist/cjs/chunks/{Collapsible-BHAHk_Ep.js → Collapsible-Jlb_vtdW.js} +286 -225
- package/dist/cjs/chunks/Collapsible-Jlb_vtdW.js.map +1 -0
- package/dist/cjs/chunks/{OmniSpecRenderer-CE4wxVTL.js → OmniSpecRenderer-Dj6Z6W2J.js} +3 -3
- package/dist/cjs/chunks/{OmniSpecRenderer-CE4wxVTL.js.map → OmniSpecRenderer-Dj6Z6W2J.js.map} +1 -1
- package/dist/cjs/chunks/{OpenApiSpec-D0JtmOVQ.js → OpenApiSpec-BPtXvk7C.js} +8 -8
- package/dist/cjs/chunks/{OpenApiSpec-D0JtmOVQ.js.map → OpenApiSpec-BPtXvk7C.js.map} +1 -1
- package/dist/cjs/chunks/{OpenIdConnectManual-oEnN0QJ-.js → OpenIdConnectManual-DBP0Do-3.js} +6 -67
- package/dist/cjs/chunks/OpenIdConnectManual-DBP0Do-3.js.map +1 -0
- package/dist/cjs/chunks/{ref-resolver-DWu6Q6E5.js → ref-resolver-0A8GNRI3.js} +6 -2
- package/dist/cjs/chunks/{ref-resolver-DWu6Q6E5.js.map → ref-resolver-0A8GNRI3.js.map} +1 -1
- package/dist/cjs/core/public.js +2 -2
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/openapi/index.js +4 -4
- package/dist/cjs/wc/index.js +1 -1
- package/dist/esm/asyncapi/index.js +3 -3
- package/dist/esm/chunks/AsyncApiSpec-BPiA9b5T.js +1878 -0
- package/dist/esm/chunks/AsyncApiSpec-BPiA9b5T.js.map +1 -0
- package/dist/esm/chunks/{Collapsible-DA6-nS46.js → Collapsible-0ryLh6wX.js} +286 -227
- package/dist/esm/chunks/Collapsible-0ryLh6wX.js.map +1 -0
- package/dist/esm/chunks/{OmniSpecRenderer-MqsQFXro.js → OmniSpecRenderer-yF2Zw_B9.js} +3 -3
- package/dist/esm/chunks/{OmniSpecRenderer-MqsQFXro.js.map → OmniSpecRenderer-yF2Zw_B9.js.map} +1 -1
- package/dist/esm/chunks/{OpenApiSpec-Cy-oW6jA.js → OpenApiSpec-MGJ3oFHZ.js} +4 -4
- package/dist/esm/chunks/{OpenApiSpec-Cy-oW6jA.js.map → OpenApiSpec-MGJ3oFHZ.js.map} +1 -1
- package/dist/esm/chunks/{OpenIdConnectManual-COfITasf.js → OpenIdConnectManual-BS-n811Z.js} +5 -64
- package/dist/esm/chunks/OpenIdConnectManual-BS-n811Z.js.map +1 -0
- package/dist/esm/chunks/{ref-resolver-BIrHJOjz.js → ref-resolver-B0C36NuQ.js} +6 -3
- package/dist/esm/chunks/{ref-resolver-BIrHJOjz.js.map → ref-resolver-B0C36NuQ.js.map} +1 -1
- package/dist/esm/core/public.js +2 -2
- package/dist/esm/index.js +6 -6
- package/dist/esm/openapi/index.js +4 -4
- package/dist/esm/wc/index.js +1 -1
- package/dist/types/asyncapi/AsyncApiSpec.d.ts.map +1 -1
- package/dist/types/asyncapi/components/BindingsSection.d.ts +26 -0
- package/dist/types/asyncapi/components/BindingsSection.d.ts.map +1 -0
- package/dist/types/asyncapi/components/ChannelDetail.d.ts +1 -1
- package/dist/types/asyncapi/components/ChannelDetail.d.ts.map +1 -1
- package/dist/types/asyncapi/components/ComponentsSection.d.ts +1 -1
- package/dist/types/asyncapi/components/ComponentsSection.d.ts.map +1 -1
- package/dist/types/asyncapi/components/MessagePayload.d.ts +22 -0
- package/dist/types/asyncapi/components/MessagePayload.d.ts.map +1 -0
- package/dist/types/asyncapi/components/SecurityRequirementBadges.d.ts +22 -0
- package/dist/types/asyncapi/components/SecurityRequirementBadges.d.ts.map +1 -0
- package/dist/types/asyncapi/components/SecuritySchemesSection.d.ts +23 -0
- package/dist/types/asyncapi/components/SecuritySchemesSection.d.ts.map +1 -0
- package/dist/types/asyncapi/components/ServerList.d.ts +1 -1
- package/dist/types/asyncapi/components/ServerList.d.ts.map +1 -1
- package/dist/types/asyncapi/components/TagGroupHeader.d.ts +18 -0
- package/dist/types/asyncapi/components/TagGroupHeader.d.ts.map +1 -0
- package/dist/types/asyncapi/components/field-display.d.ts +20 -0
- package/dist/types/asyncapi/components/field-display.d.ts.map +1 -0
- package/dist/types/asyncapi/parser/asyncapi-parser.d.ts.map +1 -1
- package/dist/types/asyncapi/schema-formats.d.ts +26 -0
- package/dist/types/asyncapi/schema-formats.d.ts.map +1 -0
- package/dist/types/asyncapi/tag-grouping.d.ts +39 -0
- package/dist/types/asyncapi/tag-grouping.d.ts.map +1 -0
- package/dist/types/asyncapi/types/asyncapi.types.d.ts +35 -0
- package/dist/types/asyncapi/types/asyncapi.types.d.ts.map +1 -1
- package/dist/types/openapi/parser/ref-resolver.d.ts +8 -0
- package/dist/types/openapi/parser/ref-resolver.d.ts.map +1 -1
- package/dist/wc/standalone.js +1 -1
- package/dist/wc/standalone.js.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/chunks/AsyncApiSpec-TBlyRxTP.js +0 -819
- package/dist/cjs/chunks/AsyncApiSpec-TBlyRxTP.js.map +0 -1
- package/dist/cjs/chunks/Collapsible-BHAHk_Ep.js.map +0 -1
- package/dist/cjs/chunks/OpenIdConnectManual-oEnN0QJ-.js.map +0 -1
- package/dist/esm/chunks/AsyncApiSpec-C3lsUpZk.js +0 -817
- package/dist/esm/chunks/AsyncApiSpec-C3lsUpZk.js.map +0 -1
- package/dist/esm/chunks/Collapsible-DA6-nS46.js.map +0 -1
- package/dist/esm/chunks/OpenIdConnectManual-COfITasf.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, createContext, useMemo, useState, useEffect, useCallback,
|
|
1
|
+
import { useContext, createContext, useMemo, useState, useEffect, useCallback, memo, useRef } from 'react';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { css, cx } from '@emotion/css';
|
|
4
4
|
import { m as mq, B as Button, I as Icon, j as useConfig } from './useSpecFetcher-CZvAnU7Z.js';
|
|
@@ -57,6 +57,50 @@ function useScrollSpy(ids, rootMargin = "0px 0px -80% 0px") {
|
|
|
57
57
|
return activeId;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
const expandListeners = /* @__PURE__ */ new Map();
|
|
61
|
+
function onExpandRequest(id, callback) {
|
|
62
|
+
expandListeners.set(id, callback);
|
|
63
|
+
return () => {
|
|
64
|
+
expandListeners.delete(id);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function requestExpand(id) {
|
|
68
|
+
const listener = expandListeners.get(id);
|
|
69
|
+
if (listener) listener();
|
|
70
|
+
}
|
|
71
|
+
const SMOOTH_THRESHOLD = 50;
|
|
72
|
+
function useHashScroll(operationCount = 0) {
|
|
73
|
+
const scrollBehavior = operationCount > SMOOTH_THRESHOLD ? "instant" : "smooth";
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const hash = window.location.hash.slice(1);
|
|
76
|
+
if (!hash) return;
|
|
77
|
+
requestExpand(hash);
|
|
78
|
+
const attempt = () => {
|
|
79
|
+
const el = document.getElementById(hash);
|
|
80
|
+
if (el) {
|
|
81
|
+
el.scrollIntoView({ behavior: scrollBehavior, block: "start" });
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
};
|
|
86
|
+
if (attempt()) return;
|
|
87
|
+
let tries = 0;
|
|
88
|
+
const interval = setInterval(() => {
|
|
89
|
+
if (attempt() || ++tries >= 10) clearInterval(interval);
|
|
90
|
+
}, 200);
|
|
91
|
+
return () => clearInterval(interval);
|
|
92
|
+
}, [scrollBehavior]);
|
|
93
|
+
const navigateTo = useCallback((id) => {
|
|
94
|
+
window.history.replaceState(null, "", `#${id}`);
|
|
95
|
+
requestExpand(id);
|
|
96
|
+
requestAnimationFrame(() => {
|
|
97
|
+
const el = document.getElementById(id);
|
|
98
|
+
el?.scrollIntoView({ behavior: scrollBehavior, block: "start" });
|
|
99
|
+
});
|
|
100
|
+
}, [scrollBehavior]);
|
|
101
|
+
return { navigateTo };
|
|
102
|
+
}
|
|
103
|
+
|
|
60
104
|
function SearchBar({ placeholder = "Search...", onSearch }) {
|
|
61
105
|
const [value, setValue] = useState("");
|
|
62
106
|
const handleChange = useCallback((e) => {
|
|
@@ -64,7 +108,7 @@ function SearchBar({ placeholder = "Search...", onSearch }) {
|
|
|
64
108
|
setValue(query);
|
|
65
109
|
onSearch(query);
|
|
66
110
|
}, [onSearch]);
|
|
67
|
-
return /* @__PURE__ */ jsx("div", { className: `omnispec-search ${containerStyle$
|
|
111
|
+
return /* @__PURE__ */ jsx("div", { className: `omnispec-search ${containerStyle$5}`, children: /* @__PURE__ */ jsx(
|
|
68
112
|
"input",
|
|
69
113
|
{
|
|
70
114
|
type: "text",
|
|
@@ -76,7 +120,7 @@ function SearchBar({ placeholder = "Search...", onSearch }) {
|
|
|
76
120
|
}
|
|
77
121
|
) });
|
|
78
122
|
}
|
|
79
|
-
const containerStyle$
|
|
123
|
+
const containerStyle$5 = css({
|
|
80
124
|
padding: "12px"
|
|
81
125
|
});
|
|
82
126
|
const inputStyle = css({
|
|
@@ -102,7 +146,7 @@ function SpecToolbar({
|
|
|
102
146
|
onToggleExpand,
|
|
103
147
|
downloadLink
|
|
104
148
|
}) {
|
|
105
|
-
return /* @__PURE__ */ jsxs("div", { className: containerStyle$
|
|
149
|
+
return /* @__PURE__ */ jsxs("div", { className: containerStyle$4, children: [
|
|
106
150
|
/* @__PURE__ */ jsx("div", { className: overviewWrapStyle, children: overview }),
|
|
107
151
|
/* @__PURE__ */ jsxs("div", { className: actionsStyle, children: [
|
|
108
152
|
versionBadge && /* @__PURE__ */ jsx("div", { className: mobileBadgeStyle, children: versionBadge }),
|
|
@@ -127,7 +171,7 @@ function SpecToolbar({
|
|
|
127
171
|
] })
|
|
128
172
|
] });
|
|
129
173
|
}
|
|
130
|
-
const containerStyle$
|
|
174
|
+
const containerStyle$4 = css({
|
|
131
175
|
display: "flex",
|
|
132
176
|
alignItems: "flex-start",
|
|
133
177
|
justifyContent: "space-between",
|
|
@@ -2451,7 +2495,7 @@ marked.setOptions({
|
|
|
2451
2495
|
breaks: false,
|
|
2452
2496
|
gfm: true
|
|
2453
2497
|
});
|
|
2454
|
-
const containerStyle$
|
|
2498
|
+
const containerStyle$3 = css({
|
|
2455
2499
|
color: "var(--omnispec-fg-primary)",
|
|
2456
2500
|
fontSize: "var(--omnispec-font-size-base)",
|
|
2457
2501
|
lineHeight: 1.6
|
|
@@ -2464,7 +2508,7 @@ function MarkdownRenderer({ content, className }) {
|
|
|
2464
2508
|
return /* @__PURE__ */ jsx(
|
|
2465
2509
|
"div",
|
|
2466
2510
|
{
|
|
2467
|
-
className: cx("omnispec-markdown", containerStyle$
|
|
2511
|
+
className: cx("omnispec-markdown", containerStyle$3, className),
|
|
2468
2512
|
dangerouslySetInnerHTML: { __html: html }
|
|
2469
2513
|
}
|
|
2470
2514
|
);
|
|
@@ -3606,6 +3650,187 @@ function generateNumberExample(format, minimum) {
|
|
|
3606
3650
|
}
|
|
3607
3651
|
}
|
|
3608
3652
|
|
|
3653
|
+
const ExpandableCard = memo(function ExpandableCard2({
|
|
3654
|
+
id,
|
|
3655
|
+
title,
|
|
3656
|
+
rightLabel,
|
|
3657
|
+
deprecated,
|
|
3658
|
+
badges,
|
|
3659
|
+
expandAll,
|
|
3660
|
+
expandGeneration,
|
|
3661
|
+
children
|
|
3662
|
+
}) {
|
|
3663
|
+
const { defaultExpandOperations } = useConfig();
|
|
3664
|
+
const [expanded, setExpanded] = useState(defaultExpandOperations);
|
|
3665
|
+
const [nearViewport, setNearViewport] = useState(false);
|
|
3666
|
+
const containerRef = useRef(null);
|
|
3667
|
+
const ctx = useExpandAll();
|
|
3668
|
+
const effectiveExpandAll = expandAll ?? ctx.expandAll;
|
|
3669
|
+
const effectiveGeneration = expandGeneration ?? ctx.expandGeneration;
|
|
3670
|
+
useEffect(() => {
|
|
3671
|
+
if (effectiveGeneration > 0) {
|
|
3672
|
+
setExpanded(!!effectiveExpandAll);
|
|
3673
|
+
}
|
|
3674
|
+
}, [effectiveExpandAll, effectiveGeneration]);
|
|
3675
|
+
useEffect(() => {
|
|
3676
|
+
if (!id) return;
|
|
3677
|
+
return onExpandRequest(id, () => setExpanded(true));
|
|
3678
|
+
}, [id]);
|
|
3679
|
+
useEffect(() => {
|
|
3680
|
+
const el = containerRef.current;
|
|
3681
|
+
if (!el) return;
|
|
3682
|
+
if (nearViewport) return;
|
|
3683
|
+
const observer = new IntersectionObserver(
|
|
3684
|
+
([entry]) => {
|
|
3685
|
+
if (entry.isIntersecting) {
|
|
3686
|
+
setNearViewport(true);
|
|
3687
|
+
observer.disconnect();
|
|
3688
|
+
}
|
|
3689
|
+
},
|
|
3690
|
+
{ rootMargin: "1000px" }
|
|
3691
|
+
);
|
|
3692
|
+
observer.observe(el);
|
|
3693
|
+
return () => observer.disconnect();
|
|
3694
|
+
}, [nearViewport]);
|
|
3695
|
+
const shouldRender = expanded && nearViewport;
|
|
3696
|
+
const handleClick = useCallback(() => {
|
|
3697
|
+
setExpanded((prev) => !prev);
|
|
3698
|
+
}, []);
|
|
3699
|
+
return /* @__PURE__ */ jsxs(
|
|
3700
|
+
"div",
|
|
3701
|
+
{
|
|
3702
|
+
ref: containerRef,
|
|
3703
|
+
id,
|
|
3704
|
+
className: cx(
|
|
3705
|
+
"omnispec-expandable-card",
|
|
3706
|
+
containerStyle$2,
|
|
3707
|
+
deprecated ? deprecatedStyle : void 0
|
|
3708
|
+
),
|
|
3709
|
+
children: [
|
|
3710
|
+
/* @__PURE__ */ jsxs(
|
|
3711
|
+
"button",
|
|
3712
|
+
{
|
|
3713
|
+
type: "button",
|
|
3714
|
+
onClick: handleClick,
|
|
3715
|
+
className: cx(headerStyle$2, expanded ? headerExpandedStyle : void 0),
|
|
3716
|
+
"aria-expanded": expanded,
|
|
3717
|
+
children: [
|
|
3718
|
+
/* @__PURE__ */ jsx("span", { className: cx(chevronStyle, expanded && chevronExpandedStyle), children: /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: "0.75rem" }) }),
|
|
3719
|
+
badges?.filter((b) => b.position === "before").map((b) => /* @__PURE__ */ jsx("span", { className: xBadgeStyle, style: { backgroundColor: b.color ?? "var(--omnispec-bg-tertiary)", color: b.color ? "#fff" : "var(--omnispec-fg-secondary)" }, children: b.name }, b.name)),
|
|
3720
|
+
/* @__PURE__ */ jsx("span", { className: titleStyle$1, children: title }),
|
|
3721
|
+
badges?.filter((b) => b.position !== "before").map((b) => /* @__PURE__ */ jsx("span", { className: xBadgeStyle, style: { backgroundColor: b.color ?? "var(--omnispec-bg-tertiary)", color: b.color ? "#fff" : "var(--omnispec-fg-secondary)" }, children: b.name }, b.name)),
|
|
3722
|
+
deprecated && /* @__PURE__ */ jsx("span", { className: deprecatedBadgeStyle, children: "Deprecated" }),
|
|
3723
|
+
rightLabel && /* @__PURE__ */ jsx("span", { className: rightLabelStyle, children: rightLabel })
|
|
3724
|
+
]
|
|
3725
|
+
}
|
|
3726
|
+
),
|
|
3727
|
+
shouldRender && /* @__PURE__ */ jsx("div", { className: bodyStyle, children })
|
|
3728
|
+
]
|
|
3729
|
+
}
|
|
3730
|
+
);
|
|
3731
|
+
});
|
|
3732
|
+
const containerStyle$2 = css({
|
|
3733
|
+
marginBottom: "0.75rem",
|
|
3734
|
+
maxWidth: "100%",
|
|
3735
|
+
borderRadius: "0.5rem",
|
|
3736
|
+
[mq.desktop]: {
|
|
3737
|
+
border: "1px solid var(--omnispec-border-color)",
|
|
3738
|
+
borderRadius: "0.5rem"
|
|
3739
|
+
}
|
|
3740
|
+
});
|
|
3741
|
+
const deprecatedStyle = css({
|
|
3742
|
+
opacity: 0.6
|
|
3743
|
+
});
|
|
3744
|
+
const headerStyle$2 = css({
|
|
3745
|
+
display: "flex",
|
|
3746
|
+
alignItems: "center",
|
|
3747
|
+
gap: "0.75rem",
|
|
3748
|
+
width: "100%",
|
|
3749
|
+
padding: "0.75rem 0",
|
|
3750
|
+
background: "var(--omnispec-bg-primary)",
|
|
3751
|
+
border: "none",
|
|
3752
|
+
borderBottom: "none",
|
|
3753
|
+
borderRadius: "0.5rem",
|
|
3754
|
+
cursor: "pointer",
|
|
3755
|
+
textAlign: "left",
|
|
3756
|
+
[mq.desktop]: {
|
|
3757
|
+
padding: "1rem"
|
|
3758
|
+
}
|
|
3759
|
+
});
|
|
3760
|
+
const headerExpandedStyle = css({});
|
|
3761
|
+
const chevronStyle = css({
|
|
3762
|
+
color: "var(--omnispec-fg-muted)",
|
|
3763
|
+
flexShrink: 0,
|
|
3764
|
+
transition: "transform 0.2s ease"
|
|
3765
|
+
});
|
|
3766
|
+
const chevronExpandedStyle = css({
|
|
3767
|
+
transform: "rotate(90deg)"
|
|
3768
|
+
});
|
|
3769
|
+
const titleStyle$1 = css({
|
|
3770
|
+
fontWeight: 600,
|
|
3771
|
+
flex: 1,
|
|
3772
|
+
minWidth: 0,
|
|
3773
|
+
color: "var(--omnispec-fg-primary)",
|
|
3774
|
+
fontSize: "var(--omnispec-font-size-md)",
|
|
3775
|
+
textOverflow: "ellipsis",
|
|
3776
|
+
whiteSpace: "nowrap"
|
|
3777
|
+
});
|
|
3778
|
+
const xBadgeStyle = css({
|
|
3779
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
3780
|
+
fontWeight: 600,
|
|
3781
|
+
padding: "0.125rem 0.5rem",
|
|
3782
|
+
borderRadius: "1rem",
|
|
3783
|
+
whiteSpace: "nowrap",
|
|
3784
|
+
flexShrink: 0
|
|
3785
|
+
});
|
|
3786
|
+
const deprecatedBadgeStyle = css({
|
|
3787
|
+
fontSize: "10px",
|
|
3788
|
+
color: "var(--omnispec-color-warning)",
|
|
3789
|
+
fontWeight: 600,
|
|
3790
|
+
textTransform: "uppercase",
|
|
3791
|
+
border: "1px solid var(--omnispec-color-warning)",
|
|
3792
|
+
padding: "1px 5px",
|
|
3793
|
+
borderRadius: "3px",
|
|
3794
|
+
flexShrink: 0
|
|
3795
|
+
});
|
|
3796
|
+
const rightLabelStyle = css({
|
|
3797
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
3798
|
+
color: "var(--omnispec-fg-muted)",
|
|
3799
|
+
flexShrink: 0,
|
|
3800
|
+
marginLeft: "auto"
|
|
3801
|
+
});
|
|
3802
|
+
const bodyStyle = css({});
|
|
3803
|
+
|
|
3804
|
+
const barStyle = css({
|
|
3805
|
+
display: "flex",
|
|
3806
|
+
flexWrap: "wrap",
|
|
3807
|
+
alignItems: "center",
|
|
3808
|
+
gap: "12px",
|
|
3809
|
+
padding: "12px 16px",
|
|
3810
|
+
backgroundColor: "rgba(0, 0, 0, 0.02)",
|
|
3811
|
+
borderBottom: "1px solid var(--omnispec-border-color)",
|
|
3812
|
+
overflow: "hidden",
|
|
3813
|
+
maxWidth: "100%"
|
|
3814
|
+
});
|
|
3815
|
+
const pathStyle = css({
|
|
3816
|
+
minWidth: 0,
|
|
3817
|
+
wordBreak: "break-all"
|
|
3818
|
+
});
|
|
3819
|
+
function MethodBar({ label, path, color, method }) {
|
|
3820
|
+
return /* @__PURE__ */ jsxs("div", { className: barStyle, children: [
|
|
3821
|
+
/* @__PURE__ */ jsx(
|
|
3822
|
+
Badge,
|
|
3823
|
+
{
|
|
3824
|
+
label,
|
|
3825
|
+
variant: method ? "method" : "default",
|
|
3826
|
+
method,
|
|
3827
|
+
color
|
|
3828
|
+
}
|
|
3829
|
+
),
|
|
3830
|
+
/* @__PURE__ */ jsx("code", { className: pathStyle, children: path })
|
|
3831
|
+
] });
|
|
3832
|
+
}
|
|
3833
|
+
|
|
3609
3834
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
3610
3835
|
|
|
3611
3836
|
function getDefaultExportFromCjs (x) {
|
|
@@ -6998,9 +7223,9 @@ function CodeBlock({
|
|
|
6998
7223
|
}, [code]);
|
|
6999
7224
|
const hasHeader = title || showCopy || headerLeft;
|
|
7000
7225
|
return /* @__PURE__ */ jsxs("div", { className: cx("omnispec-code-block", containerStyle$1), children: [
|
|
7001
|
-
hasHeader && /* @__PURE__ */ jsxs("div", { className: headerStyle$
|
|
7226
|
+
hasHeader && /* @__PURE__ */ jsxs("div", { className: headerStyle$1, children: [
|
|
7002
7227
|
/* @__PURE__ */ jsxs("div", { className: headerLeftStyle, children: [
|
|
7003
|
-
title && /* @__PURE__ */ jsx("span", { className: titleStyle
|
|
7228
|
+
title && /* @__PURE__ */ jsx("span", { className: titleStyle, children: title }),
|
|
7004
7229
|
headerLeft
|
|
7005
7230
|
] }),
|
|
7006
7231
|
showCopy && /* @__PURE__ */ jsx(
|
|
@@ -7050,7 +7275,7 @@ const containerStyle$1 = css({
|
|
|
7050
7275
|
border: "1px solid var(--omnispec-border-color)"
|
|
7051
7276
|
}
|
|
7052
7277
|
});
|
|
7053
|
-
const headerStyle$
|
|
7278
|
+
const headerStyle$1 = css({
|
|
7054
7279
|
display: "flex",
|
|
7055
7280
|
justifyContent: "space-between",
|
|
7056
7281
|
alignItems: "center",
|
|
@@ -7067,7 +7292,7 @@ const headerLeftStyle = css({
|
|
|
7067
7292
|
minWidth: 0,
|
|
7068
7293
|
overflow: "hidden"
|
|
7069
7294
|
});
|
|
7070
|
-
const titleStyle
|
|
7295
|
+
const titleStyle = css({
|
|
7071
7296
|
fontFamily: "var(--omnispec-font-mono)",
|
|
7072
7297
|
fontSize: "var(--omnispec-font-size-xs)",
|
|
7073
7298
|
color: "var(--omnispec-fg-muted)",
|
|
@@ -7098,7 +7323,7 @@ const preStyle = css({
|
|
|
7098
7323
|
}
|
|
7099
7324
|
});
|
|
7100
7325
|
|
|
7101
|
-
const headerStyle
|
|
7326
|
+
const headerStyle = css({
|
|
7102
7327
|
display: "flex",
|
|
7103
7328
|
gap: "0.125rem",
|
|
7104
7329
|
marginBottom: "-1px",
|
|
@@ -7157,7 +7382,7 @@ function Tabs({ tabs, defaultTab, flush = false }) {
|
|
|
7157
7382
|
const [activeTab, setActiveTab] = useState(defaultTab ?? tabs[0]?.id ?? "");
|
|
7158
7383
|
const activeContent = tabs.find((t) => t.id === activeTab)?.content;
|
|
7159
7384
|
return /* @__PURE__ */ jsxs("div", { className: "omnispec-tabs", children: [
|
|
7160
|
-
/* @__PURE__ */ jsx("div", { className: cx(headerStyle
|
|
7385
|
+
/* @__PURE__ */ jsx("div", { className: cx(headerStyle, flush && flushHeaderStyle), role: "tablist", children: tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
7161
7386
|
"button",
|
|
7162
7387
|
{
|
|
7163
7388
|
type: "button",
|
|
@@ -7177,230 +7402,64 @@ function Tabs({ tabs, defaultTab, flush = false }) {
|
|
|
7177
7402
|
] });
|
|
7178
7403
|
}
|
|
7179
7404
|
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
const attempt = () => {
|
|
7199
|
-
const el = document.getElementById(hash);
|
|
7200
|
-
if (el) {
|
|
7201
|
-
el.scrollIntoView({ behavior: scrollBehavior, block: "start" });
|
|
7202
|
-
return true;
|
|
7405
|
+
function ExampleSelector({
|
|
7406
|
+
examples,
|
|
7407
|
+
selectedName,
|
|
7408
|
+
onSelect
|
|
7409
|
+
}) {
|
|
7410
|
+
if (examples.length <= 1) {
|
|
7411
|
+
return null;
|
|
7412
|
+
}
|
|
7413
|
+
return /* @__PURE__ */ jsxs("div", { className: containerStyle, children: [
|
|
7414
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "example-selector", className: labelStyle, children: "Example:" }),
|
|
7415
|
+
/* @__PURE__ */ jsx(
|
|
7416
|
+
"select",
|
|
7417
|
+
{
|
|
7418
|
+
id: "example-selector",
|
|
7419
|
+
value: selectedName,
|
|
7420
|
+
onChange: (e) => onSelect(e.target.value),
|
|
7421
|
+
className: selectStyle,
|
|
7422
|
+
children: examples.map((example) => /* @__PURE__ */ jsx("option", { value: example.name, children: example.summary ? `${example.name} - ${example.summary}` : example.name }, example.name))
|
|
7203
7423
|
}
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
});
|
|
7220
|
-
}, [scrollBehavior]);
|
|
7221
|
-
return { navigateTo };
|
|
7424
|
+
)
|
|
7425
|
+
] });
|
|
7426
|
+
}
|
|
7427
|
+
function getNamedExamples(media) {
|
|
7428
|
+
if (media.example !== void 0) {
|
|
7429
|
+
return [{ name: "default", value: media.example }];
|
|
7430
|
+
}
|
|
7431
|
+
if (media.examples && typeof media.examples === "object") {
|
|
7432
|
+
return Object.entries(media.examples).map(([name, example]) => ({
|
|
7433
|
+
name,
|
|
7434
|
+
summary: example.summary,
|
|
7435
|
+
value: example.value
|
|
7436
|
+
}));
|
|
7437
|
+
}
|
|
7438
|
+
return [];
|
|
7222
7439
|
}
|
|
7223
|
-
|
|
7224
|
-
const ExpandableCard = memo(function ExpandableCard2({
|
|
7225
|
-
id,
|
|
7226
|
-
title,
|
|
7227
|
-
rightLabel,
|
|
7228
|
-
deprecated,
|
|
7229
|
-
badges,
|
|
7230
|
-
expandAll,
|
|
7231
|
-
expandGeneration,
|
|
7232
|
-
children
|
|
7233
|
-
}) {
|
|
7234
|
-
const { defaultExpandOperations } = useConfig();
|
|
7235
|
-
const [expanded, setExpanded] = useState(defaultExpandOperations);
|
|
7236
|
-
const [nearViewport, setNearViewport] = useState(false);
|
|
7237
|
-
const containerRef = useRef(null);
|
|
7238
|
-
const ctx = useExpandAll();
|
|
7239
|
-
const effectiveExpandAll = expandAll ?? ctx.expandAll;
|
|
7240
|
-
const effectiveGeneration = expandGeneration ?? ctx.expandGeneration;
|
|
7241
|
-
useEffect(() => {
|
|
7242
|
-
if (effectiveGeneration > 0) {
|
|
7243
|
-
setExpanded(!!effectiveExpandAll);
|
|
7244
|
-
}
|
|
7245
|
-
}, [effectiveExpandAll, effectiveGeneration]);
|
|
7246
|
-
useEffect(() => {
|
|
7247
|
-
if (!id) return;
|
|
7248
|
-
return onExpandRequest(id, () => setExpanded(true));
|
|
7249
|
-
}, [id]);
|
|
7250
|
-
useEffect(() => {
|
|
7251
|
-
const el = containerRef.current;
|
|
7252
|
-
if (!el) return;
|
|
7253
|
-
if (nearViewport) return;
|
|
7254
|
-
const observer = new IntersectionObserver(
|
|
7255
|
-
([entry]) => {
|
|
7256
|
-
if (entry.isIntersecting) {
|
|
7257
|
-
setNearViewport(true);
|
|
7258
|
-
observer.disconnect();
|
|
7259
|
-
}
|
|
7260
|
-
},
|
|
7261
|
-
{ rootMargin: "1000px" }
|
|
7262
|
-
);
|
|
7263
|
-
observer.observe(el);
|
|
7264
|
-
return () => observer.disconnect();
|
|
7265
|
-
}, [nearViewport]);
|
|
7266
|
-
const shouldRender = expanded && nearViewport;
|
|
7267
|
-
const handleClick = useCallback(() => {
|
|
7268
|
-
setExpanded((prev) => !prev);
|
|
7269
|
-
}, []);
|
|
7270
|
-
return /* @__PURE__ */ jsxs(
|
|
7271
|
-
"div",
|
|
7272
|
-
{
|
|
7273
|
-
ref: containerRef,
|
|
7274
|
-
id,
|
|
7275
|
-
className: cx(
|
|
7276
|
-
"omnispec-expandable-card",
|
|
7277
|
-
containerStyle,
|
|
7278
|
-
deprecated ? deprecatedStyle : void 0
|
|
7279
|
-
),
|
|
7280
|
-
children: [
|
|
7281
|
-
/* @__PURE__ */ jsxs(
|
|
7282
|
-
"button",
|
|
7283
|
-
{
|
|
7284
|
-
type: "button",
|
|
7285
|
-
onClick: handleClick,
|
|
7286
|
-
className: cx(headerStyle, expanded ? headerExpandedStyle : void 0),
|
|
7287
|
-
"aria-expanded": expanded,
|
|
7288
|
-
children: [
|
|
7289
|
-
/* @__PURE__ */ jsx("span", { className: cx(chevronStyle, expanded && chevronExpandedStyle), children: /* @__PURE__ */ jsx(Icon, { name: "chevron-right", size: "0.75rem" }) }),
|
|
7290
|
-
badges?.filter((b) => b.position === "before").map((b) => /* @__PURE__ */ jsx("span", { className: xBadgeStyle, style: { backgroundColor: b.color ?? "var(--omnispec-bg-tertiary)", color: b.color ? "#fff" : "var(--omnispec-fg-secondary)" }, children: b.name }, b.name)),
|
|
7291
|
-
/* @__PURE__ */ jsx("span", { className: titleStyle, children: title }),
|
|
7292
|
-
badges?.filter((b) => b.position !== "before").map((b) => /* @__PURE__ */ jsx("span", { className: xBadgeStyle, style: { backgroundColor: b.color ?? "var(--omnispec-bg-tertiary)", color: b.color ? "#fff" : "var(--omnispec-fg-secondary)" }, children: b.name }, b.name)),
|
|
7293
|
-
deprecated && /* @__PURE__ */ jsx("span", { className: deprecatedBadgeStyle, children: "Deprecated" }),
|
|
7294
|
-
rightLabel && /* @__PURE__ */ jsx("span", { className: rightLabelStyle, children: rightLabel })
|
|
7295
|
-
]
|
|
7296
|
-
}
|
|
7297
|
-
),
|
|
7298
|
-
shouldRender && /* @__PURE__ */ jsx("div", { className: bodyStyle, children })
|
|
7299
|
-
]
|
|
7300
|
-
}
|
|
7301
|
-
);
|
|
7302
|
-
});
|
|
7303
7440
|
const containerStyle = css({
|
|
7304
|
-
marginBottom: "0.75rem",
|
|
7305
|
-
maxWidth: "100%",
|
|
7306
|
-
borderRadius: "0.5rem",
|
|
7307
|
-
[mq.desktop]: {
|
|
7308
|
-
border: "1px solid var(--omnispec-border-color)",
|
|
7309
|
-
borderRadius: "0.5rem"
|
|
7310
|
-
}
|
|
7311
|
-
});
|
|
7312
|
-
const deprecatedStyle = css({
|
|
7313
|
-
opacity: 0.6
|
|
7314
|
-
});
|
|
7315
|
-
const headerStyle = css({
|
|
7316
7441
|
display: "flex",
|
|
7317
7442
|
alignItems: "center",
|
|
7318
|
-
gap: "0.
|
|
7319
|
-
|
|
7320
|
-
padding: "0.75rem 0",
|
|
7321
|
-
background: "var(--omnispec-bg-primary)",
|
|
7322
|
-
border: "none",
|
|
7323
|
-
borderBottom: "none",
|
|
7324
|
-
borderRadius: "0.5rem",
|
|
7325
|
-
cursor: "pointer",
|
|
7326
|
-
textAlign: "left",
|
|
7327
|
-
[mq.desktop]: {
|
|
7328
|
-
padding: "1rem"
|
|
7329
|
-
}
|
|
7330
|
-
});
|
|
7331
|
-
const headerExpandedStyle = css({});
|
|
7332
|
-
const chevronStyle = css({
|
|
7333
|
-
color: "var(--omnispec-fg-muted)",
|
|
7334
|
-
flexShrink: 0,
|
|
7335
|
-
transition: "transform 0.2s ease"
|
|
7336
|
-
});
|
|
7337
|
-
const chevronExpandedStyle = css({
|
|
7338
|
-
transform: "rotate(90deg)"
|
|
7339
|
-
});
|
|
7340
|
-
const titleStyle = css({
|
|
7341
|
-
fontWeight: 600,
|
|
7342
|
-
flex: 1,
|
|
7343
|
-
minWidth: 0,
|
|
7344
|
-
color: "var(--omnispec-fg-primary)",
|
|
7345
|
-
fontSize: "var(--omnispec-font-size-md)",
|
|
7346
|
-
textOverflow: "ellipsis",
|
|
7347
|
-
whiteSpace: "nowrap"
|
|
7443
|
+
gap: "0.5rem",
|
|
7444
|
+
marginBottom: "0.75rem"
|
|
7348
7445
|
});
|
|
7349
|
-
const
|
|
7446
|
+
const labelStyle = css({
|
|
7350
7447
|
fontSize: "var(--omnispec-font-size-xs)",
|
|
7351
7448
|
fontWeight: 600,
|
|
7352
|
-
|
|
7353
|
-
borderRadius: "1rem",
|
|
7354
|
-
whiteSpace: "nowrap",
|
|
7355
|
-
flexShrink: 0
|
|
7356
|
-
});
|
|
7357
|
-
const deprecatedBadgeStyle = css({
|
|
7358
|
-
fontSize: "10px",
|
|
7359
|
-
color: "var(--omnispec-color-warning)",
|
|
7360
|
-
fontWeight: 600,
|
|
7449
|
+
color: "var(--omnispec-fg-muted)",
|
|
7361
7450
|
textTransform: "uppercase",
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
borderRadius: "3px",
|
|
7365
|
-
flexShrink: 0
|
|
7451
|
+
letterSpacing: "0.5px",
|
|
7452
|
+
whiteSpace: "nowrap"
|
|
7366
7453
|
});
|
|
7367
|
-
const
|
|
7454
|
+
const selectStyle = css({
|
|
7455
|
+
padding: "0.375rem 0.625rem",
|
|
7456
|
+
border: "1px solid var(--omnispec-input-border)",
|
|
7457
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
7458
|
+
backgroundColor: "var(--omnispec-input-bg)",
|
|
7459
|
+
color: "var(--omnispec-fg-primary)",
|
|
7368
7460
|
fontSize: "var(--omnispec-font-size-sm)",
|
|
7369
|
-
|
|
7370
|
-
flexShrink: 0,
|
|
7371
|
-
marginLeft: "auto"
|
|
7372
|
-
});
|
|
7373
|
-
const bodyStyle = css({});
|
|
7374
|
-
|
|
7375
|
-
const barStyle = css({
|
|
7376
|
-
display: "flex",
|
|
7377
|
-
flexWrap: "wrap",
|
|
7378
|
-
alignItems: "center",
|
|
7379
|
-
gap: "12px",
|
|
7380
|
-
padding: "12px 16px",
|
|
7381
|
-
backgroundColor: "rgba(0, 0, 0, 0.02)",
|
|
7382
|
-
borderBottom: "1px solid var(--omnispec-border-color)",
|
|
7383
|
-
overflow: "hidden",
|
|
7384
|
-
maxWidth: "100%"
|
|
7385
|
-
});
|
|
7386
|
-
const pathStyle = css({
|
|
7387
|
-
minWidth: 0,
|
|
7388
|
-
wordBreak: "break-all"
|
|
7461
|
+
fontFamily: "var(--omnispec-font-mono)"
|
|
7389
7462
|
});
|
|
7390
|
-
function MethodBar({ label, path, color, method }) {
|
|
7391
|
-
return /* @__PURE__ */ jsxs("div", { className: barStyle, children: [
|
|
7392
|
-
/* @__PURE__ */ jsx(
|
|
7393
|
-
Badge,
|
|
7394
|
-
{
|
|
7395
|
-
label,
|
|
7396
|
-
variant: method ? "method" : "default",
|
|
7397
|
-
method,
|
|
7398
|
-
color
|
|
7399
|
-
}
|
|
7400
|
-
),
|
|
7401
|
-
/* @__PURE__ */ jsx("code", { className: pathStyle, children: path })
|
|
7402
|
-
] });
|
|
7403
|
-
}
|
|
7404
7463
|
|
|
7405
7464
|
const headerStyle_ = css({
|
|
7406
7465
|
display: "flex",
|
|
@@ -7478,5 +7537,5 @@ function Collapsible({ title, children, defaultOpen = false, headerStyle, expand
|
|
|
7478
7537
|
] });
|
|
7479
7538
|
}
|
|
7480
7539
|
|
|
7481
|
-
export { schemaToNodes as A, Badge as B, CodeBlock as C, useHashScroll as D, EnumItem as E, FieldDescription as F, useScrollSpy as G,
|
|
7482
|
-
//# sourceMappingURL=Collapsible-
|
|
7540
|
+
export { schemaToNodes as A, Badge as B, CodeBlock as C, useHashScroll as D, EnumItem as E, FieldDescription as F, useScrollSpy as G, ExampleSelector as H, buildConstraints as I, ExpandProvider as J, useExpandAll as K, getNamedExamples as L, MarkdownRenderer as M, PresentationChildren as P, SchemaBadge as S, Tabs as T, Collapsible as a, EnumLabel as b, EnumList as c, ExpandableCard as d, FieldName as e, MethodBar as f, PresentationContainer as g, PresentationRow as h, PropDefault as i, PropDesc as j, PropFormat as k, PropName as l, PropReq as m, PropRequiredStar as n, PropType as o, SchemaPropChildren as p, SchemaPropRow as q, SchemaRefLink as r, SchemaSectionTitle as s, SchemaTree as t, SearchBar as u, SpecToolbar as v, flattenNavItemIds as w, generateExample as x, requestExpand as y, resolveDownloadLink as z };
|
|
7541
|
+
//# sourceMappingURL=Collapsible-0ryLh6wX.js.map
|