@apiboost/omnispec 1.0.0 → 1.1.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/cjs/asyncapi/index.js +5 -5
  2. package/dist/cjs/chunks/AsyncApiSpec-Bj1F8C5K.js +2601 -0
  3. package/dist/cjs/chunks/AsyncApiSpec-Bj1F8C5K.js.map +1 -0
  4. package/dist/cjs/chunks/{Collapsible-BHAHk_Ep.js → Collapsible-BTWyDBkX.js} +429 -209
  5. package/dist/cjs/chunks/Collapsible-BTWyDBkX.js.map +1 -0
  6. package/dist/cjs/chunks/{ErrorBoundary-c1piU8da.js → ErrorBoundary-CezYgQDG.js} +2 -2
  7. package/dist/cjs/chunks/{ErrorBoundary-c1piU8da.js.map → ErrorBoundary-CezYgQDG.js.map} +1 -1
  8. package/dist/cjs/chunks/{OmniSpecRenderer-CE4wxVTL.js → OmniSpecRenderer-CghCPNuw.js} +6 -6
  9. package/dist/cjs/chunks/{OmniSpecRenderer-CE4wxVTL.js.map → OmniSpecRenderer-CghCPNuw.js.map} +1 -1
  10. package/dist/cjs/chunks/{OpenApiSpec-D0JtmOVQ.js → OpenApiSpec-BOlesoUX.js} +12 -12
  11. package/dist/cjs/chunks/OpenApiSpec-BOlesoUX.js.map +1 -0
  12. package/dist/cjs/chunks/{OpenIdConnectManual-oEnN0QJ-.js → OpenIdConnectManual-Bh7tdxoH.js} +7 -227
  13. package/dist/cjs/chunks/OpenIdConnectManual-Bh7tdxoH.js.map +1 -0
  14. package/dist/cjs/chunks/{ref-resolver-DWu6Q6E5.js → ref-resolver-0A8GNRI3.js} +6 -2
  15. package/dist/cjs/chunks/{ref-resolver-DWu6Q6E5.js.map → ref-resolver-0A8GNRI3.js.map} +1 -1
  16. package/dist/cjs/chunks/{useSpecDetector-A4OwYrmY.js → useSpecDetector-BemsWW9u.js} +2 -2
  17. package/dist/cjs/chunks/{useSpecDetector-A4OwYrmY.js.map → useSpecDetector-BemsWW9u.js.map} +1 -1
  18. package/dist/cjs/chunks/{useSpecFetcher-BKz1jHTV.js → useSpecFetcher-BAbHnXax.js} +28 -1
  19. package/dist/{esm/chunks/useSpecFetcher-CZvAnU7Z.js.map → cjs/chunks/useSpecFetcher-BAbHnXax.js.map} +1 -1
  20. package/dist/cjs/core/public.js +5 -5
  21. package/dist/cjs/index.js +9 -9
  22. package/dist/cjs/openapi/index.js +6 -6
  23. package/dist/cjs/wc/index.js +4 -4
  24. package/dist/esm/asyncapi/index.js +5 -5
  25. package/dist/esm/chunks/AsyncApiSpec-BzhfaQ_T.js +2599 -0
  26. package/dist/esm/chunks/AsyncApiSpec-BzhfaQ_T.js.map +1 -0
  27. package/dist/esm/chunks/{Collapsible-DA6-nS46.js → Collapsible-MyJB2agz.js} +428 -211
  28. package/dist/esm/chunks/Collapsible-MyJB2agz.js.map +1 -0
  29. package/dist/esm/chunks/{ErrorBoundary-posRNrbt.js → ErrorBoundary-9pDlZFfM.js} +2 -2
  30. package/dist/esm/chunks/{ErrorBoundary-posRNrbt.js.map → ErrorBoundary-9pDlZFfM.js.map} +1 -1
  31. package/dist/esm/chunks/{OmniSpecRenderer-MqsQFXro.js → OmniSpecRenderer-BUJSl_2I.js} +6 -6
  32. package/dist/esm/chunks/{OmniSpecRenderer-MqsQFXro.js.map → OmniSpecRenderer-BUJSl_2I.js.map} +1 -1
  33. package/dist/esm/chunks/{OpenApiSpec-Cy-oW6jA.js → OpenApiSpec-wm3tH2vF.js} +6 -6
  34. package/dist/esm/chunks/OpenApiSpec-wm3tH2vF.js.map +1 -0
  35. package/dist/esm/chunks/{OpenIdConnectManual-COfITasf.js → OpenIdConnectManual-DPmTIIIy.js} +6 -223
  36. package/dist/esm/chunks/OpenIdConnectManual-DPmTIIIy.js.map +1 -0
  37. package/dist/esm/chunks/{ref-resolver-BIrHJOjz.js → ref-resolver-B0C36NuQ.js} +6 -3
  38. package/dist/esm/chunks/{ref-resolver-BIrHJOjz.js.map → ref-resolver-B0C36NuQ.js.map} +1 -1
  39. package/dist/esm/chunks/{useSpecDetector-5SGcKnJx.js → useSpecDetector-BJBNbfN5.js} +2 -2
  40. package/dist/esm/chunks/{useSpecDetector-5SGcKnJx.js.map → useSpecDetector-BJBNbfN5.js.map} +1 -1
  41. package/dist/esm/chunks/{useSpecFetcher-CZvAnU7Z.js → useSpecFetcher-BvVfMuzf.js} +28 -1
  42. package/dist/{cjs/chunks/useSpecFetcher-BKz1jHTV.js.map → esm/chunks/useSpecFetcher-BvVfMuzf.js.map} +1 -1
  43. package/dist/esm/core/public.js +4 -4
  44. package/dist/esm/index.js +9 -9
  45. package/dist/esm/openapi/index.js +6 -6
  46. package/dist/esm/wc/index.js +4 -4
  47. package/dist/types/asyncapi/AsyncApiSpec.d.ts +1 -1
  48. package/dist/types/asyncapi/AsyncApiSpec.d.ts.map +1 -1
  49. package/dist/types/asyncapi/components/AsyncOverview.d.ts.map +1 -1
  50. package/dist/types/asyncapi/components/BindingsSection.d.ts +26 -0
  51. package/dist/types/asyncapi/components/BindingsSection.d.ts.map +1 -0
  52. package/dist/types/asyncapi/components/ChannelDetail.d.ts +7 -2
  53. package/dist/types/asyncapi/components/ChannelDetail.d.ts.map +1 -1
  54. package/dist/types/asyncapi/components/ChannelReferenceDetail.d.ts +35 -0
  55. package/dist/types/asyncapi/components/ChannelReferenceDetail.d.ts.map +1 -0
  56. package/dist/types/asyncapi/components/ComponentsSection.d.ts +1 -1
  57. package/dist/types/asyncapi/components/ComponentsSection.d.ts.map +1 -1
  58. package/dist/types/asyncapi/components/ExternalDocsLink.d.ts +29 -0
  59. package/dist/types/asyncapi/components/ExternalDocsLink.d.ts.map +1 -0
  60. package/dist/types/asyncapi/components/MessagePayload.d.ts +22 -0
  61. package/dist/types/asyncapi/components/MessagePayload.d.ts.map +1 -0
  62. package/dist/types/asyncapi/components/SecurityRequirementBadges.d.ts +29 -0
  63. package/dist/types/asyncapi/components/SecurityRequirementBadges.d.ts.map +1 -0
  64. package/dist/types/asyncapi/components/SecuritySchemesSection.d.ts +23 -0
  65. package/dist/types/asyncapi/components/SecuritySchemesSection.d.ts.map +1 -0
  66. package/dist/types/asyncapi/components/ServerList.d.ts +1 -1
  67. package/dist/types/asyncapi/components/ServerList.d.ts.map +1 -1
  68. package/dist/types/asyncapi/components/TagGroupHeader.d.ts +18 -0
  69. package/dist/types/asyncapi/components/TagGroupHeader.d.ts.map +1 -0
  70. package/dist/types/asyncapi/components/field-display.d.ts +30 -0
  71. package/dist/types/asyncapi/components/field-display.d.ts.map +1 -0
  72. package/dist/types/asyncapi/parser/asyncapi-parser.d.ts.map +1 -1
  73. package/dist/types/asyncapi/schema-formats.d.ts +26 -0
  74. package/dist/types/asyncapi/schema-formats.d.ts.map +1 -0
  75. package/dist/types/asyncapi/tag-grouping.d.ts +43 -0
  76. package/dist/types/asyncapi/tag-grouping.d.ts.map +1 -0
  77. package/dist/types/asyncapi/types/asyncapi.types.d.ts +72 -8
  78. package/dist/types/asyncapi/types/asyncapi.types.d.ts.map +1 -1
  79. package/dist/types/core/components/Layout/DocLayout.d.ts.map +1 -1
  80. package/dist/types/core/types/auth.types.d.ts +1 -1
  81. package/dist/types/openapi/parser/ref-resolver.d.ts +8 -0
  82. package/dist/types/openapi/parser/ref-resolver.d.ts.map +1 -1
  83. package/dist/wc/standalone.js +1 -1
  84. package/dist/wc/standalone.js.map +1 -1
  85. package/package.json +2 -2
  86. package/dist/cjs/chunks/AsyncApiSpec-TBlyRxTP.js +0 -819
  87. package/dist/cjs/chunks/AsyncApiSpec-TBlyRxTP.js.map +0 -1
  88. package/dist/cjs/chunks/Collapsible-BHAHk_Ep.js.map +0 -1
  89. package/dist/cjs/chunks/OpenApiSpec-D0JtmOVQ.js.map +0 -1
  90. package/dist/cjs/chunks/OpenIdConnectManual-oEnN0QJ-.js.map +0 -1
  91. package/dist/esm/chunks/AsyncApiSpec-C3lsUpZk.js +0 -817
  92. package/dist/esm/chunks/AsyncApiSpec-C3lsUpZk.js.map +0 -1
  93. package/dist/esm/chunks/Collapsible-DA6-nS46.js.map +0 -1
  94. package/dist/esm/chunks/OpenApiSpec-Cy-oW6jA.js.map +0 -1
  95. package/dist/esm/chunks/OpenIdConnectManual-COfITasf.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { useContext, createContext, useMemo, useState, useEffect, useCallback, useRef, memo } from 'react';
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
- import { m as mq, B as Button, I as Icon, j as useConfig } from './useSpecFetcher-CZvAnU7Z.js';
4
+ import { m as mq, B as Button, I as Icon, j as useConfig } from './useSpecFetcher-BvVfMuzf.js';
5
5
  import styled from '@emotion/styled';
