@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
|
@@ -63,6 +63,50 @@ function useScrollSpy(ids, rootMargin = "0px 0px -80% 0px") {
|
|
|
63
63
|
return activeId;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
const expandListeners = /* @__PURE__ */ new Map();
|
|
67
|
+
function onExpandRequest(id, callback) {
|
|
68
|
+
expandListeners.set(id, callback);
|
|
69
|
+
return () => {
|
|
70
|
+
expandListeners.delete(id);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function requestExpand(id) {
|
|
74
|
+
const listener = expandListeners.get(id);
|
|
75
|
+
if (listener) listener();
|
|
76
|
+
}
|
|
77
|
+
const SMOOTH_THRESHOLD = 50;
|
|
78
|
+
function useHashScroll(operationCount = 0) {
|
|
79
|
+
const scrollBehavior = operationCount > SMOOTH_THRESHOLD ? "instant" : "smooth";
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
const hash = window.location.hash.slice(1);
|
|
82
|
+
if (!hash) return;
|
|
83
|
+
requestExpand(hash);
|
|
84
|
+
const attempt = () => {
|
|
85
|
+
const el = document.getElementById(hash);
|
|
86
|
+
if (el) {
|
|
87
|
+
el.scrollIntoView({ behavior: scrollBehavior, block: "start" });
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
};
|
|
92
|
+
if (attempt()) return;
|
|
93
|
+
let tries = 0;
|
|
94
|
+
const interval = setInterval(() => {
|
|
95
|
+
if (attempt() || ++tries >= 10) clearInterval(interval);
|
|
96
|
+
}, 200);
|
|
97
|
+
return () => clearInterval(interval);
|
|
98
|
+
}, [scrollBehavior]);
|
|
99
|
+
const navigateTo = React.useCallback((id) => {
|
|
100
|
+
window.history.replaceState(null, "", `#${id}`);
|
|
101
|
+
requestExpand(id);
|
|
102
|
+
requestAnimationFrame(() => {
|
|
103
|
+
const el = document.getElementById(id);
|
|
104
|
+
el?.scrollIntoView({ behavior: scrollBehavior, block: "start" });
|
|
105
|
+
});
|
|
106
|
+
}, [scrollBehavior]);
|
|
107
|
+
return { navigateTo };
|
|
108
|
+
}
|
|
109
|
+
|
|
66
110
|
function SearchBar({ placeholder = "Search...", onSearch }) {
|
|
67
111
|
const [value, setValue] = React.useState("");
|
|
68
112
|
const handleChange = React.useCallback((e) => {
|
|
@@ -70,7 +114,7 @@ function SearchBar({ placeholder = "Search...", onSearch }) {
|
|
|
70
114
|
setValue(query);
|
|
71
115
|
onSearch(query);
|
|
72
116
|
}, [onSearch]);
|
|
73
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `omnispec-search ${containerStyle$
|
|
117
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `omnispec-search ${containerStyle$5}`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
74
118
|
"input",
|
|
75
119
|
{
|
|
76
120
|
type: "text",
|
|
@@ -82,7 +126,7 @@ function SearchBar({ placeholder = "Search...", onSearch }) {
|
|
|
82
126
|
}
|
|
83
127
|
) });
|
|
84
128
|
}
|
|
85
|
-
const containerStyle$
|
|
129
|
+
const containerStyle$5 = css.css({
|
|
86
130
|
padding: "12px"
|
|
87
131
|
});
|
|
88
132
|
const inputStyle = css.css({
|
|
@@ -108,7 +152,7 @@ function SpecToolbar({
|
|
|
108
152
|
onToggleExpand,
|
|
109
153
|
downloadLink
|
|
110
154
|
}) {
|
|
111
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerStyle$
|
|
155
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerStyle$4, children: [
|
|
112
156
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: overviewWrapStyle, children: overview }),
|
|
113
157
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: actionsStyle, children: [
|
|
114
158
|
versionBadge && /* @__PURE__ */ jsxRuntime.jsx("div", { className: mobileBadgeStyle, children: versionBadge }),
|
|
@@ -133,7 +177,7 @@ function SpecToolbar({
|
|
|
133
177
|
] })
|
|
134
178
|
] });
|
|
135
179
|
}
|
|
136
|
-
const containerStyle$
|
|
180
|
+
const containerStyle$4 = css.css({
|
|
137
181
|
display: "flex",
|
|
138
182
|
alignItems: "flex-start",
|
|
139
183
|
justifyContent: "space-between",
|
|
@@ -2457,7 +2501,7 @@ marked.setOptions({
|
|
|
2457
2501
|
breaks: false,
|
|
2458
2502
|
gfm: true
|
|
2459
2503
|
});
|
|
2460
|
-
const containerStyle$
|
|
2504
|
+
const containerStyle$3 = css.css({
|
|
2461
2505
|
color: "var(--omnispec-fg-primary)",
|
|
2462
2506
|
fontSize: "var(--omnispec-font-size-base)",
|
|
2463
2507
|
lineHeight: 1.6
|
|
@@ -2470,7 +2514,7 @@ function MarkdownRenderer({ content, className }) {
|
|
|
2470
2514
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2471
2515
|
"div",
|
|
2472
2516
|
{
|
|
2473
|
-
className: css.cx("omnispec-markdown", containerStyle$
|
|
2517
|
+
className: css.cx("omnispec-markdown", containerStyle$3, className),
|
|
2474
2518
|
dangerouslySetInnerHTML: { __html: html }
|
|
2475
2519
|
}
|
|
2476
2520
|
);
|
|
@@ -3612,6 +3656,187 @@ function generateNumberExample(format, minimum) {
|
|
|
3612
3656
|
}
|
|
3613
3657
|
}
|
|
3614
3658
|
|
|
3659
|
+
const ExpandableCard = React.memo(function ExpandableCard2({
|
|
3660
|
+
id,
|
|
3661
|
+
title,
|
|
3662
|
+
rightLabel,
|
|
3663
|
+
deprecated,
|
|
3664
|
+
badges,
|
|
3665
|
+
expandAll,
|
|
3666
|
+
expandGeneration,
|
|
3667
|
+
children
|
|
3668
|
+
}) {
|
|
3669
|
+
const { defaultExpandOperations } = useSpecFetcher.useConfig();
|
|
3670
|
+
const [expanded, setExpanded] = React.useState(defaultExpandOperations);
|
|
3671
|
+
const [nearViewport, setNearViewport] = React.useState(false);
|
|
3672
|
+
const containerRef = React.useRef(null);
|
|
3673
|
+
const ctx = useExpandAll();
|
|
3674
|
+
const effectiveExpandAll = expandAll ?? ctx.expandAll;
|
|
3675
|
+
const effectiveGeneration = expandGeneration ?? ctx.expandGeneration;
|
|
3676
|
+
React.useEffect(() => {
|
|
3677
|
+
if (effectiveGeneration > 0) {
|
|
3678
|
+
setExpanded(!!effectiveExpandAll);
|
|
3679
|
+
}
|
|
3680
|
+
}, [effectiveExpandAll, effectiveGeneration]);
|
|
3681
|
+
React.useEffect(() => {
|
|
3682
|
+
if (!id) return;
|
|
3683
|
+
return onExpandRequest(id, () => setExpanded(true));
|
|
3684
|
+
}, [id]);
|
|
3685
|
+
React.useEffect(() => {
|
|
3686
|
+
const el = containerRef.current;
|
|
3687
|
+
if (!el) return;
|
|
3688
|
+
if (nearViewport) return;
|
|
3689
|
+
const observer = new IntersectionObserver(
|
|
3690
|
+
([entry]) => {
|
|
3691
|
+
if (entry.isIntersecting) {
|
|
3692
|
+
setNearViewport(true);
|
|
3693
|
+
observer.disconnect();
|
|
3694
|
+
}
|
|
3695
|
+
},
|
|
3696
|
+
{ rootMargin: "1000px" }
|
|
3697
|
+
);
|
|
3698
|
+
observer.observe(el);
|
|
3699
|
+
return () => observer.disconnect();
|
|
3700
|
+
}, [nearViewport]);
|
|
3701
|
+
const shouldRender = expanded && nearViewport;
|
|
3702
|
+
const handleClick = React.useCallback(() => {
|
|
3703
|
+
setExpanded((prev) => !prev);
|
|
3704
|
+
}, []);
|
|
3705
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3706
|
+
"div",
|
|
3707
|
+
{
|
|
3708
|
+
ref: containerRef,
|
|
3709
|
+
id,
|
|
3710
|
+
className: css.cx(
|
|
3711
|
+
"omnispec-expandable-card",
|
|
3712
|
+
containerStyle$2,
|
|
3713
|
+
deprecated ? deprecatedStyle : void 0
|
|
3714
|
+
),
|
|
3715
|
+
children: [
|
|
3716
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3717
|
+
"button",
|
|
3718
|
+
{
|
|
3719
|
+
type: "button",
|
|
3720
|
+
onClick: handleClick,
|
|
3721
|
+
className: css.cx(headerStyle$2, expanded ? headerExpandedStyle : void 0),
|
|
3722
|
+
"aria-expanded": expanded,
|
|
3723
|
+
children: [
|
|
3724
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: css.cx(chevronStyle, expanded && chevronExpandedStyle), children: /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "chevron-right", size: "0.75rem" }) }),
|
|
3725
|
+
badges?.filter((b) => b.position === "before").map((b) => /* @__PURE__ */ jsxRuntime.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)),
|
|
3726
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: titleStyle$1, children: title }),
|
|
3727
|
+
badges?.filter((b) => b.position !== "before").map((b) => /* @__PURE__ */ jsxRuntime.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)),
|
|
3728
|
+
deprecated && /* @__PURE__ */ jsxRuntime.jsx("span", { className: deprecatedBadgeStyle, children: "Deprecated" }),
|
|
3729
|
+
rightLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: rightLabelStyle, children: rightLabel })
|
|
3730
|
+
]
|
|
3731
|
+
}
|
|
3732
|
+
),
|
|
3733
|
+
shouldRender && /* @__PURE__ */ jsxRuntime.jsx("div", { className: bodyStyle, children })
|
|
3734
|
+
]
|
|
3735
|
+
}
|
|
3736
|
+
);
|
|
3737
|
+
});
|
|
3738
|
+
const containerStyle$2 = css.css({
|
|
3739
|
+
marginBottom: "0.75rem",
|
|
3740
|
+
maxWidth: "100%",
|
|
3741
|
+
borderRadius: "0.5rem",
|
|
3742
|
+
[useSpecFetcher.mq.desktop]: {
|
|
3743
|
+
border: "1px solid var(--omnispec-border-color)",
|
|
3744
|
+
borderRadius: "0.5rem"
|
|
3745
|
+
}
|
|
3746
|
+
});
|
|
3747
|
+
const deprecatedStyle = css.css({
|
|
3748
|
+
opacity: 0.6
|
|
3749
|
+
});
|
|
3750
|
+
const headerStyle$2 = css.css({
|
|
3751
|
+
display: "flex",
|
|
3752
|
+
alignItems: "center",
|
|
3753
|
+
gap: "0.75rem",
|
|
3754
|
+
width: "100%",
|
|
3755
|
+
padding: "0.75rem 0",
|
|
3756
|
+
background: "var(--omnispec-bg-primary)",
|
|
3757
|
+
border: "none",
|
|
3758
|
+
borderBottom: "none",
|
|
3759
|
+
borderRadius: "0.5rem",
|
|
3760
|
+
cursor: "pointer",
|
|
3761
|
+
textAlign: "left",
|
|
3762
|
+
[useSpecFetcher.mq.desktop]: {
|
|
3763
|
+
padding: "1rem"
|
|
3764
|
+
}
|
|
3765
|
+
});
|
|
3766
|
+
const headerExpandedStyle = css.css({});
|
|
3767
|
+
const chevronStyle = css.css({
|
|
3768
|
+
color: "var(--omnispec-fg-muted)",
|
|
3769
|
+
flexShrink: 0,
|
|
3770
|
+
transition: "transform 0.2s ease"
|
|
3771
|
+
});
|
|
3772
|
+
const chevronExpandedStyle = css.css({
|
|
3773
|
+
transform: "rotate(90deg)"
|
|
3774
|
+
});
|
|
3775
|
+
const titleStyle$1 = css.css({
|
|
3776
|
+
fontWeight: 600,
|
|
3777
|
+
flex: 1,
|
|
3778
|
+
minWidth: 0,
|
|
3779
|
+
color: "var(--omnispec-fg-primary)",
|
|
3780
|
+
fontSize: "var(--omnispec-font-size-md)",
|
|
3781
|
+
textOverflow: "ellipsis",
|
|
3782
|
+
whiteSpace: "nowrap"
|
|
3783
|
+
});
|
|
3784
|
+
const xBadgeStyle = css.css({
|
|
3785
|
+
fontSize: "var(--omnispec-font-size-xs)",
|
|
3786
|
+
fontWeight: 600,
|
|
3787
|
+
padding: "0.125rem 0.5rem",
|
|
3788
|
+
borderRadius: "1rem",
|
|
3789
|
+
whiteSpace: "nowrap",
|
|
3790
|
+
flexShrink: 0
|
|
3791
|
+
});
|
|
3792
|
+
const deprecatedBadgeStyle = css.css({
|
|
3793
|
+
fontSize: "10px",
|
|
3794
|
+
color: "var(--omnispec-color-warning)",
|
|
3795
|
+
fontWeight: 600,
|
|
3796
|
+
textTransform: "uppercase",
|
|
3797
|
+
border: "1px solid var(--omnispec-color-warning)",
|
|
3798
|
+
padding: "1px 5px",
|
|
3799
|
+
borderRadius: "3px",
|
|
3800
|
+
flexShrink: 0
|
|
3801
|
+
});
|
|
3802
|
+
const rightLabelStyle = css.css({
|
|
3803
|
+
fontSize: "var(--omnispec-font-size-sm)",
|
|
3804
|
+
color: "var(--omnispec-fg-muted)",
|
|
3805
|
+
flexShrink: 0,
|
|
3806
|
+
marginLeft: "auto"
|
|
3807
|
+
});
|
|
3808
|
+
const bodyStyle = css.css({});
|
|
3809
|
+
|
|
3810
|
+
const barStyle = css.css({
|
|
3811
|
+
display: "flex",
|
|
3812
|
+
flexWrap: "wrap",
|
|
3813
|
+
alignItems: "center",
|
|
3814
|
+
gap: "12px",
|
|
3815
|
+
padding: "12px 16px",
|
|
3816
|
+
backgroundColor: "rgba(0, 0, 0, 0.02)",
|
|
3817
|
+
borderBottom: "1px solid var(--omnispec-border-color)",
|
|
3818
|
+
overflow: "hidden",
|
|
3819
|
+
maxWidth: "100%"
|
|
3820
|
+
});
|
|
3821
|
+
const pathStyle = css.css({
|
|
3822
|
+
minWidth: 0,
|
|
3823
|
+
wordBreak: "break-all"
|
|
3824
|
+
});
|
|
3825
|
+
function MethodBar({ label, path, color, method }) {
|
|
3826
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: barStyle, children: [
|
|
3827
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3828
|
+
Badge,
|
|
3829
|
+
{
|
|
3830
|
+
label,
|
|
3831
|
+
variant: method ? "method" : "default",
|
|
3832
|
+
method,
|
|
3833
|
+
color
|
|
3834
|
+
}
|
|
3835
|
+
),
|
|
3836
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { className: pathStyle, children: path })
|
|
3837
|
+
] });
|
|
3838
|
+
}
|
|
3839
|
+
|
|
3615
3840
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
3616
3841
|
|
|
3617
3842
|
function getDefaultExportFromCjs (x) {
|
|
@@ -7004,9 +7229,9 @@ function CodeBlock({
|
|
|
7004
7229
|
}, [code]);
|
|
7005
7230
|
const hasHeader = title || showCopy || headerLeft;
|
|
7006
7231
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: css.cx("omnispec-code-block", containerStyle$1), children: [
|
|
7007
|
-
hasHeader && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: headerStyle$
|
|
7232
|
+
hasHeader && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: headerStyle$1, children: [
|
|
7008
7233
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: headerLeftStyle, children: [
|
|
7009
|
-
title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: titleStyle
|
|
7234
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: titleStyle, children: title }),
|
|
7010
7235
|
headerLeft
|
|
7011
7236
|
] }),
|
|
7012
7237
|
showCopy && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7056,7 +7281,7 @@ const containerStyle$1 = css.css({
|
|
|
7056
7281
|
border: "1px solid var(--omnispec-border-color)"
|
|
7057
7282
|
}
|
|
7058
7283
|
});
|
|
7059
|
-
const headerStyle$
|
|
7284
|
+
const headerStyle$1 = css.css({
|
|
7060
7285
|
display: "flex",
|
|
7061
7286
|
justifyContent: "space-between",
|
|
7062
7287
|
alignItems: "center",
|
|
@@ -7073,7 +7298,7 @@ const headerLeftStyle = css.css({
|
|
|
7073
7298
|
minWidth: 0,
|
|
7074
7299
|
overflow: "hidden"
|
|
7075
7300
|
});
|
|
7076
|
-
const titleStyle
|
|
7301
|
+
const titleStyle = css.css({
|
|
7077
7302
|
fontFamily: "var(--omnispec-font-mono)",
|
|
7078
7303
|
fontSize: "var(--omnispec-font-size-xs)",
|
|
7079
7304
|
color: "var(--omnispec-fg-muted)",
|
|
@@ -7104,7 +7329,7 @@ const preStyle = css.css({
|
|
|
7104
7329
|
}
|
|
7105
7330
|
});
|
|
7106
7331
|
|
|
7107
|
-
const headerStyle
|
|
7332
|
+
const headerStyle = css.css({
|
|
7108
7333
|
display: "flex",
|
|
7109
7334
|
gap: "0.125rem",
|
|
7110
7335
|
marginBottom: "-1px",
|
|
@@ -7163,7 +7388,7 @@ function Tabs({ tabs, defaultTab, flush = false }) {
|
|
|
7163
7388
|
const [activeTab, setActiveTab] = React.useState(defaultTab ?? tabs[0]?.id ?? "");
|
|
7164
7389
|
const activeContent = tabs.find((t) => t.id === activeTab)?.content;
|
|
7165
7390
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "omnispec-tabs", children: [
|
|
7166
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: css.cx(headerStyle
|
|
7391
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: css.cx(headerStyle, flush && flushHeaderStyle), role: "tablist", children: tabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7167
7392
|
"button",
|
|
7168
7393
|
{
|
|
7169
7394
|
type: "button",
|
|
@@ -7183,230 +7408,64 @@ function Tabs({ tabs, defaultTab, flush = false }) {
|
|
|
7183
7408
|
] });
|
|
7184
7409
|
}
|
|
7185
7410
|
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
const attempt = () => {
|
|
7205
|
-
const el = document.getElementById(hash);
|
|
7206
|
-
if (el) {
|
|
7207
|
-
el.scrollIntoView({ behavior: scrollBehavior, block: "start" });
|
|
7208
|
-
return true;
|
|
7411
|
+
function ExampleSelector({
|
|
7412
|
+
examples,
|
|
7413
|
+
selectedName,
|
|
7414
|
+
onSelect
|
|
7415
|
+
}) {
|
|
7416
|
+
if (examples.length <= 1) {
|
|
7417
|
+
return null;
|
|
7418
|
+
}
|
|
7419
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: containerStyle, children: [
|
|
7420
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "example-selector", className: labelStyle, children: "Example:" }),
|
|
7421
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7422
|
+
"select",
|
|
7423
|
+
{
|
|
7424
|
+
id: "example-selector",
|
|
7425
|
+
value: selectedName,
|
|
7426
|
+
onChange: (e) => onSelect(e.target.value),
|
|
7427
|
+
className: selectStyle,
|
|
7428
|
+
children: examples.map((example) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: example.name, children: example.summary ? `${example.name} - ${example.summary}` : example.name }, example.name))
|
|
7209
7429
|
}
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
});
|
|
7226
|
-
}, [scrollBehavior]);
|
|
7227
|
-
return { navigateTo };
|
|
7430
|
+
)
|
|
7431
|
+
] });
|
|
7432
|
+
}
|
|
7433
|
+
function getNamedExamples(media) {
|
|
7434
|
+
if (media.example !== void 0) {
|
|
7435
|
+
return [{ name: "default", value: media.example }];
|
|
7436
|
+
}
|
|
7437
|
+
if (media.examples && typeof media.examples === "object") {
|
|
7438
|
+
return Object.entries(media.examples).map(([name, example]) => ({
|
|
7439
|
+
name,
|
|
7440
|
+
summary: example.summary,
|
|
7441
|
+
value: example.value
|
|
7442
|
+
}));
|
|
7443
|
+
}
|
|
7444
|
+
return [];
|
|
7228
7445
|
}
|
|
7229
|
-
|
|
7230
|
-
const ExpandableCard = React.memo(function ExpandableCard2({
|
|
7231
|
-
id,
|
|
7232
|
-
title,
|
|
7233
|
-
rightLabel,
|
|
7234
|
-
deprecated,
|
|
7235
|
-
badges,
|
|
7236
|
-
expandAll,
|
|
7237
|
-
expandGeneration,
|
|
7238
|
-
children
|
|
7239
|
-
}) {
|
|
7240
|
-
const { defaultExpandOperations } = useSpecFetcher.useConfig();
|
|
7241
|
-
const [expanded, setExpanded] = React.useState(defaultExpandOperations);
|
|
7242
|
-
const [nearViewport, setNearViewport] = React.useState(false);
|
|
7243
|
-
const containerRef = React.useRef(null);
|
|
7244
|
-
const ctx = useExpandAll();
|
|
7245
|
-
const effectiveExpandAll = expandAll ?? ctx.expandAll;
|
|
7246
|
-
const effectiveGeneration = expandGeneration ?? ctx.expandGeneration;
|
|
7247
|
-
React.useEffect(() => {
|
|
7248
|
-
if (effectiveGeneration > 0) {
|
|
7249
|
-
setExpanded(!!effectiveExpandAll);
|
|
7250
|
-
}
|
|
7251
|
-
}, [effectiveExpandAll, effectiveGeneration]);
|
|
7252
|
-
React.useEffect(() => {
|
|
7253
|
-
if (!id) return;
|
|
7254
|
-
return onExpandRequest(id, () => setExpanded(true));
|
|
7255
|
-
}, [id]);
|
|
7256
|
-
React.useEffect(() => {
|
|
7257
|
-
const el = containerRef.current;
|
|
7258
|
-
if (!el) return;
|
|
7259
|
-
if (nearViewport) return;
|
|
7260
|
-
const observer = new IntersectionObserver(
|
|
7261
|
-
([entry]) => {
|
|
7262
|
-
if (entry.isIntersecting) {
|
|
7263
|
-
setNearViewport(true);
|
|
7264
|
-
observer.disconnect();
|
|
7265
|
-
}
|
|
7266
|
-
},
|
|
7267
|
-
{ rootMargin: "1000px" }
|
|
7268
|
-
);
|
|
7269
|
-
observer.observe(el);
|
|
7270
|
-
return () => observer.disconnect();
|
|
7271
|
-
}, [nearViewport]);
|
|
7272
|
-
const shouldRender = expanded && nearViewport;
|
|
7273
|
-
const handleClick = React.useCallback(() => {
|
|
7274
|
-
setExpanded((prev) => !prev);
|
|
7275
|
-
}, []);
|
|
7276
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7277
|
-
"div",
|
|
7278
|
-
{
|
|
7279
|
-
ref: containerRef,
|
|
7280
|
-
id,
|
|
7281
|
-
className: css.cx(
|
|
7282
|
-
"omnispec-expandable-card",
|
|
7283
|
-
containerStyle,
|
|
7284
|
-
deprecated ? deprecatedStyle : void 0
|
|
7285
|
-
),
|
|
7286
|
-
children: [
|
|
7287
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7288
|
-
"button",
|
|
7289
|
-
{
|
|
7290
|
-
type: "button",
|
|
7291
|
-
onClick: handleClick,
|
|
7292
|
-
className: css.cx(headerStyle, expanded ? headerExpandedStyle : void 0),
|
|
7293
|
-
"aria-expanded": expanded,
|
|
7294
|
-
children: [
|
|
7295
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: css.cx(chevronStyle, expanded && chevronExpandedStyle), children: /* @__PURE__ */ jsxRuntime.jsx(useSpecFetcher.Icon, { name: "chevron-right", size: "0.75rem" }) }),
|
|
7296
|
-
badges?.filter((b) => b.position === "before").map((b) => /* @__PURE__ */ jsxRuntime.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)),
|
|
7297
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: titleStyle, children: title }),
|
|
7298
|
-
badges?.filter((b) => b.position !== "before").map((b) => /* @__PURE__ */ jsxRuntime.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)),
|
|
7299
|
-
deprecated && /* @__PURE__ */ jsxRuntime.jsx("span", { className: deprecatedBadgeStyle, children: "Deprecated" }),
|
|
7300
|
-
rightLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: rightLabelStyle, children: rightLabel })
|
|
7301
|
-
]
|
|
7302
|
-
}
|
|
7303
|
-
),
|
|
7304
|
-
shouldRender && /* @__PURE__ */ jsxRuntime.jsx("div", { className: bodyStyle, children })
|
|
7305
|
-
]
|
|
7306
|
-
}
|
|
7307
|
-
);
|
|
7308
|
-
});
|
|
7309
7446
|
const containerStyle = css.css({
|
|
7310
|
-
marginBottom: "0.75rem",
|
|
7311
|
-
maxWidth: "100%",
|
|
7312
|
-
borderRadius: "0.5rem",
|
|
7313
|
-
[useSpecFetcher.mq.desktop]: {
|
|
7314
|
-
border: "1px solid var(--omnispec-border-color)",
|
|
7315
|
-
borderRadius: "0.5rem"
|
|
7316
|
-
}
|
|
7317
|
-
});
|
|
7318
|
-
const deprecatedStyle = css.css({
|
|
7319
|
-
opacity: 0.6
|
|
7320
|
-
});
|
|
7321
|
-
const headerStyle = css.css({
|
|
7322
7447
|
display: "flex",
|
|
7323
7448
|
alignItems: "center",
|
|
7324
|
-
gap: "0.
|
|
7325
|
-
|
|
7326
|
-
padding: "0.75rem 0",
|
|
7327
|
-
background: "var(--omnispec-bg-primary)",
|
|
7328
|
-
border: "none",
|
|
7329
|
-
borderBottom: "none",
|
|
7330
|
-
borderRadius: "0.5rem",
|
|
7331
|
-
cursor: "pointer",
|
|
7332
|
-
textAlign: "left",
|
|
7333
|
-
[useSpecFetcher.mq.desktop]: {
|
|
7334
|
-
padding: "1rem"
|
|
7335
|
-
}
|
|
7336
|
-
});
|
|
7337
|
-
const headerExpandedStyle = css.css({});
|
|
7338
|
-
const chevronStyle = css.css({
|
|
7339
|
-
color: "var(--omnispec-fg-muted)",
|
|
7340
|
-
flexShrink: 0,
|
|
7341
|
-
transition: "transform 0.2s ease"
|
|
7342
|
-
});
|
|
7343
|
-
const chevronExpandedStyle = css.css({
|
|
7344
|
-
transform: "rotate(90deg)"
|
|
7345
|
-
});
|
|
7346
|
-
const titleStyle = css.css({
|
|
7347
|
-
fontWeight: 600,
|
|
7348
|
-
flex: 1,
|
|
7349
|
-
minWidth: 0,
|
|
7350
|
-
color: "var(--omnispec-fg-primary)",
|
|
7351
|
-
fontSize: "var(--omnispec-font-size-md)",
|
|
7352
|
-
textOverflow: "ellipsis",
|
|
7353
|
-
whiteSpace: "nowrap"
|
|
7449
|
+
gap: "0.5rem",
|
|
7450
|
+
marginBottom: "0.75rem"
|
|
7354
7451
|
});
|
|
7355
|
-
const
|
|
7452
|
+
const labelStyle = css.css({
|
|
7356
7453
|
fontSize: "var(--omnispec-font-size-xs)",
|
|
7357
7454
|
fontWeight: 600,
|
|
7358
|
-
|
|
7359
|
-
borderRadius: "1rem",
|
|
7360
|
-
whiteSpace: "nowrap",
|
|
7361
|
-
flexShrink: 0
|
|
7362
|
-
});
|
|
7363
|
-
const deprecatedBadgeStyle = css.css({
|
|
7364
|
-
fontSize: "10px",
|
|
7365
|
-
color: "var(--omnispec-color-warning)",
|
|
7366
|
-
fontWeight: 600,
|
|
7455
|
+
color: "var(--omnispec-fg-muted)",
|
|
7367
7456
|
textTransform: "uppercase",
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
borderRadius: "3px",
|
|
7371
|
-
flexShrink: 0
|
|
7457
|
+
letterSpacing: "0.5px",
|
|
7458
|
+
whiteSpace: "nowrap"
|
|
7372
7459
|
});
|
|
7373
|
-
const
|
|
7460
|
+
const selectStyle = css.css({
|
|
7461
|
+
padding: "0.375rem 0.625rem",
|
|
7462
|
+
border: "1px solid var(--omnispec-input-border)",
|
|
7463
|
+
borderRadius: "var(--omnispec-border-radius)",
|
|
7464
|
+
backgroundColor: "var(--omnispec-input-bg)",
|
|
7465
|
+
color: "var(--omnispec-fg-primary)",
|
|
7374
7466
|
fontSize: "var(--omnispec-font-size-sm)",
|
|
7375
|
-
|
|
7376
|
-
flexShrink: 0,
|
|
7377
|
-
marginLeft: "auto"
|
|
7378
|
-
});
|
|
7379
|
-
const bodyStyle = css.css({});
|
|
7380
|
-
|
|
7381
|
-
const barStyle = css.css({
|
|
7382
|
-
display: "flex",
|
|
7383
|
-
flexWrap: "wrap",
|
|
7384
|
-
alignItems: "center",
|
|
7385
|
-
gap: "12px",
|
|
7386
|
-
padding: "12px 16px",
|
|
7387
|
-
backgroundColor: "rgba(0, 0, 0, 0.02)",
|
|
7388
|
-
borderBottom: "1px solid var(--omnispec-border-color)",
|
|
7389
|
-
overflow: "hidden",
|
|
7390
|
-
maxWidth: "100%"
|
|
7391
|
-
});
|
|
7392
|
-
const pathStyle = css.css({
|
|
7393
|
-
minWidth: 0,
|
|
7394
|
-
wordBreak: "break-all"
|
|
7467
|
+
fontFamily: "var(--omnispec-font-mono)"
|
|
7395
7468
|
});
|
|
7396
|
-
function MethodBar({ label, path, color, method }) {
|
|
7397
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: barStyle, children: [
|
|
7398
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7399
|
-
Badge,
|
|
7400
|
-
{
|
|
7401
|
-
label,
|
|
7402
|
-
variant: method ? "method" : "default",
|
|
7403
|
-
method,
|
|
7404
|
-
color
|
|
7405
|
-
}
|
|
7406
|
-
),
|
|
7407
|
-
/* @__PURE__ */ jsxRuntime.jsx("code", { className: pathStyle, children: path })
|
|
7408
|
-
] });
|
|
7409
|
-
}
|
|
7410
7469
|
|
|
7411
7470
|
const headerStyle_ = css.css({
|
|
7412
7471
|
display: "flex",
|
|
@@ -7490,6 +7549,7 @@ exports.Collapsible = Collapsible;
|
|
|
7490
7549
|
exports.EnumItem = EnumItem;
|
|
7491
7550
|
exports.EnumLabel = EnumLabel;
|
|
7492
7551
|
exports.EnumList = EnumList;
|
|
7552
|
+
exports.ExampleSelector = ExampleSelector;
|
|
7493
7553
|
exports.ExpandProvider = ExpandProvider;
|
|
7494
7554
|
exports.ExpandableCard = ExpandableCard;
|
|
7495
7555
|
exports.FieldDescription = FieldDescription;
|
|
@@ -7518,10 +7578,11 @@ exports.Tabs = Tabs;
|
|
|
7518
7578
|
exports.buildConstraints = buildConstraints;
|
|
7519
7579
|
exports.flattenNavItemIds = flattenNavItemIds;
|
|
7520
7580
|
exports.generateExample = generateExample;
|
|
7581
|
+
exports.getNamedExamples = getNamedExamples;
|
|
7521
7582
|
exports.requestExpand = requestExpand;
|
|
7522
7583
|
exports.resolveDownloadLink = resolveDownloadLink;
|
|
7523
7584
|
exports.schemaToNodes = schemaToNodes;
|
|
7524
7585
|
exports.useExpandAll = useExpandAll;
|
|
7525
7586
|
exports.useHashScroll = useHashScroll;
|
|
7526
7587
|
exports.useScrollSpy = useScrollSpy;
|
|
7527
|
-
//# sourceMappingURL=Collapsible-
|
|
7588
|
+
//# sourceMappingURL=Collapsible-Jlb_vtdW.js.map
|