@patternfly/patternfly-doc-core 1.16.1 → 1.18.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 (210) hide show
  1. package/.astro/content-modules.mjs +48 -48
  2. package/dist/apiIndex.json +448 -448
  3. package/dist/docs/_worker.js/chunks/case_DEd0yJND.mjs +125 -0
  4. package/dist/docs/_worker.js/chunks/l_flex_item_Order_DmYJ8crs.mjs +8 -0
  5. package/dist/docs/_worker.js/chunks/t_global_breakpoint_xl_s9TZwYeB.mjs +128 -0
  6. package/dist/docs/_worker.js/chunks/tokens_BSL29Ypc.mjs +105060 -0
  7. package/dist/docs/_worker.js/index.js +37 -27
  8. package/dist/docs/_worker.js/manifest_FGQ-GLjs.mjs +100 -0
  9. package/dist/docs/_worker.js/pages/api/_version_/_section_/_page_/props.astro.mjs +49 -0
  10. package/dist/docs/_worker.js/pages/api/_version_/_section_/names.astro.mjs +36 -0
  11. package/dist/docs/_worker.js/pages/api/_version_/tokens/_category_.astro.mjs +54 -0
  12. package/dist/docs/_worker.js/pages/api/_version_/tokens/all.astro.mjs +41 -0
  13. package/dist/docs/_worker.js/pages/api/_version_/tokens.astro.mjs +39 -0
  14. package/dist/docs/_worker.js/pages/api/openapi.json.astro.mjs +401 -0
  15. package/dist/docs/_worker.js/pages/api.astro.mjs +70 -0
  16. package/dist/docs/apiIndex.json +448 -448
  17. package/dist/docs/components/accordion/react/index.html +10 -10
  18. package/dist/docs/components/action-list/html/index.html +11 -11
  19. package/dist/docs/components/action-list/index.html +9 -9
  20. package/dist/docs/components/action-list/react/index.html +9 -9
  21. package/dist/docs/components/alert/html/index.html +31 -31
  22. package/dist/docs/components/alert/index.html +83 -83
  23. package/dist/docs/components/alert/react/index.html +80 -80
  24. package/dist/docs/components/avatar/react/index.html +5 -5
  25. package/dist/docs/components/back-to-top/html/index.html +9 -9
  26. package/dist/docs/components/back-to-top/index.html +8 -8
  27. package/dist/docs/components/back-to-top/react/index.html +5 -5
  28. package/dist/docs/components/backdrop/html/index.html +11 -11
  29. package/dist/docs/components/backdrop/index.html +6 -6
  30. package/dist/docs/components/badge/react/index.html +8 -8
  31. package/dist/docs/components/banner/react/index.html +11 -11
  32. package/dist/docs/components/brand/html/index.html +13 -13
  33. package/dist/docs/components/brand/index.html +9 -9
  34. package/dist/docs/components/breadcrumb/html/index.html +18 -18
  35. package/dist/docs/components/breadcrumb/index.html +9 -9
  36. package/dist/docs/components/button/html-demos/index.html +8 -8
  37. package/dist/docs/components/calendar-month/react/index.html +9 -9
  38. package/dist/docs/components/card/html/index.html +40 -40
  39. package/dist/docs/components/card/html-demos/index.html +25 -25
  40. package/dist/docs/components/card/index.html +55 -55
  41. package/dist/docs/components/card/react/index.html +52 -52
  42. package/dist/docs/components/checkbox/html/index.html +21 -21
  43. package/dist/docs/components/checkbox/index.html +16 -16
  44. package/dist/docs/components/checkbox/react/index.html +16 -16
  45. package/dist/docs/components/data-list/html/index.html +41 -41
  46. package/dist/docs/components/data-list/index.html +24 -24
  47. package/dist/docs/components/date-picker/html/index.html +14 -14
  48. package/dist/docs/components/date-picker/index.html +17 -17
  49. package/dist/docs/components/description-list/html/index.html +44 -44
  50. package/dist/docs/components/description-list/index.html +39 -39
  51. package/dist/docs/components/description-list/react/index.html +39 -39
  52. package/dist/docs/components/divider/html/index.html +21 -21
  53. package/dist/docs/components/divider/index.html +14 -14
  54. package/dist/docs/components/divider/react/index.html +11 -11
  55. package/dist/docs/components/drawer/html/index.html +30 -30
  56. package/dist/docs/components/drawer/html-demos/index.html +16 -16
  57. package/dist/docs/components/drawer/index.html +28 -28
  58. package/dist/docs/components/drawer/react/index.html +28 -28
  59. package/dist/docs/components/dropdown/index.html +17 -17
  60. package/dist/docs/components/dropdown/react/index.html +17 -17
  61. package/dist/docs/components/dual-list-selector/html/index.html +16 -16
  62. package/dist/docs/components/dual-list-selector/index.html +20 -20
  63. package/dist/docs/components/dual-list-selector/react-deprecated/index.html +28 -28
  64. package/dist/docs/components/form/html-demos/index.html +9 -9
  65. package/dist/docs/components/inline-edit/html/index.html +29 -29
  66. package/dist/docs/components/inline-edit/index.html +29 -29
  67. package/dist/docs/components/input-group/html/index.html +12 -12
  68. package/dist/docs/components/input-group/index.html +12 -12
  69. package/dist/docs/components/input-group/react/index.html +12 -12
  70. package/dist/docs/components/jump-links/html-demos/index.html +13 -13
  71. package/dist/docs/components/jump-links/react/index.html +12 -12
  72. package/dist/docs/components/label/html/index.html +41 -41
  73. package/dist/docs/components/label/index.html +25 -25
  74. package/dist/docs/components/list/html/index.html +16 -16
  75. package/dist/docs/components/list/index.html +12 -12
  76. package/dist/docs/components/login-page/html/index.html +17 -17
  77. package/dist/docs/components/login-page/index.html +13 -13
  78. package/dist/docs/components/login-page/react/index.html +13 -13
  79. package/dist/docs/components/masthead/html-demos/index.html +23 -23
  80. package/dist/docs/components/masthead/react/index.html +18 -18
  81. package/dist/docs/components/menu/react/index.html +68 -68
  82. package/dist/docs/components/menu-toggle/react/index.html +66 -66
  83. package/dist/docs/components/modal/html-demos/index.html +16 -16
  84. package/dist/docs/components/modal/react-deprecated/index.html +41 -41
  85. package/dist/docs/components/navigation/html/index.html +29 -29
  86. package/dist/docs/components/navigation/index.html +21 -21
  87. package/dist/docs/components/notification-drawer/html/index.html +9 -9
  88. package/dist/docs/components/notification-drawer/index.html +8 -8
  89. package/dist/docs/components/number-input/html/index.html +15 -15
  90. package/dist/docs/components/number-input/index.html +14 -14
  91. package/dist/docs/components/overflow-menu/html/index.html +21 -21
  92. package/dist/docs/components/overflow-menu/index.html +12 -12
  93. package/dist/docs/components/page/html/index.html +18 -18
  94. package/dist/docs/components/page/index.html +50 -50
  95. package/dist/docs/components/pagination/html/index.html +20 -20
  96. package/dist/docs/components/pagination/index.html +17 -17
  97. package/dist/docs/components/panel/html/index.html +17 -17
  98. package/dist/docs/components/panel/index.html +25 -25
  99. package/dist/docs/components/password-strength/html-demos/index.html +10 -10
  100. package/dist/docs/components/password-strength/index.html +10 -10
  101. package/dist/docs/components/popover/html/index.html +47 -47
  102. package/dist/docs/components/popover/index.html +23 -23
  103. package/dist/docs/components/progress/html/index.html +28 -28
  104. package/dist/docs/components/progress/index.html +20 -20
  105. package/dist/docs/components/progress-stepper/html/index.html +24 -24
  106. package/dist/docs/components/progress-stepper/index.html +13 -13
  107. package/dist/docs/components/radio/html/index.html +20 -20
  108. package/dist/docs/components/radio/index.html +15 -15
  109. package/dist/docs/components/select/index.html +62 -62
  110. package/dist/docs/components/select/react/index.html +62 -62
  111. package/dist/docs/components/sidebar/html/index.html +21 -21
  112. package/dist/docs/components/sidebar/index.html +17 -17
  113. package/dist/docs/components/sidebar/react/index.html +17 -17
  114. package/dist/docs/components/simple-list/html/index.html +11 -11
  115. package/dist/docs/components/simple-list/index.html +9 -9
  116. package/dist/docs/components/simple-list/react/index.html +9 -9
  117. package/dist/docs/components/skeleton/html/index.html +13 -13
  118. package/dist/docs/components/skeleton/html-demos/index.html +6 -6
  119. package/dist/docs/components/skeleton/index.html +10 -10
  120. package/dist/docs/components/skeleton/react/index.html +10 -10
  121. package/dist/docs/components/skip-to-content/html/index.html +13 -13
  122. package/dist/docs/components/skip-to-content/index.html +6 -6
  123. package/dist/docs/components/slider/html/index.html +14 -14
  124. package/dist/docs/components/slider/index.html +22 -22
  125. package/dist/docs/components/spinner/html/index.html +16 -16
  126. package/dist/docs/components/spinner/index.html +9 -9
  127. package/dist/docs/components/switch/html/index.html +14 -14
  128. package/dist/docs/components/switch/index.html +9 -9
  129. package/dist/docs/components/switch/react/index.html +9 -9
  130. package/dist/docs/components/table/html/index.html +132 -132
  131. package/dist/docs/components/table/html-demos/index.html +33 -33
  132. package/dist/docs/components/table/index.html +132 -132
  133. package/dist/docs/components/tabs/html/index.html +64 -64
  134. package/dist/docs/components/tabs/index.html +74 -74
  135. package/dist/docs/components/tabs/react/index.html +77 -77
  136. package/dist/docs/components/text-area/index.html +12 -12
  137. package/dist/docs/components/text-area/react/index.html +12 -12
  138. package/dist/docs/components/text-input/index.html +13 -13
  139. package/dist/docs/components/text-input/react/index.html +13 -13
  140. package/dist/docs/components/text-input-group/html/index.html +24 -24
  141. package/dist/docs/components/text-input-group/index.html +13 -13
  142. package/dist/docs/components/tile/html-deprecated/index.html +14 -14
  143. package/dist/docs/components/tile/index.html +26 -26
  144. package/dist/docs/components/tile/react-deprecated/index.html +26 -26
  145. package/dist/docs/components/timestamp/html/index.html +5 -5
  146. package/dist/docs/components/timestamp/index.html +18 -18
  147. package/dist/docs/components/title/html/index.html +13 -13
  148. package/dist/docs/components/title/index.html +7 -7
  149. package/dist/docs/components/toggle-group/html/index.html +12 -12
  150. package/dist/docs/components/toggle-group/index.html +21 -21
  151. package/dist/docs/components/toolbar/html/index.html +52 -52
  152. package/dist/docs/components/toolbar/index.html +39 -39
  153. package/dist/docs/components/tooltip/html/index.html +14 -14
  154. package/dist/docs/components/tooltip/index.html +9 -9
  155. package/dist/docs/components/tree-view/html/index.html +18 -18
  156. package/dist/docs/components/tree-view/index.html +20 -20
  157. package/dist/docs/components/truncate/html/index.html +10 -10
  158. package/dist/docs/components/truncate/index.html +10 -10
  159. package/dist/docs/components/wizard/html/index.html +29 -29
  160. package/dist/docs/components/wizard/html-demos/index.html +19 -19
  161. package/dist/docs/components/wizard/index.html +32 -32
  162. package/dist/docs/components/wizard/react-deprecated/index.html +22 -22
  163. package/dist/docs/layouts/bullseye/html/index.html +11 -11
  164. package/dist/docs/layouts/bullseye/index.html +11 -11
  165. package/dist/docs/layouts/flex/html/index.html +90 -90
  166. package/dist/docs/layouts/flex/index.html +90 -90
  167. package/dist/docs/layouts/gallery/html/index.html +17 -17
  168. package/dist/docs/layouts/gallery/index.html +17 -17
  169. package/dist/docs/layouts/grid/html/index.html +22 -22
  170. package/dist/docs/layouts/grid/index.html +22 -22
  171. package/dist/docs/layouts/level/html/index.html +10 -10
  172. package/dist/docs/layouts/level/index.html +10 -10
  173. package/dist/docs/layouts/split/html/index.html +13 -13
  174. package/dist/docs/layouts/split/index.html +13 -13
  175. package/dist/docs/layouts/stack/html/index.html +12 -12
  176. package/dist/docs/layouts/stack/index.html +12 -12
  177. package/dist/docs/patterns/primary-detail/html-demos/index.html +17 -17
  178. package/dist/docs/patterns/primary-detail/index.html +17 -17
  179. package/dist/docs/utility-classes/accessibility/html/index.html +11 -11
  180. package/dist/docs/utility-classes/accessibility/index.html +11 -11
  181. package/dist/docs/utility-classes/alignment/html/index.html +10 -10
  182. package/dist/docs/utility-classes/alignment/index.html +10 -10
  183. package/dist/docs/utility-classes/background-color/html/index.html +12 -12
  184. package/dist/docs/utility-classes/background-color/index.html +12 -12
  185. package/dist/docs/utility-classes/box-shadow/html/index.html +9 -9
  186. package/dist/docs/utility-classes/box-shadow/index.html +9 -9
  187. package/dist/docs/utility-classes/display/html/index.html +15 -15
  188. package/dist/docs/utility-classes/display/index.html +15 -15
  189. package/dist/docs/utility-classes/flex/html/index.html +20 -20
  190. package/dist/docs/utility-classes/flex/index.html +20 -20
  191. package/dist/docs/utility-classes/float/html/index.html +10 -10
  192. package/dist/docs/utility-classes/float/index.html +10 -10
  193. package/dist/docs/utility-classes/sizing/html/index.html +31 -31
  194. package/dist/docs/utility-classes/sizing/index.html +31 -31
  195. package/dist/docs/utility-classes/spacing/html/index.html +15 -15
  196. package/dist/docs/utility-classes/spacing/index.html +15 -15
  197. package/dist/docs/utility-classes/text/html/index.html +21 -21
  198. package/dist/docs/utility-classes/text/index.html +21 -21
  199. package/package.json +1 -1
  200. package/src/pages/api/[version]/[section]/[page]/props.ts +49 -0
  201. package/src/pages/api/[version]/[section]/names.ts +32 -0
  202. package/src/pages/api/[version]/tokens/[category].ts +56 -0
  203. package/src/pages/api/[version]/tokens/all.ts +41 -0
  204. package/src/pages/api/[version]/tokens.ts +32 -0
  205. package/src/pages/api/index.ts +70 -0
  206. package/src/pages/api/openapi.json.ts +413 -6
  207. package/src/utils/tokens.ts +123 -0
  208. package/dist/docs/_worker.js/manifest_D3UQg5C2.mjs +0 -100
  209. /package/dist/docs/_worker.js/chunks/{_astro_data-layer-content_A2tQyjTY.mjs → _astro_data-layer-content_CyRgJrZy.mjs} +0 -0
  210. /package/dist/docs/_worker.js/chunks/{content-modules_BcmOmccw.mjs → content-modules_C8p165SU.mjs} +0 -0
