mintlify 1.1.8 → 1.1.9

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 (171) hide show
  1. package/README.md +0 -1
  2. package/bin/constants.js +0 -1
  3. package/bin/constants.js.map +1 -1
  4. package/bin/index.js +0 -2
  5. package/bin/index.js.map +1 -1
  6. package/bin/local-preview/helper-commands/cleanCommand.js +8 -0
  7. package/bin/local-preview/helper-commands/cleanCommand.js.map +1 -0
  8. package/bin/local-preview/index.js +1 -17
  9. package/bin/local-preview/index.js.map +1 -1
  10. package/bin/scraping/scrapeSectionCommands.js +2 -5
  11. package/bin/scraping/scrapeSectionCommands.js.map +1 -1
  12. package/package.json +1 -1
  13. package/src/constants.ts +0 -5
  14. package/src/index.ts +0 -9
  15. package/src/local-preview/index.ts +0 -22
  16. package/src/scraping/scrapeSectionCommands.ts +2 -5
  17. package/bin/local-preview/injectNav.js +0 -94
  18. package/bin/local-preview/injectNav.js.map +0 -1
  19. package/bin/mint/client/.babel-plugin-macrosrc.json +0 -5
  20. package/bin/mint/client/.babelrc +0 -4
  21. package/bin/mint/client/.editorconfig +0 -12
  22. package/bin/mint/client/.eslintrc.json +0 -7
  23. package/bin/mint/client/.prettierignore +0 -4
  24. package/bin/mint/client/.prettierrc +0 -14
  25. package/bin/mint/client/.vscode/launch.json +0 -28
  26. package/bin/mint/client/README.md +0 -44
  27. package/bin/mint/client/jest.config.ts +0 -195
  28. package/bin/mint/client/next-env.d.ts +0 -4
  29. package/bin/mint/client/next.config.js +0 -152
  30. package/bin/mint/client/package.json +0 -139
  31. package/bin/mint/client/postcss.config.cjs +0 -9
  32. package/bin/mint/client/prebuild/faviconConfig.js +0 -35
  33. package/bin/mint/client/prebuild/getOpenApiContext.js +0 -53
  34. package/bin/mint/client/prebuild/index.js +0 -117
  35. package/bin/mint/client/prebuild/injectNav.js +0 -115
  36. package/bin/mint/client/prebuild/slugToTitle.js +0 -7
  37. package/bin/mint/client/rehype/withApiComponents.js +0 -60
  38. package/bin/mint/client/rehype/withCodeBlocks.js +0 -54
  39. package/bin/mint/client/rehype/withLayouts.js +0 -113
  40. package/bin/mint/client/rehype/withLinkRoles.js +0 -13
  41. package/bin/mint/client/rehype/withRawComponents.js +0 -13
  42. package/bin/mint/client/rehype/withStaticProps.js +0 -25
  43. package/bin/mint/client/rehype/withSyntaxHighlighting.js +0 -60
  44. package/bin/mint/client/remark/utils.js +0 -369
  45. package/bin/mint/client/remark/withFrames.js +0 -55
  46. package/bin/mint/client/remark/withImportsInjected.js +0 -36
  47. package/bin/mint/client/remark/withNextLinks.js +0 -37
  48. package/bin/mint/client/remark/withTableOfContents.js +0 -71
  49. package/bin/mint/client/scripts/local.js +0 -177
  50. package/bin/mint/client/sentry.client.config.js +0 -15
  51. package/bin/mint/client/sentry.properties +0 -4
  52. package/bin/mint/client/sentry.server.config.js +0 -15
  53. package/bin/mint/client/src/analytics/AbstractAnalyticsImplementation.ts +0 -50
  54. package/bin/mint/client/src/analytics/AnalyticsContext.ts +0 -5
  55. package/bin/mint/client/src/analytics/AnalyticsMediator.ts +0 -101
  56. package/bin/mint/client/src/analytics/FakeAnalyticsMediator.ts +0 -9
  57. package/bin/mint/client/src/analytics/GA4Script.tsx +0 -33
  58. package/bin/mint/client/src/analytics/implementations/amplitude.ts +0 -26
  59. package/bin/mint/client/src/analytics/implementations/fathom.ts +0 -38
  60. package/bin/mint/client/src/analytics/implementations/ga4.ts +0 -33
  61. package/bin/mint/client/src/analytics/implementations/hotjar.ts +0 -53
  62. package/bin/mint/client/src/analytics/implementations/mixpanel-browser.d.ts +0 -1
  63. package/bin/mint/client/src/analytics/implementations/mixpanel.ts +0 -52
  64. package/bin/mint/client/src/analytics/implementations/posthog.ts +0 -37
  65. package/bin/mint/client/src/components/Accordion/Accordion.tsx +0 -43
  66. package/bin/mint/client/src/components/Accordion/index.ts +0 -4
  67. package/bin/mint/client/src/components/ApiExample.tsx +0 -9
  68. package/bin/mint/client/src/components/Card.tsx +0 -51
  69. package/bin/mint/client/src/components/CodeGroup.tsx +0 -132
  70. package/bin/mint/client/src/components/Editor.tsx +0 -12
  71. package/bin/mint/client/src/components/Expandable.tsx +0 -40
  72. package/bin/mint/client/src/components/Heading.tsx +0 -84
  73. package/bin/mint/client/src/components/Param.tsx +0 -56
  74. package/bin/mint/client/src/components/Request.tsx +0 -19
  75. package/bin/mint/client/src/components/ResponseField.tsx +0 -33
  76. package/bin/mint/client/src/components/TabBar.tsx +0 -61
  77. package/bin/mint/client/src/config.ts +0 -115
  78. package/bin/mint/client/src/css/bar-of-progress.css +0 -10
  79. package/bin/mint/client/src/css/base.css +0 -29
  80. package/bin/mint/client/src/css/font-awesome.css +0 -7
  81. package/bin/mint/client/src/css/fonts.css +0 -44
  82. package/bin/mint/client/src/css/main.css +0 -11
  83. package/bin/mint/client/src/css/prism.css +0 -270
  84. package/bin/mint/client/src/css/utilities.css +0 -43
  85. package/bin/mint/client/src/enums/components.ts +0 -8
  86. package/bin/mint/client/src/fonts/FiraCode-VF.woff +0 -0
  87. package/bin/mint/client/src/fonts/FiraCode-VF.woff2 +0 -0
  88. package/bin/mint/client/src/fonts/IBMPlexMono-Regular.ttf +0 -0
  89. package/bin/mint/client/src/fonts/IBMPlexMono-SemiBold.ttf +0 -0
  90. package/bin/mint/client/src/fonts/Inter-italic-latin.var.woff2 +0 -0
  91. package/bin/mint/client/src/fonts/Inter-roman-latin.var.woff2 +0 -0
  92. package/bin/mint/client/src/fonts/Pally-Variable.ttf +0 -0
  93. package/bin/mint/client/src/fonts/SourceSansPro-Regular.otf +0 -0
  94. package/bin/mint/client/src/fonts/SourceSerifPro-Regular.ttf +0 -0
  95. package/bin/mint/client/src/fonts/Synonym-Variable.ttf +0 -0
  96. package/bin/mint/client/src/fonts/Ubuntu-Mono-bold.woff2 +0 -0
  97. package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular-subset.woff2 +0 -0
  98. package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular-subset.zopfli.woff +0 -0
  99. package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular.module.css +0 -11
  100. package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold-subset.woff2 +0 -0
  101. package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold-subset.zopfli.woff +0 -0
  102. package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold.module.css +0 -11
  103. package/bin/mint/client/src/fonts/generated/Pally-Variable-subset.woff2 +0 -0
  104. package/bin/mint/client/src/fonts/generated/Pally-Variable-subset.zopfli.woff +0 -0
  105. package/bin/mint/client/src/fonts/generated/Pally-Variable.module.css +0 -11
  106. package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular-subset.woff2 +0 -0
  107. package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular-subset.zopfli.woff +0 -0
  108. package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular.module.css +0 -11
  109. package/bin/mint/client/src/fonts/generated/Synonym-Variable-subset.woff2 +0 -0
  110. package/bin/mint/client/src/fonts/generated/Synonym-Variable-subset.zopfli.woff +0 -0
  111. package/bin/mint/client/src/fonts/generated/Synonym-Variable.module.css +0 -11
  112. package/bin/mint/client/src/fonts/generated/TenorSans-Regular-subset.woff2 +0 -0
  113. package/bin/mint/client/src/fonts/generated/TenorSans-Regular-subset.zopfli.woff +0 -0
  114. package/bin/mint/client/src/fonts/generated/TenorSans-Regular.module.css +0 -11
  115. package/bin/mint/client/src/hooks/useActionKey.ts +0 -20
  116. package/bin/mint/client/src/hooks/useIsomorphicLayoutEffect.ts +0 -3
  117. package/bin/mint/client/src/hooks/useMedia.ts +0 -27
  118. package/bin/mint/client/src/hooks/usePrevNext.ts +0 -34
  119. package/bin/mint/client/src/hooks/useTop.ts +0 -15
  120. package/bin/mint/client/src/icons/CopyToClipboard.tsx +0 -33
  121. package/bin/mint/client/src/index.d.ts +0 -1
  122. package/bin/mint/client/src/layouts/ApiSupplemental.tsx +0 -173
  123. package/bin/mint/client/src/layouts/ContentsLayout.tsx +0 -256
  124. package/bin/mint/client/src/layouts/DocumentationLayout.tsx +0 -44
  125. package/bin/mint/client/src/layouts/OpenApiContent.tsx +0 -301
  126. package/bin/mint/client/src/layouts/SidebarLayout.tsx +0 -412
  127. package/bin/mint/client/src/layouts/UserFeedback.tsx +0 -73
  128. package/bin/mint/client/src/layouts/getGroupsInDivision.ts +0 -25
  129. package/bin/mint/client/src/layouts/isPathInGroupPages.ts +0 -10
  130. package/bin/mint/client/src/metadata.ts +0 -58
  131. package/bin/mint/client/src/nav.json +0 -219
  132. package/bin/mint/client/src/openapi.ts +0 -3
  133. package/bin/mint/client/src/pages/404.tsx +0 -73
  134. package/bin/mint/client/src/pages/_app.tsx +0 -138
  135. package/bin/mint/client/src/pages/_document.tsx +0 -57
  136. package/bin/mint/client/src/pages/api/issue.ts +0 -10
  137. package/bin/mint/client/src/pages/api/name.ts +0 -8
  138. package/bin/mint/client/src/pages/api/request.ts +0 -31
  139. package/bin/mint/client/src/pages/api/suggest.ts +0 -10
  140. package/bin/mint/client/src/pages/api/syntax-highlighted-json.ts +0 -13
  141. package/bin/mint/client/src/pages/api/utils.ts +0 -6
  142. package/bin/mint/client/src/pages/index.tsx +0 -31
  143. package/bin/mint/client/src/ui/Api.tsx +0 -359
  144. package/bin/mint/client/src/ui/Footer.tsx +0 -124
  145. package/bin/mint/client/src/ui/Header.tsx +0 -370
  146. package/bin/mint/client/src/ui/Logo.tsx +0 -55
  147. package/bin/mint/client/src/ui/PageHeader.tsx +0 -51
  148. package/bin/mint/client/src/ui/Search.tsx +0 -386
  149. package/bin/mint/client/src/ui/ThemeToggle.tsx +0 -285
  150. package/bin/mint/client/src/ui/Title.tsx +0 -22
  151. package/bin/mint/client/src/ui/TopLevelLink.tsx +0 -122
  152. package/bin/mint/client/src/utils/api.ts +0 -252
  153. package/bin/mint/client/src/utils/brands.ts +0 -217
  154. package/bin/mint/client/src/utils/castArray.ts +0 -3
  155. package/bin/mint/client/src/utils/childrenArray.ts +0 -3
  156. package/bin/mint/client/src/utils/fit.ts +0 -27
  157. package/bin/mint/client/src/utils/fontAwesome.ts +0 -577
  158. package/bin/mint/client/src/utils/getAnalyticsConfig.ts +0 -14
  159. package/bin/mint/client/src/utils/getLogoHref.ts +0 -9
  160. package/bin/mint/client/src/utils/getOpenApiContext.ts +0 -26
  161. package/bin/mint/client/src/utils/importAll.ts +0 -6
  162. package/bin/mint/client/src/utils/isObject.ts +0 -3
  163. package/bin/mint/client/src/utils/kebabToTitleCase.ts +0 -3
  164. package/bin/mint/client/src/utils/loadImage.ts +0 -8
  165. package/bin/mint/client/src/utils/slugToTitle.ts +0 -7
  166. package/bin/mint/client/src/utils/wait.ts +0 -5
  167. package/bin/mint/client/tailwind.config.cjs +0 -323
  168. package/bin/mint/client/test/test.test.ts +0 -5
  169. package/bin/mint/client/tsconfig.json +0 -36
  170. package/bin/mint/client/yarn.lock +0 -9702
  171. package/src/local-preview/helper-commands/clearCommand.ts +0 -33