6
6
 
7
7
  const ExpandContext = createContext({ expandAll: false, expandGeneration: 0 });
@@ -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$4}`, children: /* @__PURE__ */ jsx(
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$4 = css({
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$3, children: [
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$3 = css({
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$2 = css({
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$2, className),
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$2, children: [
7226
+ hasHeader && /* @__PURE__ */ jsxs("div", { className: headerStyle$1, children: [
7002
7227
  /* @__PURE__ */ jsxs("div", { className: headerLeftStyle, children: [
7003
- title && /* @__PURE__ */ jsx("span", { className: titleStyle$1, children: title }),
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$2 = css({
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$1 = css({
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$1 = css({
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$1, flush && flushHeaderStyle), role: "tablist", children: tabs.map((tab) => /* @__PURE__ */ jsx(
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,222 @@ function Tabs({ tabs, defaultTab, flush = false }) {
7177
7402
  ] });
7178
7403
  }
7179
7404
 
7180
- const expandListeners = /* @__PURE__ */ new Map();
7181
- function onExpandRequest(id, callback) {
7182
- expandListeners.set(id, callback);
7183
- return () => {
7184
- expandListeners.delete(id);
7185
- };
7186
- }
7187
- function requestExpand(id) {
7188
- const listener = expandListeners.get(id);
7189
- if (listener) listener();
7190
- }
7191
- const SMOOTH_THRESHOLD = 50;
7192
- function useHashScroll(operationCount = 0) {
7193
- const scrollBehavior = operationCount > SMOOTH_THRESHOLD ? "instant" : "smooth";
7194
- useEffect(() => {
7195
- const hash = window.location.hash.slice(1);
7196
- if (!hash) return;
7197
- requestExpand(hash);
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
- return false;
7205
- };
7206
- if (attempt()) return;
7207
- let tries = 0;
7208
- const interval = setInterval(() => {
7209
- if (attempt() || ++tries >= 10) clearInterval(interval);
7210
- }, 200);
7211
- return () => clearInterval(interval);
7212
- }, [scrollBehavior]);
7213
- const navigateTo = useCallback((id) => {
7214
- window.history.replaceState(null, "", `#${id}`);
7215
- requestExpand(id);
7216
- requestAnimationFrame(() => {
7217
- const el = document.getElementById(id);
7218
- el?.scrollIntoView({ behavior: scrollBehavior, block: "start" });
7219
- });
7220
- }, [scrollBehavior]);
7221
- return { navigateTo };
7424
+ )
7425
+ ] });
7222
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 [];
7439
+ }
7440
+ const containerStyle = css({
7441
+ display: "flex",
7442
+ alignItems: "center",
7443
+ gap: "0.5rem",
7444
+ marginBottom: "0.75rem"
7445
+ });
7446
+ const labelStyle = css({
7447
+ fontSize: "var(--omnispec-font-size-xs)",
7448
+ fontWeight: 600,
7449
+ color: "var(--omnispec-fg-muted)",
7450
+ textTransform: "uppercase",
7451
+ letterSpacing: "0.5px",
7452
+ whiteSpace: "nowrap"
7453
+ });
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)",
7460
+ fontSize: "var(--omnispec-font-size-sm)",
7461
+ fontFamily: "var(--omnispec-font-mono)"
7462
+ });
7223
7463
 
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();
7464
+ const MOBILE_TABS = [
7465
+ { id: "schema", label: "Schema" },
7466
+ { id: "samples", label: "Samples" },
7467
+ { id: "try-it", label: "Try It" }
7468
+ ];
7469
+ const RIGHT_TABS = [
7470
+ { id: "samples", label: "Samples" },
7471
+ { id: "try-it", label: "Try It" }
7472
+ ];
7473
+ function ReferenceLayout({ schema, samples, tryIt, operationId }) {
7474
+ const [rightTab, setRightTab] = useState("samples");
7475
+ const [mobileTab, setMobileTab] = useState("schema");
7476
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
7477
+ /* @__PURE__ */ jsxs("div", { className: mobileWrapperStyle, children: [
7478
+ /* @__PURE__ */ jsx("div", { className: mobileTabBarStyle, role: "tablist", children: MOBILE_TABS.map((tab) => /* @__PURE__ */ jsx(
7479
+ "button",
7480
+ {
7481
+ type: "button",
7482
+ role: "tab",
7483
+ "aria-selected": mobileTab === tab.id,
7484
+ "aria-controls": `mobile-panel-${operationId}-${tab.id}`,
7485
+ onClick: () => setMobileTab(tab.id),
7486
+ className: cx(mobileTabStyle, mobileTab === tab.id ? mobileTabActiveStyle : void 0),
7487
+ children: tab.label
7488
+ },
7489
+ tab.id
7490
+ )) }),
7491
+ /* @__PURE__ */ jsxs(
7492
+ "div",
7493
+ {
7494
+ id: `mobile-panel-${operationId}-${mobileTab}`,
7495
+ className: mobileContentStyle,
7496
+ role: "tabpanel",
7497
+ children: [
7498
+ mobileTab === "schema" && schema,
7499
+ mobileTab === "samples" && samples,
7500
+ mobileTab === "try-it" && tryIt
7501
+ ]
7259
7502
  }
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(
7503
+ )
7504
+ ] }, `mobile-${operationId}`),
7505
+ /* @__PURE__ */ jsxs("div", { className: desktopWrapperStyle, children: [
7506
+ /* @__PURE__ */ jsx("div", { className: leftColumnStyle, children: schema }),
7507
+ /* @__PURE__ */ jsxs("div", { className: rightColumnStyle, children: [
7508
+ /* @__PURE__ */ jsx("div", { className: rightTabBarStyle, role: "tablist", children: RIGHT_TABS.map((tab) => /* @__PURE__ */ jsx(
7282
7509
  "button",
7283
7510
  {
7284
7511
  type: "button",
7285
- onClick: handleClick,
7286
- className: cx(headerStyle, expanded ? headerExpandedStyle : void 0),
7287
- "aria-expanded": expanded,
7512
+ role: "tab",
7513
+ "aria-selected": rightTab === tab.id,
7514
+ "aria-controls": `right-panel-${operationId}-${tab.id}`,
7515
+ onClick: () => setRightTab(tab.id),
7516
+ className: cx(rightTabStyle, rightTab === tab.id ? rightTabActiveStyle : void 0),
7517
+ children: tab.label
7518
+ },
7519
+ tab.id
7520
+ )) }),
7521
+ /* @__PURE__ */ jsxs(
7522
+ "div",
7523
+ {
7524
+ id: `right-panel-${operationId}-${rightTab}`,
7525
+ className: rightContentStyle,
7526
+ role: "tabpanel",
7288
7527
  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 })
7528
+ rightTab === "samples" && samples,
7529
+ rightTab === "try-it" && tryIt
7295
7530
  ]
7296
7531
  }
7297
- ),
7298
- shouldRender && /* @__PURE__ */ jsx("div", { className: bodyStyle, children })
7299
- ]
7300
- }
7301
- );
7302
- });
7303
- const containerStyle = css({
7304
- marginBottom: "0.75rem",
7305
- maxWidth: "100%",
7306
- borderRadius: "0.5rem",
7532
+ )
7533
+ ] })
7534
+ ] }, `desktop-${operationId}`)
7535
+ ] });
7536
+ }
7537
+ const mobileWrapperStyle = css({
7538
+ display: "block",
7307
7539
  [mq.desktop]: {
7308
- border: "1px solid var(--omnispec-border-color)",
7309
- borderRadius: "0.5rem"
7540
+ display: "none"
7310
7541
  }
7311
7542
  });
