@chargebee/code-sample-generator 1.0.2 → 1.1.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/README.md +48 -0
- package/dist/{LanguageSwitcher-CmrCgNzs.js → TryInApiExplorer-CWy0RGj-.js} +185 -178
- package/dist/browser.js +6 -6
- package/dist/code-sample-generator.css +96 -0
- package/dist/components/CodeBlock.d.ts +3 -1
- package/dist/components/CodeSamples.d.ts +1 -1
- package/dist/components/CopyButton.d.ts +3 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/{generate-code-sample-DwenHif9.js → generate-code-sample-Bm9CxTcV.js} +11 -10
- package/dist/{generate-from-sample-B1Rj07T6.js → generate-from-sample-C3k_DgbX.js} +6532 -4819
- package/dist/generated/ops/operation-ids.d.ts +2 -2
- package/dist/generated/ops/operation-params.d.ts +213 -49
- package/dist/generated/ops/v2-pcv1/cancel_a_collections_payment_promise.d.ts +3 -0
- package/dist/generated/ops/v2-pcv1/create_a_collections_payment_promise.d.ts +3 -0
- package/dist/generated/ops/v2-pcv1/list_collections_payment_promises.d.ts +3 -0
- package/dist/generated/ops/v2-pcv1/list_email_logs_for_a_customer.d.ts +3 -0
- package/dist/generated/ops/v2-pcv1/retrieve_a_payment_promise.d.ts +3 -0
- package/dist/generated/ops/v2-pcv1/retrieve_a_retry_segment.d.ts +3 -0
- package/dist/generated/ops/v2-pcv1/update_a_collections_payment_promise.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/cancel_a_collections_payment_promise.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/create_a_business_entity.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/create_a_collections_payment_promise.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/create_a_price_ramp.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/delete_a_price_ramp.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/list_business_entities.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/list_collections_payment_promises.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/list_email_logs_for_a_customer.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/list_price_ramps.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/remove_payment_schedule_scheme_from_an_invoice.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/retrieve_a_business_entity.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/retrieve_a_payment_promise.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/retrieve_a_price_ramp.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/retrieve_a_retry_segment.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/update_a_collections_payment_promise.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/update_a_price_ramp.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/update_business_entity.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/update_overdraft_limit.d.ts +3 -0
- package/dist/generators/chargebee-cli.d.ts +30 -0
- package/dist/generators/registry.d.ts +12 -3
- package/dist/{highlight-code-DEB0Ig2J.js → highlight-code-CQjob1R6.js} +11 -10
- package/dist/index.js +33 -33
- package/dist/node.js +32 -32
- package/package.json +9 -4
|
@@ -742,6 +742,7 @@ html.dark .curl-token-placeholder {
|
|
|
742
742
|
/* ============================================================================
|
|
743
743
|
CSS VARIABLES (Theme Colors)
|
|
744
744
|
============================================================================ */
|
|
745
|
+
|
|
745
746
|
/*
|
|
746
747
|
* Maps to Chargebee API Docs tokens in `app.css` when loaded; hex fallbacks keep
|
|
747
748
|
* the package usable in other hosts without `--cb-*`.
|
|
@@ -783,6 +784,7 @@ html.dark .curl-token-placeholder {
|
|
|
783
784
|
#ff3300
|
|
784
785
|
);
|
|
785
786
|
}
|
|
787
|
+
|
|
786
788
|
/* Dark mode (site) — Sample Request body matches shell deep blue.
|
|
787
789
|
API Docs uses `.dark`; cb-docs ThemeToggle uses `html.dark`. */
|
|
788
790
|
.dark,
|
|
@@ -812,44 +814,54 @@ html.dark {
|
|
|
812
814
|
#ff3300
|
|
813
815
|
);
|
|
814
816
|
}
|
|
817
|
+
|
|
815
818
|
.go-to-api-explorer {
|
|
816
819
|
color: var(--code-samples-go-to-api-explorer-fg);
|
|
817
820
|
text-decoration: none;
|
|
818
821
|
}
|
|
822
|
+
|
|
819
823
|
.go-to-api-explorer:hover,
|
|
820
824
|
.go-to-api-explorer:focus-visible {
|
|
821
825
|
color: var(--code-samples-go-to-api-explorer-fg-hover);
|
|
822
826
|
}
|
|
827
|
+
|
|
823
828
|
.go-to-api-explorer svg {
|
|
824
829
|
color: currentColor;
|
|
825
830
|
}
|
|
831
|
+
|
|
826
832
|
/* ============================================================================
|
|
827
833
|
CODE SAMPLES CONTAINER
|
|
828
834
|
============================================================================ */
|
|
835
|
+
|
|
829
836
|
/* Note: Background colors are controlled via Tailwind classes in the component
|
|
830
837
|
for better customization. CSS only handles structural styles. */
|
|
838
|
+
|
|
831
839
|
.code-samples-container {
|
|
832
840
|
display: block;
|
|
833
841
|
background-color: var(--code-samples-chrome-bg);
|
|
834
842
|
border: 1px solid var(--code-samples-block-border);
|
|
835
843
|
border-radius: var(--code-samples-card-border-radius);
|
|
836
844
|
}
|
|
845
|
+
|
|
837
846
|
.code-samples-result-card {
|
|
838
847
|
border-radius: var(--code-samples-card-border-radius);
|
|
839
848
|
overflow: hidden;
|
|
840
849
|
background-color: var(--code-samples-response-card-bg);
|
|
841
850
|
border: 1px solid var(--code-samples-response-card-border);
|
|
842
851
|
}
|
|
852
|
+
|
|
843
853
|
.code-samples-result-card-header {
|
|
844
854
|
background-color: var(--code-samples-response-card-header-bg);
|
|
845
855
|
border-bottom: 1px solid var(--code-samples-response-card-border);
|
|
846
856
|
}
|
|
857
|
+
|
|
847
858
|
.code-samples-see-more {
|
|
848
859
|
border: 0;
|
|
849
860
|
border-top: 1px solid var(--code-samples-response-card-border);
|
|
850
861
|
background: transparent;
|
|
851
862
|
color: var(--cb-link-blue, #0833dd);
|
|
852
863
|
}
|
|
864
|
+
|
|
853
865
|
.code-samples-header {
|
|
854
866
|
/* No margin/padding that could create gaps */
|
|
855
867
|
margin: 0;
|
|
@@ -861,12 +873,14 @@ html.dark {
|
|
|
861
873
|
align-items: center;
|
|
862
874
|
justify-content: space-between;
|
|
863
875
|
}
|
|
876
|
+
|
|
864
877
|
.code-samples-header h3 {
|
|
865
878
|
margin: 0;
|
|
866
879
|
color: var(--code-samples-carousel-nav-fg);
|
|
867
880
|
/* Ensure title doesn't shrink */
|
|
868
881
|
flex-shrink: 0;
|
|
869
882
|
}
|
|
883
|
+
|
|
870
884
|
.code-samples-body {
|
|
871
885
|
margin: 0;
|
|
872
886
|
background-color: var(--code-samples-chrome-bg);
|
|
@@ -876,6 +890,7 @@ html.dark {
|
|
|
876
890
|
min-height: 0;
|
|
877
891
|
overflow: hidden;
|
|
878
892
|
}
|
|
893
|
+
|
|
879
894
|
/* Description stays fixed at top - doesn't scroll (single code block mode) */
|
|
880
895
|
.code-samples-body > .sample-description {
|
|
881
896
|
flex-shrink: 0; /* Don't shrink description */
|
|
@@ -883,6 +898,7 @@ html.dark {
|
|
|
883
898
|
top: 0;
|
|
884
899
|
z-index: 10; /* Ensure description stays above code when scrolling */
|
|
885
900
|
}
|
|
901
|
+
|
|
886
902
|
/* Single mode: wrapper around code block + optional inline copy button */
|
|
887
903
|
.code-samples-body > .relative {
|
|
888
904
|
flex: 1;
|
|
@@ -891,6 +907,7 @@ html.dark {
|
|
|
891
907
|
flex-direction: column;
|
|
892
908
|
overflow: hidden;
|
|
893
909
|
}
|
|
910
|
+
|
|
894
911
|
/* Code block wrapper scrolls independently (single + nested in .relative) */
|
|
895
912
|
.code-samples-body .code-block-wrapper,
|
|
896
913
|
.code-samples-body > .code-block {
|
|
@@ -898,6 +915,7 @@ html.dark {
|
|
|
898
915
|
overflow-y: auto; /* Scroll code block if it exceeds remaining height */
|
|
899
916
|
min-height: 0; /* Allow flex item to shrink below content size */
|
|
900
917
|
}
|
|
918
|
+
|
|
901
919
|
/* ============================================================================
|
|
902
920
|
CONTENT-FIT REQUEST BODY (operation-page Sample Request)
|
|
903
921
|
----------------------------------------------------------------------------
|
|
@@ -911,15 +929,18 @@ html.dark {
|
|
|
911
929
|
background-color: var(--code-samples-chrome-bg);
|
|
912
930
|
display: block;
|
|
913
931
|
}
|
|
932
|
+
|
|
914
933
|
/* Single-mode description banner stays pinned above the scrolling code */
|
|
915
934
|
.code-samples-scroll-body > .sample-description {
|
|
916
935
|
position: sticky;
|
|
917
936
|
top: 0;
|
|
918
937
|
z-index: 10;
|
|
919
938
|
}
|
|
939
|
+
|
|
920
940
|
/* ============================================================================
|
|
921
941
|
CAROUSEL CONTAINER - Flex layout for proper height distribution
|
|
922
942
|
============================================================================ */
|
|
943
|
+
|
|
923
944
|
/* Carousel root container - must be flex to distribute space between nav and content */
|
|
924
945
|
.carousel-container {
|
|
925
946
|
display: flex;
|
|
@@ -928,9 +949,11 @@ html.dark {
|
|
|
928
949
|
min-height: 0; /* Critical: allow flex item to shrink below content size */
|
|
929
950
|
height: 100%; /* Fill parent height */
|
|
930
951
|
}
|
|
952
|
+
|
|
931
953
|
/* ============================================================================
|
|
932
954
|
CAROUSEL NAVIGATION - SIMPLE SOLID BLUE
|
|
933
955
|
============================================================================ */
|
|
956
|
+
|
|
934
957
|
.carousel-nav-bar {
|
|
935
958
|
flex-shrink: 0; /* Navigation bar never shrinks */
|
|
936
959
|
background: var(--code-samples-carousel-bg) !important;
|
|
@@ -940,6 +963,7 @@ html.dark {
|
|
|
940
963
|
align-items: center;
|
|
941
964
|
justify-content: space-between;
|
|
942
965
|
}
|
|
966
|
+
|
|
943
967
|
/* Navigation buttons - simple text style */
|
|
944
968
|
.carousel-nav-btn {
|
|
945
969
|
background: transparent;
|
|
@@ -954,18 +978,22 @@ html.dark {
|
|
|
954
978
|
gap: 0.5rem;
|
|
955
979
|
transition: opacity 0.2s ease-in-out;
|
|
956
980
|
}
|
|
981
|
+
|
|
957
982
|
.carousel-nav-btn:hover:not(:disabled) {
|
|
958
983
|
opacity: 0.8;
|
|
959
984
|
}
|
|
985
|
+
|
|
960
986
|
.carousel-nav-btn:disabled {
|
|
961
987
|
opacity: 0.4;
|
|
962
988
|
cursor: not-allowed;
|
|
963
989
|
}
|
|
990
|
+
|
|
964
991
|
.carousel-nav-btn svg {
|
|
965
992
|
width: 1.5rem;
|
|
966
993
|
height: 1.5rem;
|
|
967
994
|
stroke-width: 2.5;
|
|
968
995
|
}
|
|
996
|
+
|
|
969
997
|
/* Dot indicators */
|
|
970
998
|
.carousel-dot {
|
|
971
999
|
background: transparent;
|
|
@@ -976,10 +1004,12 @@ html.dark {
|
|
|
976
1004
|
transition: all 0.2s ease-in-out;
|
|
977
1005
|
padding: 0;
|
|
978
1006
|
}
|
|
1007
|
+
|
|
979
1008
|
.carousel-dot[aria-current="true"] {
|
|
980
1009
|
background: var(--code-samples-carousel-nav-fg);
|
|
981
1010
|
border-color: var(--code-samples-carousel-nav-fg);
|
|
982
1011
|
}
|
|
1012
|
+
|
|
983
1013
|
.carousel-dot:hover:not([aria-current="true"]) {
|
|
984
1014
|
background: color-mix(
|
|
985
1015
|
in srgb,
|
|
@@ -987,6 +1017,7 @@ html.dark {
|
|
|
987
1017
|
transparent
|
|
988
1018
|
);
|
|
989
1019
|
}
|
|
1020
|
+
|
|
990
1021
|
/* Carousel content wrapper - takes remaining space after nav bar */
|
|
991
1022
|
.carousel-content-wrapper {
|
|
992
1023
|
/* No margin to prevent white line gap */
|
|
@@ -1002,6 +1033,7 @@ html.dark {
|
|
|
1002
1033
|
/* Chrome behind description; code area uses .code-block-wrapper */
|
|
1003
1034
|
background-color: var(--code-samples-chrome-bg);
|
|
1004
1035
|
}
|
|
1036
|
+
|
|
1005
1037
|
/* Carousel content slider - horizontal container for all items */
|
|
1006
1038
|
.carousel-content-slider {
|
|
1007
1039
|
display: flex;
|
|
@@ -1012,6 +1044,7 @@ html.dark {
|
|
|
1012
1044
|
will-change: transform;
|
|
1013
1045
|
background-color: var(--code-samples-chrome-bg);
|
|
1014
1046
|
}
|
|
1047
|
+
|
|
1015
1048
|
/* Individual carousel item - full width, fills available height */
|
|
1016
1049
|
.carousel-content-item {
|
|
1017
1050
|
min-width: 100%;
|
|
@@ -1026,6 +1059,7 @@ html.dark {
|
|
|
1026
1059
|
min-height: 0; /* Allow flex shrinking */
|
|
1027
1060
|
background-color: var(--code-samples-chrome-bg);
|
|
1028
1061
|
}
|
|
1062
|
+
|
|
1029
1063
|
/* Description stays fixed at top - doesn't scroll */
|
|
1030
1064
|
.carousel-content-item .sample-description {
|
|
1031
1065
|
flex-shrink: 0; /* Don't shrink description */
|
|
@@ -1033,12 +1067,14 @@ html.dark {
|
|
|
1033
1067
|
top: 0;
|
|
1034
1068
|
z-index: 10; /* Ensure description stays above code when scrolling */
|
|
1035
1069
|
}
|
|
1070
|
+
|
|
1036
1071
|
/* Code block wrapper scrolls independently */
|
|
1037
1072
|
.carousel-content-item .code-block-wrapper {
|
|
1038
1073
|
flex: 1; /* Take remaining space */
|
|
1039
1074
|
overflow-y: auto; /* Scroll code block if it exceeds remaining height */
|
|
1040
1075
|
min-height: 0; /* Allow flex item to shrink below content size */
|
|
1041
1076
|
}
|
|
1077
|
+
|
|
1042
1078
|
/* Intermediate div wrapper inside carousel items - proper flex child */
|
|
1043
1079
|
.carousel-content-item > div {
|
|
1044
1080
|
margin: 0;
|
|
@@ -1049,12 +1085,14 @@ html.dark {
|
|
|
1049
1085
|
min-height: 0; /* Critical: allow flex shrinking below content size */
|
|
1050
1086
|
/* No max-height - parent controls the constraint */
|
|
1051
1087
|
}
|
|
1088
|
+
|
|
1052
1089
|
/* Legacy class for backward compatibility */
|
|
1053
1090
|
.carousel-content {
|
|
1054
1091
|
/* No margin to prevent white line gap */
|
|
1055
1092
|
margin: 0;
|
|
1056
1093
|
display: block;
|
|
1057
1094
|
}
|
|
1095
|
+
|
|
1058
1096
|
/* ============================================================================
|
|
1059
1097
|
HEIGHT-ADAPTIVE CAROUSEL (opt-in via heightAdapt prop)
|
|
1060
1098
|
----------------------------------------------------------------------------
|
|
@@ -1067,23 +1105,28 @@ html.dark {
|
|
|
1067
1105
|
height: auto;
|
|
1068
1106
|
flex: none;
|
|
1069
1107
|
}
|
|
1108
|
+
|
|
1070
1109
|
.carousel-container--fit .carousel-content-wrapper {
|
|
1071
1110
|
flex: none;
|
|
1072
1111
|
/* Clip taller inactive slides; height is set inline from the active slide. */
|
|
1073
1112
|
overflow: hidden;
|
|
1074
1113
|
transition: height 0.3s ease-in-out;
|
|
1075
1114
|
}
|
|
1115
|
+
|
|
1076
1116
|
.carousel-container--fit .carousel-content-slider {
|
|
1077
1117
|
align-items: flex-start; /* natural per-slide height, no stretch */
|
|
1078
1118
|
flex: none;
|
|
1079
1119
|
}
|
|
1120
|
+
|
|
1080
1121
|
.carousel-container--fit .carousel-content-item,
|
|
1081
1122
|
.carousel-container--fit .carousel-content-item > div {
|
|
1082
1123
|
flex: none; /* size to content instead of filling */
|
|
1083
1124
|
}
|
|
1125
|
+
|
|
1084
1126
|
/* ============================================================================
|
|
1085
1127
|
SAMPLE DESCRIPTION BANNER
|
|
1086
1128
|
============================================================================ */
|
|
1129
|
+
|
|
1087
1130
|
.sample-description {
|
|
1088
1131
|
/* Opaque chrome so sticky text does not show code scrolling underneath */
|
|
1089
1132
|
background-color: var(--code-samples-chrome-bg) !important;
|
|
@@ -1093,6 +1136,7 @@ html.dark {
|
|
|
1093
1136
|
margin: 0;
|
|
1094
1137
|
display: block;
|
|
1095
1138
|
}
|
|
1139
|
+
|
|
1096
1140
|
/* ============================================================================
|
|
1097
1141
|
LOADING SKELETON
|
|
1098
1142
|
----------------------------------------------------------------------------
|
|
@@ -1102,29 +1146,35 @@ html.dark {
|
|
|
1102
1146
|
nothing shifts when the real markup arrives. That is what lets the block size
|
|
1103
1147
|
to its content rather than to a fixed floor.
|
|
1104
1148
|
============================================================================ */
|
|
1149
|
+
|
|
1105
1150
|
.code-block-skeleton {
|
|
1106
1151
|
padding: var(--code-samples-code-padding);
|
|
1107
1152
|
overflow: hidden;
|
|
1108
1153
|
}
|
|
1154
|
+
|
|
1109
1155
|
/* Simple `codeString` mode nests the block in .code-block, whose <pre> is padded
|
|
1110
1156
|
to 1.5rem rather than the shared variable. Match it so the skeleton stands at
|
|
1111
1157
|
the right height there too. */
|
|
1112
1158
|
.code-block .code-block-skeleton {
|
|
1113
1159
|
padding: 1.5rem;
|
|
1114
1160
|
}
|
|
1161
|
+
|
|
1115
1162
|
.code-block-skeleton-row {
|
|
1116
1163
|
display: flex;
|
|
1117
1164
|
align-items: center;
|
|
1118
1165
|
height: var(--code-samples-code-line-height);
|
|
1119
1166
|
}
|
|
1167
|
+
|
|
1120
1168
|
.code-block-skeleton-line {
|
|
1121
1169
|
height: 0.75rem;
|
|
1122
1170
|
border-radius: 2px;
|
|
1123
1171
|
background-color: var(--code-block-skeleton-line-bg);
|
|
1124
1172
|
}
|
|
1173
|
+
|
|
1125
1174
|
/* ============================================================================
|
|
1126
1175
|
CODE BLOCK WRAPPER (prevents layout shift)
|
|
1127
1176
|
============================================================================ */
|
|
1177
|
+
|
|
1128
1178
|
.code-block-wrapper {
|
|
1129
1179
|
/* Scrollable container for code blocks */
|
|
1130
1180
|
overflow-y: auto; /* Enable vertical scrolling when content exceeds available space */
|
|
@@ -1138,9 +1188,11 @@ html.dark {
|
|
|
1138
1188
|
/* No max-height here - flex layout determines available space */
|
|
1139
1189
|
/* flex: 1 and min-height: 0 are set in context-specific rules below */
|
|
1140
1190
|
}
|
|
1191
|
+
|
|
1141
1192
|
/* ============================================================================
|
|
1142
1193
|
CODE BLOCK STYLES (for Shiki output)
|
|
1143
1194
|
============================================================================ */
|
|
1195
|
+
|
|
1144
1196
|
/* Ensure no border radius on code blocks */
|
|
1145
1197
|
.code-block,
|
|
1146
1198
|
.code-block pre,
|
|
@@ -1154,6 +1206,7 @@ div[class*="font-mono"] pre.shiki {
|
|
|
1154
1206
|
/* Background is transparent to inherit from parent */
|
|
1155
1207
|
background: transparent !important;
|
|
1156
1208
|
}
|
|
1209
|
+
|
|
1157
1210
|
.code-block pre {
|
|
1158
1211
|
margin: 0;
|
|
1159
1212
|
padding: 1.5rem;
|
|
@@ -1164,14 +1217,18 @@ div[class*="font-mono"] pre.shiki {
|
|
|
1164
1217
|
overflow-y: visible !important;
|
|
1165
1218
|
/* No height transitions - prevents reserving space for longest code block */
|
|
1166
1219
|
}
|
|
1220
|
+
|
|
1167
1221
|
/* Reduce left padding when line numbers are present */
|
|
1168
1222
|
pre.shiki code .line[data-line] {
|
|
1169
1223
|
padding-left: 0; /* Remove any padding on the line itself */
|
|
1170
1224
|
}
|
|
1225
|
+
|
|
1171
1226
|
/* Note: Removed negative margin on first-child - it was causing the first line to shift left awkwardly */
|
|
1172
1227
|
/* The parent pre padding (1.5rem) provides consistent spacing for all lines including the first */
|
|
1228
|
+
|
|
1173
1229
|
/* Copy button is now in header, not in code block */
|
|
1174
1230
|
/* Removed copy button positioning styles - button is now in CodeSampleHeader component */
|
|
1231
|
+
|
|
1175
1232
|
.code-block pre.shiki,
|
|
1176
1233
|
pre.shiki {
|
|
1177
1234
|
/* Shiki applies its own background from theme */
|
|
@@ -1179,6 +1236,7 @@ pre.shiki {
|
|
|
1179
1236
|
background: transparent !important;
|
|
1180
1237
|
border-radius: 0 !important; /* Ensure no border radius */
|
|
1181
1238
|
}
|
|
1239
|
+
|
|
1182
1240
|
/* Ensure CodeBlock div itself has no border radius and proper background */
|
|
1183
1241
|
.code-block-wrapper > div,
|
|
1184
1242
|
.code-block-wrapper > div[class*="font-mono"],
|
|
@@ -1187,6 +1245,7 @@ div[class*="font-mono"][class*="text-\[13px\]"] {
|
|
|
1187
1245
|
border-radius: 0 !important;
|
|
1188
1246
|
overflow: hidden !important; /* Prevent any visual border-radius from overflow */
|
|
1189
1247
|
}
|
|
1248
|
+
|
|
1190
1249
|
/* Sample Result: CodeBlock outer div sets light/dark bg; keep pre transparent (no white flash in dark mode) */
|
|
1191
1250
|
div[class*="CardContent"] > div[class*="font-mono"],
|
|
1192
1251
|
div[class*="CardContent"] > div[class*="font-mono"] pre,
|
|
@@ -1194,10 +1253,12 @@ div[class*="CardContent"] > div[class*="font-mono"] pre.shiki {
|
|
|
1194
1253
|
border-radius: 0 !important;
|
|
1195
1254
|
background-color: transparent !important;
|
|
1196
1255
|
}
|
|
1256
|
+
|
|
1197
1257
|
div[class*="CardContent"] pre.shiki,
|
|
1198
1258
|
div[class*="CardContent"] pre[class*="shiki"] {
|
|
1199
1259
|
background-color: transparent !important;
|
|
1200
1260
|
}
|
|
1261
|
+
|
|
1201
1262
|
/* Code styling */
|
|
1202
1263
|
.code-block code,
|
|
1203
1264
|
pre.shiki code {
|
|
@@ -1208,11 +1269,13 @@ pre.shiki code {
|
|
|
1208
1269
|
white-space: pre;
|
|
1209
1270
|
display: block;
|
|
1210
1271
|
}
|
|
1272
|
+
|
|
1211
1273
|
/* Override leading-relaxed class for code blocks to use compact line height */
|
|
1212
1274
|
div[class*="leading-relaxed"] pre.shiki code,
|
|
1213
1275
|
div[class*="leading-relaxed"] pre.shiki {
|
|
1214
1276
|
line-height: 1.5 !important; /* Compact spacing */
|
|
1215
1277
|
}
|
|
1278
|
+
|
|
1216
1279
|
/* Ensure lines have minimal spacing - especially empty lines */
|
|
1217
1280
|
pre.shiki code .line,
|
|
1218
1281
|
pre.shiki .line {
|
|
@@ -1220,6 +1283,7 @@ pre.shiki .line {
|
|
|
1220
1283
|
margin: 0; /* No margin between lines */
|
|
1221
1284
|
padding: 0; /* No padding on lines */
|
|
1222
1285
|
}
|
|
1286
|
+
|
|
1223
1287
|
/* Empty lines should have minimal height */
|
|
1224
1288
|
pre.shiki code .line:empty,
|
|
1225
1289
|
pre.shiki .line:empty,
|
|
@@ -1227,9 +1291,11 @@ pre.shiki code .line[data-line]:empty::before {
|
|
|
1227
1291
|
height: 1.5em; /* Same as line-height for empty lines */
|
|
1228
1292
|
min-height: 0; /* Don't force minimum height on empty lines */
|
|
1229
1293
|
}
|
|
1294
|
+
|
|
1230
1295
|
/* ============================================================================
|
|
1231
1296
|
LINE NUMBERS
|
|
1232
1297
|
============================================================================ */
|
|
1298
|
+
|
|
1233
1299
|
/* Enable line numbers display using data-line attribute */
|
|
1234
1300
|
/* Works for both Shiki-generated code and custom cURL highlighting */
|
|
1235
1301
|
/* Idiomatic Shiki approach: compact spacing, right-aligned numbers */
|
|
@@ -1248,10 +1314,12 @@ pre.shiki code span.line[data-line]::before {
|
|
|
1248
1314
|
color-mix(in srgb, var(--cb-slate, #6e7681) 25%, transparent);
|
|
1249
1315
|
font-variant-numeric: tabular-nums; /* Align numbers properly */
|
|
1250
1316
|
}
|
|
1317
|
+
|
|
1251
1318
|
/* Shiki lines are naturally block-level in <pre><code> due to whitespace preservation */
|
|
1252
1319
|
/* Don't force display: block - let them flow naturally to avoid extra line breaks */
|
|
1253
1320
|
/* Removing display: block allows lines to flow more naturally and reduces spacing on empty lines */
|
|
1254
1321
|
/* No CSS needed here - <pre> element handles block-level behavior naturally */
|
|
1322
|
+
|
|
1255
1323
|
/* Line number styling for light theme (response JSON) */
|
|
1256
1324
|
pre.shiki[style*="github-light"] code .line[data-line]::before,
|
|
1257
1325
|
pre.shiki[style*="github-light"] .line[data-line]::before,
|
|
@@ -1263,6 +1331,7 @@ pre.shiki[style*="github-light"] code span.line[data-line]::before {
|
|
|
1263
1331
|
transparent
|
|
1264
1332
|
);
|
|
1265
1333
|
}
|
|
1334
|
+
|
|
1266
1335
|
/* Prevent borders and underlines on code block content */
|
|
1267
1336
|
.code-block span,
|
|
1268
1337
|
.code-block .line,
|
|
@@ -1271,10 +1340,12 @@ pre.shiki[style*="github-light"] code span.line[data-line]::before {
|
|
|
1271
1340
|
text-decoration: none !important;
|
|
1272
1341
|
border-bottom: none !important;
|
|
1273
1342
|
}
|
|
1343
|
+
|
|
1274
1344
|
/* Scrollbar styling for code blocks */
|
|
1275
1345
|
.code-block pre::-webkit-scrollbar {
|
|
1276
1346
|
height: 8px;
|
|
1277
1347
|
}
|
|
1348
|
+
|
|
1278
1349
|
.code-block pre::-webkit-scrollbar-track {
|
|
1279
1350
|
background: rgba(
|
|
1280
1351
|
0,
|
|
@@ -1283,16 +1354,20 @@ pre.shiki[style*="github-light"] code span.line[data-line]::before {
|
|
|
1283
1354
|
0.2
|
|
1284
1355
|
); /* Semi-transparent to adapt to any background */
|
|
1285
1356
|
}
|
|
1357
|
+
|
|
1286
1358
|
.code-block pre::-webkit-scrollbar-thumb {
|
|
1287
1359
|
background: rgba(255, 255, 255, 0.2); /* Semi-transparent thumb */
|
|
1288
1360
|
border-radius: 0;
|
|
1289
1361
|
}
|
|
1362
|
+
|
|
1290
1363
|
.code-block pre::-webkit-scrollbar-thumb:hover {
|
|
1291
1364
|
background: rgba(255, 255, 255, 0.3); /* Lighter on hover */
|
|
1292
1365
|
}
|
|
1366
|
+
|
|
1293
1367
|
/* ============================================================================
|
|
1294
1368
|
ANIMATIONS
|
|
1295
1369
|
============================================================================ */
|
|
1370
|
+
|
|
1296
1371
|
@keyframes fadeIn {
|
|
1297
1372
|
from {
|
|
1298
1373
|
opacity: 0;
|
|
@@ -1303,16 +1378,20 @@ pre.shiki[style*="github-light"] code span.line[data-line]::before {
|
|
|
1303
1378
|
transform: translateY(0);
|
|
1304
1379
|
}
|
|
1305
1380
|
}
|
|
1381
|
+
|
|
1306
1382
|
.animate-fadeIn {
|
|
1307
1383
|
animation: fadeIn 0.3s ease-out;
|
|
1308
1384
|
}
|
|
1385
|
+
|
|
1309
1386
|
/* Smooth transitions - applied to specific elements only */
|
|
1310
1387
|
/* Note: Transitions are handled individually in Tailwind classes for better control */
|
|
1388
|
+
|
|
1311
1389
|
/* ============================================================================
|
|
1312
1390
|
LIGHT THEME OVERRIDES
|
|
1313
1391
|
Applied when `code-samples-light` class is on the container.
|
|
1314
1392
|
Dark remains the default — production is unaffected.
|
|
1315
1393
|
============================================================================ */
|
|
1394
|
+
|
|
1316
1395
|
/* Light Shiki theme on container — matches site light mode Sample Request */
|
|
1317
1396
|
.code-samples-light {
|
|
1318
1397
|
--code-samples-chrome-bg: var(--cb-white, #ffffff);
|
|
@@ -1324,6 +1403,7 @@ pre.shiki[style*="github-light"] code span.line[data-line]::before {
|
|
|
1324
1403
|
--code-samples-description-fg: var(--cb-gray-800, #1f2937);
|
|
1325
1404
|
--code-samples-code-bg: var(--cb-gray-100, #f3f4f6);
|
|
1326
1405
|
}
|
|
1406
|
+
|
|
1327
1407
|
/* Dark mode always wins over .code-samples-light — higher specificity (2 classes vs 1)
|
|
1328
1408
|
ensures the class applied via React state can never override the .dark CSS variables
|
|
1329
1409
|
that are set by the inline theme script before React hydrates. */
|
|
@@ -1341,33 +1421,41 @@ html.dark .code-samples-light {
|
|
|
1341
1421
|
--code-samples-description-fg: var(--cb-text-primary, #e1e4e8);
|
|
1342
1422
|
--code-samples-code-bg: var(--cb-deep-blue, #050d12);
|
|
1343
1423
|
}
|
|
1424
|
+
|
|
1344
1425
|
.code-samples-light .code-samples-header h3 {
|
|
1345
1426
|
color: var(--code-samples-carousel-nav-fg);
|
|
1346
1427
|
}
|
|
1428
|
+
|
|
1347
1429
|
/* Scrollbar for light theme */
|
|
1348
1430
|
.code-samples-light .code-block pre::-webkit-scrollbar-track {
|
|
1349
1431
|
background: rgba(0, 0, 0, 0.05);
|
|
1350
1432
|
}
|
|
1433
|
+
|
|
1351
1434
|
.code-samples-light .code-block pre::-webkit-scrollbar-thumb {
|
|
1352
1435
|
background: rgba(0, 0, 0, 0.15);
|
|
1353
1436
|
}
|
|
1437
|
+
|
|
1354
1438
|
.code-samples-light .code-block pre::-webkit-scrollbar-thumb:hover {
|
|
1355
1439
|
background: rgba(0, 0, 0, 0.25);
|
|
1356
1440
|
}
|
|
1441
|
+
|
|
1357
1442
|
/* Dual-theme tokens from highlightCode({ colorMode: "dual" }).
|
|
1358
1443
|
Host `html.dark` (cb-docs ThemeToggle) or `.dark` (API Docs) selects the set. */
|
|
1359
1444
|
.shiki.cb-dual-theme span {
|
|
1360
1445
|
color: var(--shiki-light);
|
|
1361
1446
|
}
|
|
1447
|
+
|
|
1362
1448
|
html.dark .shiki.cb-dual-theme span,
|
|
1363
1449
|
.dark .shiki.cb-dual-theme span {
|
|
1364
1450
|
color: var(--shiki-dark);
|
|
1365
1451
|
}
|
|
1452
|
+
|
|
1366
1453
|
/* ============================================================================
|
|
1367
1454
|
DOCS TABS (opt-in: features.languageSwitcher === "tabs")
|
|
1368
1455
|
Checkout Portal pills: tablist sits on the page; only the code well is boxed.
|
|
1369
1456
|
Gated so API Docs chrome is unchanged when the attribute is absent/none.
|
|
1370
1457
|
============================================================================ */
|
|
1458
|
+
|
|
1371
1459
|
[data-language-switcher="tabs"] .code-samples-tablist {
|
|
1372
1460
|
display: flex;
|
|
1373
1461
|
flex-wrap: wrap;
|
|
@@ -1378,6 +1466,7 @@ html.dark .shiki.cb-dual-theme span,
|
|
|
1378
1466
|
background: transparent;
|
|
1379
1467
|
border: 0;
|
|
1380
1468
|
}
|
|
1469
|
+
|
|
1381
1470
|
[data-language-switcher="tabs"] .code-samples-tablist [role="tab"] {
|
|
1382
1471
|
border: 0;
|
|
1383
1472
|
background: transparent;
|
|
@@ -1391,9 +1480,11 @@ html.dark .shiki.cb-dual-theme span,
|
|
|
1391
1480
|
cursor: pointer;
|
|
1392
1481
|
border-radius: 0.25rem;
|
|
1393
1482
|
}
|
|
1483
|
+
|
|
1394
1484
|
[data-language-switcher="tabs"] .code-samples-tablist [role="tab"]:hover {
|
|
1395
1485
|
background: var(--code-samples-tab-pill-hover, #f5f5f5);
|
|
1396
1486
|
}
|
|
1487
|
+
|
|
1397
1488
|
[data-language-switcher="tabs"]
|
|
1398
1489
|
.code-samples-tablist
|
|
1399
1490
|
[role="tab"][aria-selected="true"] {
|
|
@@ -1401,19 +1492,23 @@ html.dark .shiki.cb-dual-theme span,
|
|
|
1401
1492
|
color: var(--cb-text-primary, #1a1a1a);
|
|
1402
1493
|
background: var(--code-samples-tab-pill, #d3d9dc);
|
|
1403
1494
|
}
|
|
1495
|
+
|
|
1404
1496
|
[data-language-switcher="tabs"]
|
|
1405
1497
|
.code-samples-tablist
|
|
1406
1498
|
[role="tab"]:focus-visible {
|
|
1407
1499
|
outline: 2px solid var(--cb-spunky-lime, #bff90b);
|
|
1408
1500
|
outline-offset: 2px;
|
|
1409
1501
|
}
|
|
1502
|
+
|
|
1410
1503
|
[data-language-switcher="tabs"] .code-samples-container {
|
|
1411
1504
|
border-radius: 0.5rem;
|
|
1412
1505
|
}
|
|
1506
|
+
|
|
1413
1507
|
html.dark [data-language-switcher="tabs"] .code-samples-tablist [role="tab"],
|
|
1414
1508
|
.dark [data-language-switcher="tabs"] .code-samples-tablist [role="tab"] {
|
|
1415
1509
|
color: var(--cb-text-primary, #e1e4e8);
|
|
1416
1510
|
}
|
|
1511
|
+
|
|
1417
1512
|
html.dark
|
|
1418
1513
|
[data-language-switcher="tabs"]
|
|
1419
1514
|
.code-samples-tablist
|
|
@@ -1421,6 +1516,7 @@ html.dark
|
|
|
1421
1516
|
.dark [data-language-switcher="tabs"] .code-samples-tablist [role="tab"]:hover {
|
|
1422
1517
|
background: rgba(211, 217, 220, 0.12);
|
|
1423
1518
|
}
|
|
1519
|
+
|
|
1424
1520
|
html.dark
|
|
1425
1521
|
[data-language-switcher="tabs"]
|
|
1426
1522
|
.code-samples-tablist
|
|
@@ -24,9 +24,11 @@ export interface CodeBlockProps {
|
|
|
24
24
|
showLineNumbers?: boolean;
|
|
25
25
|
showCopyButton?: boolean;
|
|
26
26
|
hideImports?: boolean;
|
|
27
|
+
/** Called after the overlay copy button copies `code`. */
|
|
28
|
+
onCopy?: (code: string) => void;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* CodeBlock Component
|
|
30
32
|
* Renders syntax-highlighted code using precomputed HTML or client Shiki.
|
|
31
33
|
*/
|
|
32
|
-
export declare function CodeBlock({ code, language, html: htmlProp, colorMode, theme: themeProp, className, showLineNumbers, showCopyButton, hideImports: hideImportsProp, }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function CodeBlock({ code, language, html: htmlProp, colorMode, theme: themeProp, className, showLineNumbers, showCopyButton, hideImports: hideImportsProp, onCopy, }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -83,5 +83,5 @@ import type { CodeSamplesPropsInterface } from "../types";
|
|
|
83
83
|
* />
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
|
-
export declare function CodeSamples({ codeString, language, samples, responseData, initialLanguage, showFullSampleResponse, theme: themeProp, responseTheme: responseThemeProp, highlighter, features, className, style, onLanguageChange, onCopy: _onCopy, //
|
|
86
|
+
export declare function CodeSamples({ codeString, language, samples, responseData, initialLanguage, showFullSampleResponse, theme: themeProp, responseTheme: responseThemeProp, highlighter, features, className, style, onLanguageChange, onCopy: _onCopy, // Fired by every copy control: header, panel overlay, response
|
|
87
87
|
onSampleChange, replacements, codeHighlightLanguage, requestFooter, }: CodeSamplesPropsInterface): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,5 +14,7 @@ export interface CopyButtonProps {
|
|
|
14
14
|
variant?: "icon" | "labeled";
|
|
15
15
|
/** Icon overlay only. `"hover"` hides until the well is hovered/focused. */
|
|
16
16
|
reveal?: "hover" | "always";
|
|
17
|
+
/** Called once after the code is written to the clipboard (analytics hook). */
|
|
18
|
+
onCopy?: (code: string) => void;
|
|
17
19
|
}
|
|
18
|
-
export declare function CopyButton({ code, theme, className, toggleDelay, variant, reveal, }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function CopyButton({ code, theme, className, toggleDelay, variant, reveal, onCopy, }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Supported programming languages for code generation.
|
|
7
7
|
* Matches the generator registry in src/generators/index.ts
|
|
8
8
|
*/
|
|
9
|
-
export type Language = "curl" | "node-v2" | "node-v3" | "python-v2" | "python-v3" | "java-v3" | "java-v4" | "php-v3" | "php-v4" | "ruby" | "go-v3" | "go-v4" | "dotnet";
|
|
9
|
+
export type Language = "curl" | "node-v2" | "node-v3" | "python-v2" | "python-v3" | "java-v3" | "java-v4" | "php-v3" | "php-v4" | "ruby" | "go-v3" | "go-v4" | "dotnet" | "chargebee-cli";
|
|
10
10
|
export declare const LANGUAGES: Language[];
|
|
11
11
|
export type ApiVersion = "v1" | "v2";
|
|
12
12
|
export type PcVersion = "v1" | "v2";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as generateFromSample,
|
|
1
|
+
import { l as generateFromSample, m as getGenerator, c as LanguageNotSupportedError, v as resolveDescriptor, O as OperationNotFoundError, h as expandDescriptor, d as assertValid, e as buildIR, C as CodeGenerationError, s as getSupportedLanguages } from "./generate-from-sample-C3k_DgbX.js";
|
|
2
2
|
const LANGUAGES = [
|
|
3
3
|
"curl",
|
|
4
4
|
"node-v2",
|
|
@@ -12,7 +12,8 @@ const LANGUAGES = [
|
|
|
12
12
|
"ruby",
|
|
13
13
|
"go-v3",
|
|
14
14
|
"go-v4",
|
|
15
|
-
"dotnet"
|
|
15
|
+
"dotnet",
|
|
16
|
+
"chargebee-cli"
|
|
16
17
|
];
|
|
17
18
|
function toPascalCase(str) {
|
|
18
19
|
return str.split(/[-_]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join("");
|
|
@@ -333,12 +334,12 @@ function stripPathParams(params, pathTemplate, bodySchema) {
|
|
|
333
334
|
}
|
|
334
335
|
export {
|
|
335
336
|
LANGUAGES as L,
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
337
|
+
enrichDescriptorsWithOpenAPI as a,
|
|
338
|
+
extractReturnsByOperationId as b,
|
|
339
|
+
extractReturnsFromOpenAPI as c,
|
|
340
|
+
generateCodeSamples as d,
|
|
341
|
+
enrichDescriptorWithOpenAPI as e,
|
|
342
|
+
findOperationById as f,
|
|
343
|
+
generateCodeSample as g,
|
|
344
|
+
generateCodeSamplesBatch as h
|
|
344
345
|
};
|