skuse-ui 0.1.0

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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/dist/SkuseDocumentation.d.ts +10 -0
  4. package/dist/components/Skeletons/EndpointSkeleton.d.ts +2 -0
  5. package/dist/components/Skeletons/HomeSkeleton.d.ts +2 -0
  6. package/dist/components/Skeletons/LayoutSkeleton.d.ts +2 -0
  7. package/dist/components/Skeletons/SidebarSkeleton.d.ts +1 -0
  8. package/dist/components/layouts/MinimifiedInfo.d.ts +6 -0
  9. package/dist/components/layouts/Sidebar.d.ts +3 -0
  10. package/dist/components/openapi/Auth/AuthButton.d.ts +11 -0
  11. package/dist/components/openapi/Auth/AuthCard.d.ts +7 -0
  12. package/dist/components/openapi/Auth/AuthDialog.d.ts +8 -0
  13. package/dist/components/openapi/Auth/AuthMethods.d.ts +14 -0
  14. package/dist/components/openapi/Endpoint/CallbackViewer.d.ts +6 -0
  15. package/dist/components/openapi/Endpoint/CodeExamples.d.ts +16 -0
  16. package/dist/components/openapi/Endpoint/EndpointDetails.d.ts +3 -0
  17. package/dist/components/openapi/Endpoint/ExternalDocsLink.d.ts +6 -0
  18. package/dist/components/openapi/Endpoint/ParametersViewer.d.ts +7 -0
  19. package/dist/components/openapi/Endpoint/PlaygroundForm.d.ts +23 -0
  20. package/dist/components/openapi/Endpoint/PlaygroundResponse.d.ts +13 -0
  21. package/dist/components/openapi/Endpoint/RequestBodyViewer.d.ts +8 -0
  22. package/dist/components/openapi/Endpoint/ResponseViewer.d.ts +9 -0
  23. package/dist/components/openapi/Endpoint/SchemaBadges.d.ts +8 -0
  24. package/dist/components/openapi/Endpoint/SchemaExpandContext.d.ts +6 -0
  25. package/dist/components/openapi/Endpoint/SchemaProperty.d.ts +11 -0
  26. package/dist/components/openapi/Endpoint/SchemaViewer.d.ts +13 -0
  27. package/dist/components/openapi/FormattedMarkdown.d.ts +12 -0
  28. package/dist/components/openapi/Information.d.ts +3 -0
  29. package/dist/components/openapi/Models.d.ts +3 -0
  30. package/dist/components/openapi/Servers.d.ts +7 -0
  31. package/dist/components/openapi/TagsOverview.d.ts +3 -0
  32. package/dist/components/openapi/WebhookDetails.d.ts +3 -0
  33. package/dist/components/theme-provider.d.ts +13 -0
  34. package/dist/components/ui/accordion.d.ts +7 -0
  35. package/dist/components/ui/alert.d.ts +8 -0
  36. package/dist/components/ui/badge.d.ts +9 -0
  37. package/dist/components/ui/button.d.ts +11 -0
  38. package/dist/components/ui/card.d.ts +8 -0
  39. package/dist/components/ui/carousel.d.ts +18 -0
  40. package/dist/components/ui/checkbox.d.ts +4 -0
  41. package/dist/components/ui/collapsible.d.ts +5 -0
  42. package/dist/components/ui/command.d.ts +80 -0
  43. package/dist/components/ui/dialog.d.ts +19 -0
  44. package/dist/components/ui/input.d.ts +3 -0
  45. package/dist/components/ui/label.d.ts +5 -0
  46. package/dist/components/ui/popover.d.ts +6 -0
  47. package/dist/components/ui/select.d.ts +13 -0
  48. package/dist/components/ui/sheet.d.ts +25 -0
  49. package/dist/components/ui/skeleton.d.ts +2 -0
  50. package/dist/components/ui/sonner.d.ts +4 -0
  51. package/dist/components/ui/switch.d.ts +4 -0
  52. package/dist/components/ui/tabs.d.ts +7 -0
  53. package/dist/components/ui/tooltip.d.ts +7 -0
  54. package/dist/hooks/OpenAPIContext.d.ts +24 -0
  55. package/dist/hooks/usePlayground.d.ts +40 -0
  56. package/dist/hooks/useSpec.d.ts +10 -0
  57. package/dist/index.d.ts +2 -0
  58. package/dist/lib/utils.d.ts +2 -0
  59. package/dist/main.d.ts +0 -0
  60. package/dist/router/routes.d.ts +2 -0
  61. package/dist/skuse-ui.cjs.js +459 -0
  62. package/dist/skuse-ui.es.js +61257 -0
  63. package/dist/style.css +1 -0
  64. package/dist/test-spec.json +779 -0
  65. package/dist/types/openapi.d.ts +2 -0
  66. package/dist/types/unified-openapi-types.d.ts +402 -0
  67. package/dist/utils/openapi.d.ts +18 -0
  68. package/dist/utils/pkce.d.ts +2 -0
  69. package/package.json +94 -0