@@ -98,6 +98,36 @@ export const GET: APIRoute = async () =>
98
98
  example: ['alert', 'button', 'card'],
99
99
  },
100
100
  },
101
+ {
102
+ path: '/api/{version}/{section}/names',
103
+ method: 'GET',
104
+ description: 'Get component names that have props data',
105
+ parameters: [
106
+ {
107
+ name: 'version',
108
+ in: 'path',
109
+ required: true,
110
+ type: 'string',
111
+ example: 'v6',
112
+ },
113
+ {
114
+ name: 'section',
115
+ in: 'path',
116
+ required: true,
117
+ type: 'string',
118
+ example: 'components',
119
+ }
120
+ ],
121
+ returns: {
122
+ type: 'array',
123
+ items: 'string',
124
+ description: 'All component names with props data',
125
+ example: [
126
+ 'Alert',
127
+ 'AlertGroup'
128
+ ],
129
+ },
130
+ },
101
131
  {
102
132
  path: '/api/{version}/{section}/{page}',
103
133
  method: 'GET',
@@ -132,6 +162,46 @@ export const GET: APIRoute = async () =>
132
162
  example: ['react', 'react-demos', 'html'],
133
163
  },
134
164
  },
165
+ {
166
+ path: '/api/{version}/{section}/{page}/props',
167
+ method: 'GET',
168
+ description: 'Get props for a specific component',
169
+ parameters: [
170
+ {
171
+ name: 'version',
172
+ in: 'path',
173
+ required: true,
174
+ type: 'string',
175
+ example: 'v6',
176
+ },
177
+ {
178
+ name: 'section',
179
+ in: 'path',
180
+ required: true,
181
+ type: 'string',
182
+ example: 'components',
183
+ },
184
+ {
185
+ name: 'page',
186
+ in: 'path',
187
+ required: true,
188
+ type: 'string',
189
+ example: 'alert',
190
+ },
191
+ ],
192
+ returns: {
193
+ type: 'array',
194
+ items: 'object',
195
+ description: 'Props for a specific component',
196
+ example: [
197
+ {
198
+ name: 'actionClose',
199
+ type: 'React.ReactNode',
200
+ description: 'Close button; use the alert action close button component.',
201
+ },
202
+ ],
203
+ },
204
+ },
135
205
  {
136
206
  path: '/api/{version}/{section}/{page}/{tab}',
137
207
  method: 'GET',
@@ -23,7 +23,7 @@ export const GET: APIRoute = async ({ url }) => {
23
23
  const details = error instanceof Error ? error.message : String(error)
24
24
  return createJsonResponse(
25
25
  { error: 'Failed to load API index', details },
26
- 500
26
+ 500,
27
27
  )
28
28
  }
29
29
 
@@ -103,7 +103,8 @@ export const GET: APIRoute = async ({ url }) => {
103
103
  '/openapi.json': {
104
104
  get: {
105
105
  summary: 'Get OpenAPI specification',
106
- description: 'Returns the complete OpenAPI 3.0 specification for this API',
106
+ description:
107
+ 'Returns the complete OpenAPI 3.0 specification for this API',
107
108
  operationId: 'getOpenApiSpec',
108
109
  responses: {
109
110
  '200': {
@@ -234,6 +235,70 @@ export const GET: APIRoute = async ({ url }) => {
234
235
  },
235
236
  },
236
237
  },
238
+ '/{version}/{section}/names': {
239
+ get: {
240
+ summary: 'Get component names',
241
+ description: 'Returns the component names that have props data',
242
+ operationId: 'getNames',
243
+ parameters: [
244
+ {
245
+ name: 'version',
246
+ in: 'path',
247
+ required: true,
248
+ description: 'Documentation version',
249
+ schema: {
250
+ type: 'string',
251
+ enum: versions,
252
+ },
253
+ example: 'v6',
254
+ },
255
+ {
256
+ name: 'section',
257
+ in: 'path',
258
+ required: true,
259
+ description: 'Documentation section',
260
+ schema: {
261
+ type: 'string',
262
+ },
263
+ example: 'components',
264
+ },
265
+ ],
266
+ responses: {
267
+ '200': {
268
+ description: 'Component names with props data',
269
+ content: {
270
+ 'application/json': {
271
+ schema: {
272
+ type: 'array',
273
+ items: {
274
+ type: 'string'
275
+ },
276
+ },
277
+ example: [
278
+ 'Alert',
279
+ 'AlertGroup'
280
+ ],
281
+ },
282
+ },
283
+ },
284
+ '404': {
285
+ description: 'Props not found',
286
+ content: {
287
+ 'application/json': {
288
+ schema: {
289
+ type: 'object',
290
+ properties: {
291
+ error: {
292
+ type: 'string',
293
+ },
294
+ },
295
+ },
296
+ },
297
+ },
298
+ },
299
+ },
300
+ },
301
+ },
237
302
  '/{version}/{section}/{page}': {
238
303
  get: {
239
304
  summary: 'List tabs for a page',
@@ -306,6 +371,102 @@ export const GET: APIRoute = async ({ url }) => {
306
371
  },
307
372
  },
308
373
  },
374
+ '/{version}/{section}/{page}/props': {
375
+ get: {
376
+ summary: 'Get component props',
377
+ description: 'Returns the props for the specified component',
378
+ operationId: 'getProps',
379
+ parameters: [
380
+ {
381
+ name: 'version',
382
+ in: 'path',
383
+ required: true,
384
+ description: 'Documentation version',
385
+ schema: {
386
+ type: 'string',
387
+ enum: versions,
388
+ },
389
+ example: 'v6',
390
+ },
391
+ {
392
+ name: 'section',
393
+ in: 'path',
394
+ required: true,
395
+ description: 'Documentation section',
396
+ schema: {
397
+ type: 'string',
398
+ },
399
+ example: 'components',
400
+ },
401
+ {
402
+ name: 'page',
403
+ in: 'path',
404
+ required: true,
405
+ description: 'Page ID (kebab-cased)',
406
+ schema: {
407
+ type: 'string',
408
+ },
409
+ example: 'alert',
410
+ },
411
+ ],
412
+ responses: {
413
+ '200': {
414
+ description: 'Props for the specified component',
415
+ content: {
416
+ 'application/json': {
417
+ schema: {
418
+ type: 'array',
419
+ items: {
420
+ type: 'object',
421
+ properties: {
422
+ name: { type: 'string' },
423
+ type: { type: 'string' },
424
+ description: { type: 'string' },
425
+ defaultValue: { type: 'string' },
426
+ },
427
+ },
428
+ },
429
+ example: [
430
+ {
431
+ name: 'actionClose',
432
+ type: 'React.ReactNode',
433
+ description:
434
+ 'Close button; use the alert action close button component.',
435
+ },
436
+ {
437
+ name: 'actionLinks',
438
+ type: 'React.ReactNode',
439
+ description:
440
+ 'Action links; use a single alert action link component or multiple wrapped in an array\nor React fragment.',
441
+ },
442
+ {
443
+ name: 'children',
444
+ type: 'React.ReactNode',
445
+ description: 'Content rendered inside the alert.',
446
+ defaultValue: "''",
447
+ },
448
+ ],
449
+ },
450
+ },
451
+ },
452
+ '404': {
453
+ description: 'Props not found',
454
+ content: {
455
+ 'application/json': {
456
+ schema: {
457
+ type: 'object',
458
+ properties: {
459
+ error: {
460
+ type: 'string',
461
+ },
462
+ },
463
+ },
464
+ },
465
+ },
466
+ },
467
+ },
468
+ },
469
+ },
309
470
  '/{version}/{section}/{page}/{tab}': {
310
471
  get: {
311
472
  summary: 'Validate and redirect to text endpoint',
@@ -357,7 +518,8 @@ export const GET: APIRoute = async ({ url }) => {
357
518
  ],
358
519
  responses: {
359
520
  '302': {
360
- description: 'Redirects to /{version}/{section}/{page}/{tab}/text',
521
+ description:
522
+ 'Redirects to /{version}/{section}/{page}/{tab}/text',
361
523
  },
362
524
  '404': {
363
525
  description: 'Tab not found',
@@ -554,8 +716,7 @@ export const GET: APIRoute = async ({ url }) => {
554
716
  '/{version}/{section}/{page}/{tab}/examples/{example}': {
555
717
  get: {
556
718
  summary: 'Get example code',
557
- description:
558
- 'Returns the raw source code for a specific example',
719
+ description: 'Returns the raw source code for a specific example',
559
720
  operationId: 'getExampleCode',
560
721
  parameters: [
561
722
  {
@@ -619,7 +780,7 @@ export const GET: APIRoute = async ({ url }) => {
619
780
  type: 'string',
620
781
  },
621
782
  example:
622
- 'import React from \'react\';\nimport { Alert } from \'@patternfly/react-core\';\n\nexport const AlertBasic = () => <Alert title="Basic alert" />;',
783
+ "import React from 'react';\nimport { Alert } from '@patternfly/react-core';\n\nexport const AlertBasic = () => <Alert title=\"Basic alert\" />;",
623
784
  },
624
785
  },
625
786
  },
@@ -641,6 +802,252 @@ export const GET: APIRoute = async ({ url }) => {
641
802
  },
642
803
  },
643
804
  },
805
+ '/{version}/tokens': {
806
+ get: {
807
+ summary: 'List token categories',
808
+ description:
809
+ 'Returns an alphabetically sorted array of available design token categories from @patternfly/react-tokens. Categories are determined by token name prefixes (e.g., c_, t_, chart_). Optimized for MCP/LLM consumption.',
810
+ operationId: 'getTokenCategories',
811
+ parameters: [
812
+ {
813
+ name: 'version',
814
+ in: 'path',
815
+ required: true,
816
+ description: 'Documentation version',
817
+ schema: {
818
+ type: 'string',
819
+ enum: versions,
820
+ },
821
+ example: 'v6',
822
+ },
823
+ ],
824
+ responses: {
825
+ '200': {
826
+ description: 'List of token categories',
827
+ content: {
828
+ 'application/json': {
829
+ schema: {
830
+ type: 'array',
831
+ items: {
832
+ type: 'string',
833
+ },
834
+ },
835
+ example: ['c', 'chart', 'global', 'hidden', 'l', 't'],
836
+ },
837
+ },
838
+ },
839
+ '404': {
840
+ description: 'Version not found',
841
+ content: {
842
+ 'application/json': {
843
+ schema: {
844
+ type: 'object',
845
+ properties: {
846
+ error: {
847
+ type: 'string',
848
+ },
849
+ },
850
+ },
851
+ },
852
+ },
853
+ },
854
+ },
855
+ },
856
+ },
857
+ '/{version}/tokens/{category}': {
858
+ get: {
859
+ summary: 'Get tokens for a category',
860
+ description:
861
+ 'Returns design tokens for a specific category with optional filtering. Each token includes name (CSS variable name), value (resolved value), and var (CSS var() reference). Use the filter query parameter for case-insensitive substring matching to minimize response size.',
862
+ operationId: 'getTokensByCategory',
863
+ parameters: [
864
+ {
865
+ name: 'version',
866
+ in: 'path',
867
+ required: true,
868
+ description: 'Documentation version',
869
+ schema: {
870
+ type: 'string',
871
+ enum: versions,
872
+ },
873
+ example: 'v6',
874
+ },
875
+ {
876
+ name: 'category',
877
+ in: 'path',
878
+ required: true,
879
+ description: 'Token category (e.g., c, t, chart)',
880
+ schema: {
881
+ type: 'string',
882
+ },
883
+ example: 'c',
884
+ },
885
+ {
886
+ name: 'filter',
887
+ in: 'query',
888
+ required: false,
889
+ description: 'Case-insensitive substring filter to match against token names',
890
+ schema: {
891
+ type: 'string',
892
+ },
893
+ example: 'alert',
894
+ },
895
+ ],
896
+ responses: {
897
+ '200': {
898
+ description: 'Array of tokens matching the criteria',
899
+ content: {
900
+ 'application/json': {
901
+ schema: {
902
+ type: 'array',
903
+ items: {
904
+ type: 'object',
905
+ properties: {
906
+ name: {
907
+ type: 'string',
908
+ description: 'CSS variable name',
909
+ },
910
+ value: {
911
+ type: 'string',
912
+ description: 'Resolved CSS value',
913
+ },
914
+ var: {
915
+ type: 'string',
916
+ description: 'CSS var() reference',
917
+ },
918
+ },
919
+ required: ['name', 'value', 'var'],
920
+ },
921
+ },
922
+ example: [
923
+ {
924
+ name: '--pf-v6-c-alert--Color',
925
+ value: '#000',
926
+ var: 'var(--pf-v6-c-alert--Color)',
927
+ },
928
+ ],
929
+ },
930
+ },
931
+ },
932
+ '404': {
933
+ description: 'Category not found',
934
+ content: {
935
+ 'application/json': {
936
+ schema: {
937
+ type: 'object',
938
+ properties: {
939
+ error: {
940
+ type: 'string',
941
+ },
942
+ validCategories: {
943
+ type: 'array',
944
+ items: {
945
+ type: 'string',
946
+ },
947
+ },
948
+ },
949
+ },
950
+ },
951
+ },
952
+ },
953
+ },
954
+ },
955
+ },
956
+ '/{version}/tokens/all': {
957
+ get: {
958
+ summary: 'Get all tokens grouped by category',
959
+ description:
960
+ 'Returns all design tokens organized by category with optional filtering. Use the filter query parameter to minimize response size for MCP/LLM consumption. Empty categories are excluded from filtered results.',
961
+ operationId: 'getAllTokens',
962
+ parameters: [
963
+ {
964
+ name: 'version',
965
+ in: 'path',
966
+ required: true,
967
+ description: 'Documentation version',
968
+ schema: {
969
+ type: 'string',
970
+ enum: versions,
971
+ },
972
+ example: 'v6',
973
+ },
974
+ {
975
+ name: 'filter',
976
+ in: 'query',
977
+ required: false,
978
+ description: 'Case-insensitive substring filter to match against token names across all categories',
979
+ schema: {
980
+ type: 'string',
981
+ },
982
+ example: 'color',
983
+ },
984
+ ],
985
+ responses: {
986
+ '200': {
987
+ description: 'Object with category keys and token arrays as values',
988
+ content: {
989
+ 'application/json': {
990
+ schema: {
991
+ type: 'object',
992
+ additionalProperties: {
993
+ type: 'array',
994
+ items: {
995
+ type: 'object',
996
+ properties: {
997
+ name: {
998
+ type: 'string',
999
+ description: 'CSS variable name',
1000
+ },
1001
+ value: {
1002
+ type: 'string',
1003
+ description: 'Resolved CSS value',
1004
+ },
1005
+ var: {
1006
+ type: 'string',
1007
+ description: 'CSS var() reference',
1008
+ },
1009
+ },
1010
+ required: ['name', 'value', 'var'],
1011
+ },
1012
+ },
1013
+ },
1014
+ example: {
1015
+ c: [
1016
+ {
1017
+ name: '--pf-v6-c-alert--Color',
1018
+ value: '#000',
1019
+ var: 'var(--pf-v6-c-alert--Color)',
1020
+ },
1021
+ ],
1022
+ t: [
1023
+ {
1024
+ name: '--pf-v6-t-global--Color',
1025
+ value: '#333',
1026
+ var: 'var(--pf-v6-t-global--Color)',
1027
+ },
1028
+ ],
1029
+ },
1030
+ },
1031
+ },
1032
+ },
1033
+ '404': {
1034
+ description: 'Version not found',
1035
+ content: {
1036
+ 'application/json': {
1037
+ schema: {
1038
+ type: 'object',
1039
+ properties: {
1040
+ error: {
1041
+ type: 'string',
1042
+ },
1043
+ },
1044
+ },
1045
+ },
1046
+ },
1047
+ },
1048
+ },
1049
+ },
1050
+ },
644
1051
  },
645
1052
  tags: [
646
1053
  {
@@ -0,0 +1,123 @@
1
+ import * as allTokens from '@patternfly/react-tokens'
2
+
3
+ export interface Token {
4
+ name: string
5
+ value: string
6
+ var: string
7
+ }
8
+
9
+ export interface TokensByCategory {
10
+ [category: string]: Token[]
11
+ }
12
+
13
+ let cachedTokens: Token[] | null = null
14
+ let cachedCategories: string[] | null = null
15
+ let cachedTokensByCategory: TokensByCategory | null = null
16
+
17
+ function getCategoryFromTokenName(tokenName: string): string {
18
+ const nameWithoutPfPrefix = tokenName.replace(/^--pf-/, '')
19
+ const parts = nameWithoutPfPrefix.split(/-+/)
20
+ if (/^v\d+/.test(parts[0])) {
21
+ return parts[1]
22
+ }
23
+
24
+ return parts[0]
25
+ }
26
+
27
+ export function getAllTokens(): Token[] {
28
+ if (cachedTokens) {
29
+ return cachedTokens
30
+ }
31
+
32
+ const tokens: Token[] = []
33
+
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ for (const [_exportName, tokenValue] of Object.entries(allTokens)) {
36
+ if (typeof tokenValue === 'object' && tokenValue !== null) {
37
+ const token = tokenValue as Token
38
+
39
+ if (token.name && token.value && token.var) {
40
+ tokens.push({
41
+ name: token.name,
42
+ value: token.value,
43
+ var: token.var,
44
+ })
45
+ }
46
+ }
47
+ }
48
+
49
+ cachedTokens = tokens
50
+ return tokens
51
+ }
52
+
53
+ export function getTokenCategories(): string[] {
54
+ if (cachedCategories) {
55
+ return cachedCategories
56
+ }
57
+
58
+ const tokens = getAllTokens()
59
+ const categorySet = new Set<string>()
60
+
61
+ for (const token of tokens) {
62
+ const category = getCategoryFromTokenName(token.name)
63
+ categorySet.add(category)
64
+ }
65
+
66
+ cachedCategories = Array.from(categorySet).sort()
67
+ return cachedCategories
68
+ }
69
+
70
+ export function getTokensByCategory(): TokensByCategory {
71
+ if (cachedTokensByCategory) {
72
+ return cachedTokensByCategory
73
+ }
74
+
75
+ const tokens = getAllTokens()
76
+ const byCategory: TokensByCategory = {}
77
+
78
+ for (const token of tokens) {
79
+ const category = getCategoryFromTokenName(token.name)
80
+ if (!byCategory[category]) {
81
+ byCategory[category] = []
82
+ }
83
+ byCategory[category].push(token)
84
+ }
85
+
86
+ cachedTokensByCategory = byCategory
87
+ return byCategory
88
+ }
89
+
90
+ export function getTokensForCategory(category: string): Token[] | undefined {
91
+ const byCategory = getTokensByCategory()
92
+ return byCategory[category]
93
+ }
94
+
95
+ export function filterTokens(tokens: Token[], filter: string): Token[] {
96
+ if (!filter) {
97
+ return tokens
98
+ }
99
+
100
+ const lowerFilter = filter.toLowerCase()
101
+ return tokens.filter((token) =>
102
+ token.name.toLowerCase().includes(lowerFilter),
103
+ )
104
+ }
105
+
106
+ export function filterTokensByCategory(
107
+ byCategory: TokensByCategory,
108
+ filter: string,
109
+ ): TokensByCategory {
110
+ if (!filter) {
111
+ return byCategory
112
+ }
113
+
114
+ const filtered: TokensByCategory = {}
115
+ for (const [category, tokens] of Object.entries(byCategory)) {
116
+ const filteredTokens = filterTokens(tokens, filter)
117
+ if (filteredTokens.length > 0) {
118
+ filtered[category] = filteredTokens
119
+ }
120
+ }
121
+
122
+ return filtered
123
+ }