@@ -1,122 +0,0 @@
1
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2
- import clsx from 'clsx';
3
- import Link from 'next/link';
4
- import { forwardRef } from 'react';
5
-
6
- import { config } from '@/config';
7
- import {
8
- getAnchorBackgroundColor,
9
- getAnchorHoverBackgroundColor,
10
- getAnchorShadowColor,
11
- getAnchorTextColor,
12
- } from '@/utils/brands';
13
- import { isBrandFontAwesomeIcon } from '@/utils/fontAwesome';
14
-
15
- type TopLevelProps = {
16
- href: string;
17
- i: number;
18
- isActive: boolean;
19
- children?: any;
20
- className?: string;
21
- color?: string;
22
- onClick?: (el: any) => void;
23
- icon?: any;
24
- shadow?: string;
25
- mobile?: boolean;
26
- name?: string;
27
- as?: string;
28
- };
29
-
30
- const TopLevelAnchor = forwardRef(
31
- ({ children, href, className, icon, isActive, onClick, color, i }: TopLevelProps, ref: any) => {
32
- const activeBackgroundColor =
33
- config.classes?.activeAnchors ?? getAnchorBackgroundColor(i, color);
34
- const hoverBackgroundColor = config.classes?.anchors ?? getAnchorHoverBackgroundColor(i, color);
35
- const shadowColor = getAnchorShadowColor(i, color);
36
- return (
37
- <li>
38
- <a
39
- ref={ref}
40
- href={href}
41
- onClick={onClick}
42
- className={clsx(
43
- 'group flex items-center lg:text-sm lg:leading-6',
44
- className,
45
- isActive
46
- ? ['font-semibold', getAnchorTextColor(i, color)]
47
- : 'font-medium text-slate-600 hover:text-slate-900 dark:text-slate-400 dark:hover:text-slate-300'
48
- )}
49
- >
50
- <div
51
- className={clsx(
52
- `mr-4 rounded-md ring-slate-900/5 group-hover:ring-slate-900/10 dark:group-hover:highlight-white/10`,
53
- shadowColor || 'shadow-primary/40',
54
- hoverBackgroundColor,
55
- isActive
56
- ? [activeBackgroundColor, 'highlight-slate-700/10 dark:highlight-white/10']
57
- : 'bg-slate-300 highlight-slate-700/5 dark:bg-slate-800 dark:highlight-white/5'
58
- )}
59
- >
60
- {icon}
61
- </div>
62
- {children}
63
- </a>
64
- </li>
65
- );
66
- }
67
- );
68
-
69
- export function TopLevelLink({ ...props }: TopLevelProps) {
70
- const { href, as } = props;
71
- if (/^https?:\/\//.test(href)) {
72
- return <TopLevelAnchor {...props} />;
73
- }
74
-
75
- return (
76
- <Link href={href} as={as} passHref>
77
- <TopLevelAnchor {...props} />
78
- </Link>
79
- );
80
- }
81
-
82
- export function StyledTopLevelLink({
83
- href,
84
- as,
85
- name,
86
- icon,
87
- color,
88
- isActive,
89
- i,
90
- ...props
91
- }: TopLevelProps) {
92
- const isBrandIcon = isBrandFontAwesomeIcon(icon);
93
- const iconPrefix = isBrandIcon ? 'fab' : 'fad';
94
- const Icon =
95
- icon == null ? (
96
- <div className="h-6 w-px"></div>
97
- ) : (
98
- <FontAwesomeIcon
99
- className={clsx(
100
- `h-6 w-6 p-1 text-white secondary-opacity group-hover:fill-primary-dark dark:group-hover:text-white`,
101
- isBrandIcon && 'fa-secondary',
102
- isActive ? 'dark:text-white' : 'dark:text-slate-500',
103
- color == null && 'dark:group-hover:text-white'
104
- )}
105
- icon={[iconPrefix, icon.toLowerCase()]}
106
- />
107
- );
108
- return (
109
- <TopLevelLink
110
- {...props}
111
- as={as}
112
- href={href}
113
- className="mb-4"
114
- icon={Icon}
115
- isActive={isActive}
116
- color={color}
117
- i={i}
118
- >
119
- {name ?? href}
120
- </TopLevelLink>
121
- );
122
- }
@@ -1,252 +0,0 @@
1
- import { AxiosRequestHeaders } from 'axios';
2
- import isAbsoluteUrl from 'is-absolute-url';
3
-
4
- import { ParamProps } from '@/components/Param';
5
- import { config } from '@/config';
6
- import { Component } from '@/enums/components';
7
- import { openApi } from '@/openapi';
8
- import { ApiComponent } from '@/ui/Api';
9
-
10
- export type MediaType = 'json' | 'form';
11
-
12
- export type Child = {
13
- props: ParamProps & { mdxType: string };
14
- };
15
-
16
- export type Children = Child[];
17
-
18
- export type Param = {
19
- name: string;
20
- placeholder?: string;
21
- required?: boolean;
22
- type?: string;
23
- enum?: string[];
24
- format?: string;
25
- };
26
-
27
- export type ParamGroup = {
28
- name: string;
29
- params: Param[];
30
- };
31
-
32
- const paramTypeToNameMap: Record<string, string> = {
33
- auth: 'Authorization',
34
- query: 'Query',
35
- path: 'Path',
36
- body: 'Body',
37
- };
38
-
39
- const getPlaceholderFromObjectOrString = (value: any): undefined => {
40
- return (typeof value === 'string' && value) || value?.value?.toString();
41
- };
42
-
43
- const removeEmpty = (obj?: Object) => {
44
- if (!obj) return obj;
45
-
46
- return Object.fromEntries(Object.entries(obj).filter(([_, v]) => v || v === false));
47
- };
48
-
49
- const potentiallAddPathParams = (inputUrl: string, inputData: Record<string, any>) => {
50
- let url = inputUrl;
51
- if (inputData.Path) {
52
- Object.entries(inputData.Path).forEach(([pathName, pathValue]: [string, any]) => {
53
- if (!pathValue) {
54
- return;
55
- }
56
- url = url.replace(`{${pathName}}`, pathValue);
57
- });
58
- }
59
-
60
- return url;
61
- };
62
-
63
- const getApiBody = (obj: Object, media: MediaType) => {
64
- if (media === 'form') {
65
- let cleanedObj = removeEmpty(obj);
66
- const bodyFormData = new FormData();
67
- for (var key in cleanedObj) {
68
- bodyFormData.append(key, cleanedObj[key]);
69
- }
70
-
71
- return bodyFormData;
72
- }
73
- return removeEmpty(obj);
74
- };
75
-
76
- export const getApiContext = (
77
- apiBase: string,
78
- path: string,
79
- inputData: Record<string, any>,
80
- media: MediaType
81
- ): { url: string; body?: Object; params?: Object; headers?: AxiosRequestHeaders } => {
82
- const endpoint = `${apiBase}${path}`;
83
- const url = potentiallAddPathParams(endpoint, inputData);
84
- const body = getApiBody(inputData.Body, media);
85
- const params = removeEmpty(inputData.Query);
86
- const headers: AxiosRequestHeaders = {};
87
-
88
- if (inputData.Authorization) {
89
- const authEntires = Object.entries(inputData.Authorization);
90
- if (config.api?.auth?.method === 'basic' && authEntires.length === 2) {
91
- let [[usernameField, username], [, password]]: any = authEntires;
92
- // Get order based on username:password
93
- if (
94
- (config.api.auth.name && config.api.auth.name.split(':')[0] !== usernameField) ||
95
- (!config.api.auth.name && usernameField.toLowerCase() !== 'username')
96
- ) {
97
- // switch orders
98
- const temp = username;
99
- username = password;
100
- password = temp;
101
- }
102
- headers.Authorization =
103
- 'Basic ' + Buffer.from(`${username}:${password}`, 'utf8').toString('base64');
104
- } else {
105
- authEntires.forEach(([authName, authValue]: [string, any]) => {
106
- if (authName === 'Bearer') {
107
- headers.Authorization = `Bearer ${authValue}`;
108
- return;
109
- }
110
-
111
- headers[authName] = authValue;
112
- });
113
- }
114
- }
115
-
116
- return { url, body, params, headers };
117
- };
118
-
119
- export const extractMethodAndEndpoint = (api: string) => {
120
- const methodRegex = /^get|post|put|delete|patch/i;
121
- const foundMethod = api.trim().match(methodRegex);
122
-
123
- const endIndexOfMethod = foundMethod ? api.indexOf(foundMethod[0]) + foundMethod[0].length : 0;
124
-
125
- return {
126
- method: foundMethod ? foundMethod[0].toUpperCase() : undefined,
127
- endpoint: api.substring(endIndexOfMethod).trim(),
128
- };
129
- };
130
-
131
- export const extractBaseAndPath = (endpoint: string, apiBaseIndex = 0) => {
132
- let fullEndpoint;
133
- const baseUrl =
134
- config.api?.baseUrl ?? openApi?.servers?.map((server: { url: string }) => server.url);
135
- if (isAbsoluteUrl(endpoint)) {
136
- fullEndpoint = endpoint;
137
- } else if (baseUrl) {
138
- const selectedBase = Array.isArray(baseUrl) ? baseUrl[apiBaseIndex] : baseUrl;
139
- fullEndpoint = `${selectedBase}${endpoint}`;
140
- } else {
141
- throw new Error('Invalid endpoint');
142
- }
143
-
144
- const url = new URL(fullEndpoint);
145
- const base = url.origin;
146
- const path = fullEndpoint.substring(fullEndpoint.indexOf(base) + base.length);
147
-
148
- return {
149
- path,
150
- base,
151
- };
152
- };
153
-
154
- export const getParamGroupsFromAPIComponents = (
155
- apiComponents?: ApiComponent[],
156
- auth?: string
157
- ): ParamGroup[] => {
158
- const groups: Record<string, Param[]> = {};
159
-
160
- // Add auth if configured
161
- if (auth?.toLowerCase() !== 'none') {
162
- if (config.api?.auth?.name) {
163
- groups.Authorization = [
164
- {
165
- name: config.api.auth.name,
166
- required: true,
167
- },
168
- ];
169
- }
170
-
171
- if (config.api?.auth?.method === 'basic') {
172
- const name = config.api.auth.name || 'username:password';
173
- groups.Authorization = name.split(':').map((section) => {
174
- return {
175
- name: section,
176
- required: true,
177
- };
178
- });
179
- }
180
-
181
- if (config.api?.auth?.method?.toLowerCase() === 'bearer' || auth?.toLowerCase() === 'bearer') {
182
- groups.Authorization = [
183
- {
184
- name: 'Bearer',
185
- required: true,
186
- },
187
- ];
188
- }
189
- }
190
-
191
- const paramFields = apiComponents
192
- ?.filter((apiComponent) => apiComponent.type === Component.ParamField)
193
- .map((apiComponent) => {
194
- const attributesMap: Record<any, any> = {};
195
- apiComponent?.attributes?.forEach((attribute: any) => {
196
- attributesMap[attribute.name] = attribute.value;
197
- });
198
-
199
- return attributesMap;
200
- });
201
-
202
- paramFields?.forEach((paramField) => {
203
- let paramType;
204
- if (paramField?.query) {
205
- paramType = 'query';
206
- } else if (paramField?.path) {
207
- paramType = 'path';
208
- } else if (paramField?.body) {
209
- paramType = 'body';
210
- }
211
-
212
- if (!paramType) {
213
- return;
214
- }
215
-
216
- const groupName = paramTypeToNameMap[paramType];
217
- const existingGroup = groups[groupName];
218
-
219
- const { query, body, path } = paramField;
220
-
221
- let name = query || body || path;
222
-
223
- if (!name) {
224
- return;
225
- }
226
-
227
- const { placeholder, default: defaultValue, required, type, enum: enumValues } = paramField;
228
-
229
- const param = {
230
- name,
231
- placeholder:
232
- getPlaceholderFromObjectOrString(placeholder) ||
233
- getPlaceholderFromObjectOrString(defaultValue),
234
- required: required === null || required === true, // intentionally check for just null or true
235
- type,
236
- enum: enumValues,
237
- };
238
-
239
- if (existingGroup) {
240
- groups[groupName] = [...existingGroup, param];
241
- } else {
242
- groups[groupName] = [param];
243
- }
244
- });
245
-
246
- return Object.entries(groups).map(([groupName, params]) => {
247
- return {
248
- name: groupName,
249
- params,
250
- };
251
- });
252
- };
@@ -1,217 +0,0 @@
1
- // For PostCSS parsers
2
- export const getAnchorBackgroundColor = (i: number, color?: string) => {
3
- if (!color) {
4
- return 'bg-primary';
5
- }
6
-
7
- switch (i) {
8
- case 0:
9
- return 'bg-anchor-0';
10
- case 1:
11
- return 'bg-anchor-1';
12
- case 2:
13
- return 'bg-anchor-2';
14
- case 3:
15
- return 'bg-anchor-3';
16
- case 4:
17
- return 'bg-anchor-4';
18
- case 5:
19
- return 'bg-anchor-5';
20
- case 6:
21
- return 'bg-anchor-6';
22
- case 7:
23
- return 'bg-anchor-7';
24
- case 8:
25
- return 'bg-anchor-8';
26
- case 9:
27
- return 'bg-anchor-9';
28
- case 10:
29
- return 'bg-anchor-10';
30
- default:
31
- return 'bg-primary';
32
- }
33
- };
34
-
35
- export const getAnchorHoverBackgroundColor = (i: number, color?: string) => {
36
- if (!color) {
37
- return 'group-hover:bg-primary';
38
- }
39
-
40
- switch (i) {
41
- case 0:
42
- return 'group-hover:bg-anchor-0';
43
- case 1:
44
- return 'group-hover:bg-anchor-1';
45
- case 2:
46
- return 'group-hover:bg-anchor-2';
47
- case 3:
48
- return 'group-hover:bg-anchor-3';
49
- case 4:
50
- return 'group-hover:bg-anchor-4';
51
- case 5:
52
- return 'group-hover:bg-anchor-5';
53
- case 6:
54
- return 'group-hover:bg-anchor-6';
55
- case 7:
56
- return 'group-hover:bg-anchor-7';
57
- case 8:
58
- return 'group-hover:bg-anchor-8';
59
- case 9:
60
- return 'group-hover:bg-anchor-9';
61
- case 10:
62
- return 'group-hover:bg-anchor-10';
63
- default:
64
- return 'group-hover:bg-primary';
65
- }
66
- };
67
-
68
- export const getAnchorTextColor = (i: number, color?: string) => {
69
- if (!color) {
70
- return 'text-primary dark:text-primary-light';
71
- }
72
-
73
- switch (i) {
74
- case 0:
75
- return 'text-anchor-0';
76
- case 1:
77
- return 'text-anchor-1';
78
- case 2:
79
- return 'text-anchor-2';
80
- case 3:
81
- return 'text-anchor-3';
82
- case 4:
83
- return 'text-anchor-4';
84
- case 5:
85
- return 'text-anchor-5';
86
- case 6:
87
- return 'text-anchor-6';
88
- case 7:
89
- return 'text-anchor-7';
90
- case 8:
91
- return 'text-anchor-8';
92
- case 9:
93
- return 'text-anchor-9';
94
- case 10:
95
- return 'text-anchor-10';
96
- default:
97
- return 'text-primary dark:text-primary-light';
98
- }
99
- };
100
-
101
- export const getAnchorShadowColor = (i: number, color?: string) => {
102
- if (!color) {
103
- return 'shadow-primary/40';
104
- }
105
-
106
- switch (i) {
107
- case 0:
108
- return 'shadow-anchor-0/40';
109
- case 1:
110
- return 'shadow-anchor-1/40';
111
- case 2:
112
- return 'shadow-anchor-2/40';
113
- case 3:
114
- return 'shadow-anchor-3/40';
115
- case 4:
116
- return 'shadow-anchor-4/40';
117
- case 5:
118
- return 'shadow-anchor-5/40';
119
- case 6:
120
- return 'shadow-anchor-6/40';
121
- case 7:
122
- return 'shadow-anchor-7/40';
123
- case 8:
124
- return 'shadow-anchor-8/40';
125
- case 9:
126
- return 'shadow-anchor-9/40';
127
- case 10:
128
- return 'shadow-anchor-10/40';
129
- default:
130
- return 'shadow-primary/40';
131
- }
132
- };
133
-
134
- export const getMethodDotsColor = (method?: string) => {
135
- switch (method?.toUpperCase()) {
136
- case 'GET':
137
- return 'bg-green-600/80 dark:bg-green-400/80';
138
- case 'POST':
139
- return 'bg-blue-600/80 dark:bg-blue-400/80';
140
- case 'PUT':
141
- return 'bg-yellow-600/80 dark:bg-yellow-400/80';
142
- case 'DELETE':
143
- return 'bg-red-600/80 dark:bg-red-400/80';
144
- case 'PATCH':
145
- return 'bg-orange-600/80 dark:bg-orange-400/80';
146
- default:
147
- return 'bg-slate-600 dark:bg-slate-400/80';
148
- }
149
- };
150
-
151
- export const getMethodBgColor = (method?: string) => {
152
- switch (method?.toUpperCase()) {
153
- case 'GET':
154
- return 'bg-green-600';
155
- case 'POST':
156
- return 'bg-blue-600';
157
- case 'PUT':
158
- return 'bg-yellow-600';
159
- case 'DELETE':
160
- return 'bg-red-600';
161
- case 'PATCH':
162
- return 'bg-orange-600';
163
- default:
164
- return 'bg-slate-600';
165
- }
166
- };
167
-
168
- export const getMethodBgColorWithHover = (method?: string) => {
169
- switch (method?.toUpperCase()) {
170
- case 'GET':
171
- return 'bg-green-600 hover:bg-green-800 disabled:bg-green-700';
172
- case 'POST':
173
- return 'bg-blue-600 hover:bg-blue-800 disabled:bg-blue-700';
174
- case 'PUT':
175
- return 'bg-yellow-600 hover:bg-yellow-800 disabled:bg-yellow-700';
176
- case 'DELETE':
177
- return 'bg-red-600 hover:bg-red-800 disabled:bg-red-700';
178
- case 'PATCH':
179
- return 'bg-orange-600 hover:bg-orange-800 disabled:bg-orange-700';
180
- default:
181
- return 'bg-slate-600 hover:bg-slate-800 disabled:bg-slate-700';
182
- }
183
- };
184
-
185
- export const getMethodTextColor = (method?: string) => {
186
- switch (method?.toUpperCase()) {
187
- case 'GET':
188
- return 'text-green-600 dark:text-green-500';
189
- case 'POST':
190
- return 'text-blue-600 dark:text-blue-500';
191
- case 'PUT':
192
- return 'text-yellow-600 dark:text-yellow-500';
193
- case 'DELETE':
194
- return 'text-red-600 dark:text-red-500';
195
- case 'PATCH':
196
- return 'text-orange-600 dark:text-orange-500';
197
- default:
198
- return 'text-slate-600 dark:text-slate-500';
199
- }
200
- };
201
-
202
- export const getMethodBorderColor = (method?: string) => {
203
- switch (method?.toUpperCase()) {
204
- case 'GET':
205
- return 'border-green-600 dark:border-green-500';
206
- case 'POST':
207
- return 'border-blue-600 dark:border-blue-500';
208
- case 'PUT':
209
- return 'border-yellow-600 dark:border-yellow-500';
210
- case 'DELETE':
211
- return 'border-red-600 dark:border-red-500';
212
- case 'PATCH':
213
- return 'border-orange-600 dark:border-orange-500';
214
- default:
215
- return 'border-slate-600 dark:border-slate-500';
216
- }
217
- };
@@ -1,3 +0,0 @@
1
- export function castArray(value: any) {
2
- return Array.isArray(value) ? value : [value]
3
- }
@@ -1,3 +0,0 @@
1
- export const childrenArray = (children: any) => {
2
- return Array.isArray(children) ? children.flat() : [children];
3
- };
@@ -1,27 +0,0 @@
1
- export function fit(
2
- parentWidth: number,
3
- parentHeight: number,
4
- childWidth: number,
5
- childHeight: number,
6
- scale = 1,
7
- offsetX = 0.5,
8
- offsetY = 0.5
9
- ) {
10
- const childRatio = childWidth / childHeight
11
- const parentRatio = parentWidth / parentHeight
12
- let width = parentWidth * scale
13
- let height = parentHeight * scale
14
-
15
- if (childRatio < parentRatio) {
16
- height = width / childRatio
17
- } else {
18
- width = height * childRatio
19
- }
20
-
21
- return {
22
- width: Math.round(width),
23
- height: Math.round(height),
24
- left: Math.round((parentWidth - width) * offsetX),
25
- top: Math.round((parentHeight - height) * offsetY),
26
- }
27
- }