@@ -0,0 +1,2 @@
1
+ export * from './unified-openapi-types';
2
+ export type { EnhancedOperationObject, TaggedOperationsMap } from './unified-openapi-types';
@@ -0,0 +1,402 @@
1
+ import { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
2
+ export type OpenAPIInputDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3_1.Document | {
3
+ openapi: string;
4
+ [key: string]: any;
5
+ };
6
+ export type HttpMethod = 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH' | 'TRACE';
7
+ export type PathsObject = {
8
+ [path: string]: PathItemObject;
9
+ };
10
+ export interface UnifiedOpenAPI {
11
+ openapi?: string;
12
+ swagger?: string;
13
+ info: {
14
+ title: string;
15
+ description?: string;
16
+ termsOfService?: string;
17
+ contact?: {
18
+ name?: string;
19
+ url?: string;
20
+ email?: string;
21
+ };
22
+ license?: {
23
+ name: string;
24
+ url?: string;
25
+ identifier?: string;
26
+ };
27
+ version: string;
28
+ summary?: string;
29
+ };
30
+ servers?: ServerObject[];
31
+ paths: {
32
+ [path: string]: {
33
+ summary?: string;
34
+ description?: string;
35
+ get?: OperationObject;
36
+ put?: OperationObject;
37
+ post?: OperationObject;
38
+ delete?: OperationObject;
39
+ options?: OperationObject;
40
+ head?: OperationObject;
41
+ patch?: OperationObject;
42
+ trace?: OperationObject;
43
+ servers?: ServerObject[];
44
+ parameters?: ParameterObject[];
45
+ };
46
+ };
47
+ components?: {
48
+ schemas?: {
49
+ [key: string]: SchemaObject;
50
+ };
51
+ responses?: {
52
+ [key: string]: ResponseObject;
53
+ };
54
+ parameters?: {
55
+ [key: string]: ParameterObject;
56
+ };
57
+ examples?: {
58
+ [key: string]: ExampleObject;
59
+ };
60
+ requestBodies?: {
61
+ [key: string]: RequestBodyObject;
62
+ };
63
+ headers?: {
64
+ [key: string]: HeaderObject;
65
+ };
66
+ securitySchemes?: {
67
+ [key: string]: SecuritySchemeObject;
68
+ };
69
+ links?: {
70
+ [key: string]: LinkObject;
71
+ };
72
+ callbacks?: {
73
+ [key: string]: CallbackObject;
74
+ };
75
+ pathItems?: {
76
+ [key: string]: PathItemObject;
77
+ };
78
+ };
79
+ security?: Array<{
80
+ [key: string]: string[];
81
+ }>;
82
+ tags?: Array<{
83
+ name: string;
84
+ description?: string;
85
+ externalDocs?: {
86
+ description?: string;
87
+ url: string;
88
+ };
89
+ }>;
90
+ externalDocs?: {
91
+ description?: string;
92
+ url: string;
93
+ };
94
+ webhooks?: PathsObject;
95
+ $defs?: Record<string, SchemaObject>;
96
+ }
97
+ export interface OperationObject {
98
+ tags?: string[];
99
+ summary?: string;
100
+ description?: string;
101
+ externalDocs?: {
102
+ description?: string;
103
+ url: string;
104
+ };
105
+ operationId?: string;
106
+ parameters?: ParameterObject[];
107
+ requestBody?: RequestBodyObject;
108
+ responses: {
109
+ [statusCode: string]: ResponseObject;
110
+ };
111
+ callbacks?: {
112
+ [key: string]: CallbackObject;
113
+ };
114
+ deprecated?: boolean;
115
+ security?: Array<{
116
+ [key: string]: string[];
117
+ }>;
118
+ servers?: ServerObject[];
119
+ }
120
+ export interface ParameterObject {
121
+ name: string;
122
+ in: string;
123
+ description?: string;
124
+ required?: boolean;
125
+ deprecated?: boolean;
126
+ allowEmptyValue?: boolean;
127
+ style?: string;
128
+ explode?: boolean;
129
+ allowReserved?: boolean;
130
+ schema?: SchemaObject;
131
+ example?: any;
132
+ examples?: {
133
+ [key: string]: ExampleObject;
134
+ };
135
+ content?: {
136
+ [key: string]: MediaTypeObject;
137
+ };
138
+ }
139
+ export interface SchemaObject {
140
+ type?: string | string[];
141
+ ref?: string;
142
+ refName?: string;
143
+ items?: SchemaObject;
144
+ properties?: {
145
+ [key: string]: SchemaObject;
146
+ };
147
+ additionalProperties?: boolean | SchemaObject;
148
+ description?: string;
149
+ format?: string;
150
+ default?: any;
151
+ title?: string;
152
+ multipleOf?: number;
153
+ maximum?: number;
154
+ exclusiveMaximum?: boolean | number;
155
+ minimum?: number;
156
+ exclusiveMinimum?: boolean | number;
157
+ maxLength?: number;
158
+ minLength?: number;
159
+ pattern?: string;
160
+ maxItems?: number;
161
+ minItems?: number;
162
+ uniqueItems?: boolean;
163
+ maxProperties?: number;
164
+ minProperties?: number;
165
+ required?: string[];
166
+ enum?: any[];
167
+ allOf?: SchemaObject[];
168
+ oneOf?: SchemaObject[];
169
+ anyOf?: SchemaObject[];
170
+ not?: SchemaObject;
171
+ nullable?: boolean;
172
+ discriminator?: {
173
+ propertyName: string;
174
+ mapping?: {
175
+ [key: string]: string;
176
+ };
177
+ };
178
+ readOnly?: boolean;
179
+ writeOnly?: boolean;
180
+ xml?: {
181
+ name?: string;
182
+ namespace?: string;
183
+ prefix?: string;
184
+ attribute?: boolean;
185
+ wrapped?: boolean;
186
+ };
187
+ externalDocs?: {
188
+ description?: string;
189
+ url: string;
190
+ };
191
+ example?: any;
192
+ examples?: any[];
193
+ deprecated?: boolean;
194
+ const?: any;
195
+ contentMediaType?: string;
196
+ contentEncoding?: string;
197
+ patternProperties?: {
198
+ [pattern: string]: SchemaObject;
199
+ };
200
+ propertyNames?: SchemaObject;
201
+ prefixItems?: SchemaObject[];
202
+ if?: SchemaObject;
203
+ then?: SchemaObject;
204
+ else?: SchemaObject;
205
+ contains?: SchemaObject;
206
+ minContains?: number;
207
+ maxContains?: number;
208
+ unevaluatedProperties?: boolean | SchemaObject;
209
+ unevaluatedItems?: boolean | SchemaObject;
210
+ $defs?: Record<string, SchemaObject>;
211
+ $schema?: string;
212
+ }
213
+ export interface ResponseObject {
214
+ description: string;
215
+ headers?: {
216
+ [header: string]: HeaderObject;
217
+ };
218
+ content?: {
219
+ [mediaType: string]: MediaTypeObject;
220
+ };
221
+ links?: {
222
+ [key: string]: LinkObject;
223
+ };
224
+ }
225
+ export interface RequestBodyObject {
226
+ description?: string;
227
+ content: {
228
+ [mediaType: string]: MediaTypeObject;
229
+ };
230
+ required?: boolean;
231
+ }
232
+ export interface MediaTypeObject {
233
+ schema?: SchemaObject;
234
+ example?: any;
235
+ examples?: {
236
+ [key: string]: ExampleObject;
237
+ };
238
+ encoding?: {
239
+ [key: string]: EncodingObject;
240
+ };
241
+ }
242
+ export interface HeaderObject {
243
+ description?: string;
244
+ type?: string;
245
+ required?: boolean;
246
+ deprecated?: boolean;
247
+ allowEmptyValue?: boolean;
248
+ style?: string;
249
+ explode?: boolean;
250
+ allowReserved?: boolean;
251
+ schema?: SchemaObject;
252
+ example?: any;
253
+ examples?: {
254
+ [key: string]: ExampleObject;
255
+ };
256
+ content?: {
257
+ [key: string]: MediaTypeObject;
258
+ };
259
+ }
260
+ export interface ExampleObject {
261
+ summary?: string;
262
+ description?: string;
263
+ value?: any;
264
+ externalValue?: string;
265
+ }
266
+ export interface LinkObject {
267
+ operationRef?: string;
268
+ operationId?: string;
269
+ parameters?: {
270
+ [key: string]: any;
271
+ };
272
+ requestBody?: any;
273
+ description?: string;
274
+ server?: {
275
+ url: string;
276
+ description?: string;
277
+ variables?: {
278
+ [key: string]: {
279
+ enum?: string[];
280
+ default: string;
281
+ description?: string;
282
+ };
283
+ };
284
+ };
285
+ }
286
+ export interface CallbackObject {
287
+ [key: string]: PathItemObject;
288
+ }
289
+ export interface PathItemObject {
290
+ summary?: string;
291
+ description?: string;
292
+ get?: OperationObject;
293
+ put?: OperationObject;
294
+ post?: OperationObject;
295
+ delete?: OperationObject;
296
+ options?: OperationObject;
297
+ head?: OperationObject;
298
+ patch?: OperationObject;
299
+ trace?: OperationObject;
300
+ servers?: ServerObject[];
301
+ parameters?: ParameterObject[];
302
+ }
303
+ export interface EncodingObject {
304
+ contentType?: string;
305
+ headers?: {
306
+ [key: string]: HeaderObject;
307
+ };
308
+ style?: string;
309
+ explode?: boolean;
310
+ allowReserved?: boolean;
311
+ }
312
+ export interface ServerObject {
313
+ url: string;
314
+ description?: string;
315
+ variables?: {
316
+ [key: string]: ServerVariableObject;
317
+ };
318
+ }
319
+ export interface ServerVariableObject {
320
+ enum?: string[];
321
+ default: string;
322
+ description?: string;
323
+ }
324
+ export type SecuritySchemeObject = {
325
+ type: 'http' | 'basic';
326
+ description?: string;
327
+ scheme: string;
328
+ bearerFormat?: string;
329
+ } | {
330
+ type: 'apiKey';
331
+ description?: string;
332
+ name: string;
333
+ in: string;
334
+ } | {
335
+ type: 'oauth2';
336
+ description?: string;
337
+ flows: {
338
+ implicit?: {
339
+ authorizationUrl: string;
340
+ refreshUrl?: string;
341
+ scopes: {
342
+ [scope: string]: string;
343
+ };
344
+ };
345
+ password?: {
346
+ tokenUrl: string;
347
+ refreshUrl?: string;
348
+ scopes: {
349
+ [scope: string]: string;
350
+ };
351
+ };
352
+ clientCredentials?: {
353
+ tokenUrl: string;
354
+ refreshUrl?: string;
355
+ scopes: {
356
+ [scope: string]: string;
357
+ };
358
+ };
359
+ authorizationCode?: {
360
+ authorizationUrl: string;
361
+ tokenUrl: string;
362
+ refreshUrl?: string;
363
+ scopes: {
364
+ [scope: string]: string;
365
+ };
366
+ };
367
+ };
368
+ } | {
369
+ type: 'openIdConnect';
370
+ description?: string;
371
+ openIdConnectUrl: string;
372
+ };
373
+ export type AuthCredential = {
374
+ type: 'bearer';
375
+ token: string;
376
+ } | {
377
+ type: 'basic';
378
+ username: string;
379
+ password: string;
380
+ } | {
381
+ type: 'apiKey';
382
+ key: string;
383
+ in: 'header' | 'query' | 'cookie';
384
+ name: string;
385
+ } | {
386
+ type: 'oauth2';
387
+ accessToken: string;
388
+ tokenType: string;
389
+ scope?: string;
390
+ refreshToken?: string;
391
+ clientId?: string;
392
+ } | {
393
+ type: 'openIdConnect';
394
+ accessToken: string;
395
+ };
396
+ export interface EnhancedOperationObject extends OperationObject {
397
+ path: string;
398
+ method: HttpMethod;
399
+ pathSummary?: string;
400
+ pathDescription?: string;
401
+ }
402
+ export type TaggedOperationsMap = Record<string, EnhancedOperationObject[]>;
@@ -0,0 +1,18 @@
1
+ import { SchemaObject, PathsObject, EnhancedOperationObject, TaggedOperationsMap, HttpMethod, OpenAPIInputDocument, UnifiedOpenAPI } from '../types/openapi';
2
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
3
+ [key: string]: JsonValue;
4
+ };
5
+ declare const resolveOpenAPIDocument: (document: OpenAPIInputDocument) => UnifiedOpenAPI;
6
+ declare const isNullableSchema: (schema: SchemaObject) => boolean;
7
+ declare const renderSchemaType: (schema: SchemaObject) => string;
8
+ declare const generateExample: (schema: SchemaObject | undefined) => JsonValue;
9
+ declare function isValidHttpMethod(method: string): method is HttpMethod;
10
+ declare function groupEndpointsByTags(paths: PathsObject): TaggedOperationsMap;
11
+ declare function findOperationByOperationIdAndTag(paths: PathsObject, operationId: string, tag: string): EnhancedOperationObject | null;
12
+ declare function groupWebhooksByName(webhooks: PathsObject): TaggedOperationsMap;
13
+ declare function findWebhookOperation(webhooks: PathsObject, webhookName: string, operationId: string): EnhancedOperationObject | null;
14
+ declare function getOperationId(operation: EnhancedOperationObject): string;
15
+ declare function getBadgeColor(httpMethod: string): string;
16
+ declare const flattenSchema: (schema: SchemaObject) => SchemaObject;
17
+ declare const isEmptySchema: (schema: SchemaObject) => boolean;
18
+ export { resolveOpenAPIDocument, groupEndpointsByTags, groupWebhooksByName, findOperationByOperationIdAndTag, findWebhookOperation, getBadgeColor, isValidHttpMethod, isNullableSchema, renderSchemaType, generateExample, flattenSchema, isEmptySchema, getOperationId };
@@ -0,0 +1,2 @@
1
+ export declare function generateCodeVerifier(): string;
2
+ export declare function generateCodeChallenge(verifier: string): Promise<string>;
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "skuse-ui",
3
+ "version": "0.1.0",
4
+ "description": "A modern, beautiful OpenAPI documentation viewer — fully compatible with OpenAPI 3.0 and 3.1",
5
+ "keywords": ["openapi", "swagger", "api", "documentation", "react", "ui"],
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Piairre/skuse-ui.git"
10
+ },
11
+ "homepage": "https://github.com/Piairre/skuse-ui",
12
+ "type": "module",
13
+ "main": "./dist/skuse-ui.cjs.js",
14
+ "module": "./dist/skuse-ui.es.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "import": "./dist/skuse-ui.es.js",
19
+ "require": "./dist/skuse-ui.cjs.js",
20
+ "types": "./dist/index.d.ts"
21
+ },
22
+ "./style.css": "./dist/style.css"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "scripts": {
28
+ "dev": "vite",
29
+ "build": "tsc -b && vite build --mode lib",
30
+ "build:app": "tsc -b && vite build",
31
+ "lint": "eslint .",
32
+ "preview": "vite preview"
33
+ },
34
+ "peerDependencies": {
35
+ "react": ">=18",
36
+ "react-dom": ">=18"
37
+ },
38
+ "dependencies": {
39
+ "@radix-ui/react-accordion": "^1.2.1",
40
+ "@radix-ui/react-checkbox": "^1.3.5",
41
+ "@radix-ui/react-collapsible": "^1.1.1",
42
+ "@radix-ui/react-dialog": "^1.1.2",
43
+ "@radix-ui/react-dropdown-menu": "^2.1.6",
44
+ "@radix-ui/react-label": "^2.1.2",
45
+ "@radix-ui/react-popover": "^1.1.2",
46
+ "@radix-ui/react-scroll-area": "^1.2.3",
47
+ "@radix-ui/react-select": "^2.1.6",
48
+ "@radix-ui/react-slot": "^1.1.0",
49
+ "@radix-ui/react-switch": "^1.1.2",
50
+ "@radix-ui/react-tabs": "^1.1.1",
51
+ "@radix-ui/react-tooltip": "^1.2.10",
52
+ "@shadcn/ui": "^0.0.4",
53
+ "@tanstack/react-router": "^1.92.11",
54
+ "@uiw/react-markdown-preview": "^5.1.3",
55
+ "class-variance-authority": "^0.7.1",
56
+ "clsx": "^2.1.1",
57
+ "cmdk": "1.0.0",
58
+ "embla-carousel-react": "^8.6.0",
59
+ "embla-carousel-wheel-gestures": "^8.1.0",
60
+ "httpsnippet-lite": "^3.0.5",
61
+ "lucide-react": "^0.461.0",
62
+ "next-themes": "^0.4.6",
63
+ "openapi-types": "^12.1.3",
64
+ "prismjs": "^1.29.0",
65
+ "rehype-external-links": "^3.0.0",
66
+ "rehype-sanitize": "^6.0.0",
67
+ "sonner": "^2.0.7",
68
+ "tailwind-merge": "^2.5.5",
69
+ "tailwind-scrollbar": "^3.1.0",
70
+ "tailwindcss-animate": "^1.0.7"
71
+ },
72
+ "devDependencies": {
73
+ "@eslint/js": "^9.16.0",
74
+ "@hey-api/openapi-ts": "^0.59.0",
75
+ "@types/node": "^22.10.1",
76
+ "@types/prismjs": "^1.26.5",
77
+ "@types/react": "^18.3.12",
78
+ "@types/react-dom": "^18.3.1",
79
+ "@types/react-syntax-highlighter": "^15.5.13",
80
+ "@vitejs/plugin-react": "^4.3.4",
81
+ "autoprefixer": "^10.4.20",
82
+ "concurrently": "^9.1.0",
83
+ "eslint": "^9.16.0",
84
+ "eslint-plugin-react-hooks": "^5.0.0",
85
+ "eslint-plugin-react-refresh": "^0.4.14",
86
+ "globals": "^15.12.0",
87
+ "postcss": "^8.4.49",
88
+ "tailwindcss": "^3.4.15",
89
+ "typescript": "^5.7.2",
90
+ "typescript-eslint": "^8.16.0",
91
+ "vite": "^5.4.11",
92
+ "vite-plugin-dts": "^4.5.4"
93
+ }
94
+ }