7312
- const deprecatedStyle = css({
7313
- opacity: 0.6
7314
- });
7315
- const headerStyle = css({
7543
+ const mobileTabBarStyle = css({
7316
7544
  display: "flex",
7317
- alignItems: "center",
7318
- gap: "0.75rem",
7319
- width: "100%",
7320
- padding: "0.75rem 0",
7321
- background: "var(--omnispec-bg-primary)",
7545
+ borderBottom: "1px solid var(--omnispec-border-color)"
7546
+ });
7547
+ const mobileTabStyle = css({
7548
+ flex: 1,
7549
+ textAlign: "center",
7550
+ padding: "0.625rem 0.5rem",
7551
+ background: "none",
7322
7552
  border: "none",
7323
- borderBottom: "none",
7324
- borderRadius: "0.5rem",
7553
+ borderBottom: "0.125rem solid transparent",
7325
7554
  cursor: "pointer",
7326
- textAlign: "left",
7327
- [mq.desktop]: {
7328
- padding: "1rem"
7555
+ fontSize: "var(--omnispec-font-size-xs)",
7556
+ fontWeight: 600,
7557
+ letterSpacing: "0.04em",
7558
+ textTransform: "uppercase",
7559
+ color: "var(--omnispec-fg-secondary)",
7560
+ "&:hover": {
7561
+ color: "var(--omnispec-fg-primary)"
7329
7562
  }
7330
7563
  });
7331
- const headerExpandedStyle = css({});
7332
- const chevronStyle = css({
7333
- color: "var(--omnispec-fg-muted)",
7334
- flexShrink: 0,
7335
- transition: "transform 0.2s ease"
7564
+ const mobileTabActiveStyle = css({
7565
+ borderBottom: "0.125rem solid var(--omnispec-color-primary)",
7566
+ color: "var(--omnispec-color-primary)"
7336
7567
  });
7337
- const chevronExpandedStyle = css({
7338
- transform: "rotate(90deg)"
7568
+ const mobileContentStyle = css({
7569
+ padding: "1rem 0"
7339
7570
  });
7340
- const titleStyle = css({
7341
- fontWeight: 600,
7571
+ const desktopWrapperStyle = css({
7572
+ display: "none",
7573
+ [mq.desktop]: {
7574
+ display: "flex",
7575
+ alignItems: "flex-start"
7576
+ }
7577
+ });
7578
+ const leftColumnStyle = css({
7342
7579
  flex: 1,
7343
7580
  minWidth: 0,
7344
- color: "var(--omnispec-fg-primary)",
7345
- fontSize: "var(--omnispec-font-size-md)",
7346
- textOverflow: "ellipsis",
7347
- whiteSpace: "nowrap"
7581
+ padding: "1rem 1.5rem"
7348
7582
  });
7349
- const xBadgeStyle = css({
7350
- fontSize: "var(--omnispec-font-size-xs)",
7351
- fontWeight: 600,
7352
- padding: "0.125rem 0.5rem",
7353
- borderRadius: "1rem",
7354
- whiteSpace: "nowrap",
7355
- flexShrink: 0
7583
+ const rightColumnStyle = css({
7584
+ width: "26rem",
7585
+ flexShrink: 0,
7586
+ borderLeft: "1px solid var(--omnispec-border-color)",
7587
+ position: "sticky",
7588
+ top: "calc(var(--omnispec-offset-top, 0px) + 1rem)",
7589
+ alignSelf: "flex-start",
7590
+ maxHeight: "calc(100vh - var(--omnispec-offset-top, 0px) - 2rem)",
7591
+ overflowY: "auto"
7356
7592
  });
7357
- const deprecatedBadgeStyle = css({
7358
- fontSize: "10px",
7359
- color: "var(--omnispec-color-warning)",
7593
+ const rightTabBarStyle = css({
7594
+ display: "flex",
7595
+ borderBottom: "1px solid var(--omnispec-border-color)"
7596
+ });
7597
+ const rightTabStyle = css({
7598
+ flex: 1,
7599
+ textAlign: "center",
7600
+ padding: "0.625rem 0.5rem",
7601
+ background: "none",
7602
+ border: "none",
7603
+ borderBottom: "0.125rem solid transparent",
7604
+ cursor: "pointer",
7605
+ fontSize: "var(--omnispec-font-size-xs)",
7360
7606
  fontWeight: 600,
7607
+ letterSpacing: "0.04em",
7361
7608
  textTransform: "uppercase",
7362
- border: "1px solid var(--omnispec-color-warning)",
7363
- padding: "1px 5px",
7364
- borderRadius: "3px",
7365
- flexShrink: 0
7366
- });
7367
- const rightLabelStyle = css({
7368
- fontSize: "var(--omnispec-font-size-sm)",
7369
- color: "var(--omnispec-fg-muted)",
7370
- flexShrink: 0,
7371
- marginLeft: "auto"
7609
+ color: "var(--omnispec-fg-secondary)",
7610
+ "&:hover": {
7611
+ color: "var(--omnispec-fg-primary)"
7612
+ }
7372
7613
  });
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%"
7614
+ const rightTabActiveStyle = css({
7615
+ borderBottom: "0.125rem solid var(--omnispec-color-primary)",
7616
+ color: "var(--omnispec-color-primary)"
7385
7617
  });
7386
- const pathStyle = css({
7387
- minWidth: 0,
7388
- wordBreak: "break-all"
7618
+ const rightContentStyle = css({
7619
+ padding: "1rem"
7389
7620
  });
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
7621
 
7405
7622
  const headerStyle_ = css({
7406
7623
  display: "flex",
@@ -7478,5 +7695,5 @@ function Collapsible({ title, children, defaultOpen = false, headerStyle, expand
7478
7695
  ] });
7479
7696
  }
7480
7697
 
7481
- export { schemaToNodes as A, Badge as B, CodeBlock as C, useHashScroll as D, EnumItem as E, FieldDescription as F, useScrollSpy as G, ExpandProvider as H, useExpandAll as I, buildConstraints as J, 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 };
7482
- //# sourceMappingURL=Collapsible-DA6-nS46.js.map
7698
+ export { schemaToNodes as A, Badge as B, CodeBlock as C, useHashScroll as D, EnumItem as E, FieldDescription as F, useScrollSpy as G, useExpandAll as H, getNamedExamples as I, ExampleSelector as J, buildConstraints as K, ExpandProvider as L, MarkdownRenderer as M, PresentationChildren as P, ReferenceLayout as R, 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 };
7699
+ //# sourceMappingURL=Collapsible-MyJB2agz.js.map