@nuxt/ui 3.0.0-alpha.6 → 3.0.0-alpha.8

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 (257) hide show
  1. package/.nuxt/ui/accordion.ts +20 -0
  2. package/.nuxt/ui/alert.ts +242 -0
  3. package/.nuxt/ui/avatar-group.ts +40 -0
  4. package/.nuxt/ui/avatar.ts +42 -0
  5. package/.nuxt/ui/badge.ts +194 -0
  6. package/.nuxt/ui/breadcrumb.ts +45 -0
  7. package/.nuxt/ui/button-group.ts +16 -0
  8. package/.nuxt/ui/button.ts +344 -0
  9. package/.nuxt/ui/card.ts +8 -0
  10. package/.nuxt/ui/carousel.ts +41 -0
  11. package/.nuxt/ui/checkbox.ts +105 -0
  12. package/.nuxt/ui/chip.ts +67 -0
  13. package/.nuxt/ui/collapsible.ts +6 -0
  14. package/.nuxt/ui/command-palette.ts +40 -0
  15. package/.nuxt/ui/container.ts +3 -0
  16. package/.nuxt/ui/context-menu.ts +198 -0
  17. package/.nuxt/ui/drawer.ts +55 -0
  18. package/.nuxt/ui/dropdown-menu.ts +199 -0
  19. package/.nuxt/ui/form-field.ts +40 -0
  20. package/.nuxt/ui/form.ts +3 -0
  21. package/.nuxt/ui/index.ts +43 -0
  22. package/.nuxt/ui/input-menu.ts +411 -0
  23. package/.nuxt/ui/input.ts +263 -0
  24. package/.nuxt/ui/kbd.ts +19 -0
  25. package/.nuxt/ui/link.ts +15 -0
  26. package/.nuxt/ui/modal.ts +28 -0
  27. package/.nuxt/ui/navigation-menu.ts +390 -0
  28. package/.nuxt/ui/pagination.ts +8 -0
  29. package/.nuxt/ui/popover.ts +6 -0
  30. package/.nuxt/ui/progress.ts +258 -0
  31. package/.nuxt/ui/radio-group.ts +112 -0
  32. package/.nuxt/ui/select-menu.ts +321 -0
  33. package/.nuxt/ui/select.ts +314 -0
  34. package/.nuxt/ui/separator.ts +143 -0
  35. package/.nuxt/ui/skeleton.ts +3 -0
  36. package/.nuxt/ui/slideover.ts +63 -0
  37. package/.nuxt/ui/slider.ts +148 -0
  38. package/.nuxt/ui/switch.ts +113 -0
  39. package/.nuxt/ui/table.ts +128 -0
  40. package/.nuxt/ui/tabs.ts +227 -0
  41. package/.nuxt/ui/textarea.ts +263 -0
  42. package/.nuxt/ui/toast.ts +66 -0
  43. package/.nuxt/ui/toaster.ts +75 -0
  44. package/.nuxt/ui/tooltip.ts +9 -0
  45. package/cli/templates.mjs +1 -1
  46. package/dist/chunks/component-meta.cjs +73264 -0
  47. package/dist/chunks/component-meta.mjs +73262 -0
  48. package/dist/client/devtools/200.html +1 -0
  49. package/dist/client/devtools/404.html +1 -0
  50. package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
  51. package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
  52. package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
  53. package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
  54. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
  55. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
  56. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
  57. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
  58. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
  59. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
  60. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
  61. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
  62. package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
  63. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
  64. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
  65. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
  66. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
  67. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
  68. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
  69. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
  70. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
  71. package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
  72. package/dist/client/devtools/_nuxt/Bj9hdafK.js +1 -0
  73. package/dist/client/devtools/_nuxt/DM3_wAgz.js +62 -0
  74. package/dist/client/devtools/_nuxt/builds/latest.json +1 -0
  75. package/dist/client/devtools/_nuxt/builds/meta/e6b425f7-b919-4014-915b-0ea07c316790.json +1 -0
  76. package/dist/client/devtools/_nuxt/entry.DaJP-ZMB.css +24 -0
  77. package/dist/client/devtools/_nuxt/error-404.B0Nmv3fV.css +1 -0
  78. package/dist/client/devtools/_nuxt/error-500.C8fgTxVz.css +1 -0
  79. package/dist/client/devtools/_nuxt/hKiujHsR.js +1 -0
  80. package/dist/client/devtools/favicon.svg +1 -0
  81. package/dist/client/devtools/index.html +1 -0
  82. package/dist/devtools/runtime/DevtoolsRenderer.vue +53 -0
  83. package/dist/devtools/runtime/examples/AvatarGroupExample.vue +7 -0
  84. package/dist/devtools/runtime/examples/ButtonGroupExample.vue +8 -0
  85. package/dist/devtools/runtime/examples/CardExample.vue +13 -0
  86. package/dist/devtools/runtime/examples/CarouselExample.vue +13 -0
  87. package/dist/devtools/runtime/examples/ChipExample.vue +5 -0
  88. package/dist/devtools/runtime/examples/CollapsibleExample.vue +8 -0
  89. package/dist/devtools/runtime/examples/CommandPaletteExample.vue +29 -0
  90. package/dist/devtools/runtime/examples/ContainerExample.vue +5 -0
  91. package/dist/devtools/runtime/examples/ContextMenuExample.vue +5 -0
  92. package/dist/devtools/runtime/examples/DrawerExample.vue +8 -0
  93. package/dist/devtools/runtime/examples/DropdownMenuExample.vue +5 -0
  94. package/dist/devtools/runtime/examples/FormExample.vue +30 -0
  95. package/dist/devtools/runtime/examples/FormFieldExample.vue +5 -0
  96. package/dist/devtools/runtime/examples/LinkExample.vue +5 -0
  97. package/dist/devtools/runtime/examples/ModalExample.vue +8 -0
  98. package/dist/devtools/runtime/examples/PopoverExample.vue +8 -0
  99. package/dist/devtools/runtime/examples/SkeletonExample.vue +3 -0
  100. package/dist/devtools/runtime/examples/SlideoverExample.vue +8 -0
  101. package/dist/devtools/runtime/examples/ToasterExample.vue +11 -0
  102. package/dist/devtools/runtime/examples/TooltipExample.vue +5 -0
  103. package/dist/module.cjs +222 -4
  104. package/dist/module.d.cts +54 -0
  105. package/dist/module.d.mts +16 -6
  106. package/dist/module.d.ts +16 -6
  107. package/dist/module.json +1 -1
  108. package/dist/module.mjs +157 -2629
  109. package/dist/runtime/components/Accordion.vue +45 -6
  110. package/dist/runtime/components/Alert.vue +4 -0
  111. package/dist/runtime/components/App.vue +8 -0
  112. package/dist/runtime/components/Avatar.vue +23 -5
  113. package/dist/runtime/components/AvatarGroup.vue +3 -0
  114. package/dist/runtime/components/Badge.vue +33 -3
  115. package/dist/runtime/components/Breadcrumb.vue +39 -7
  116. package/dist/runtime/components/Button.vue +10 -3
  117. package/dist/runtime/components/ButtonGroup.vue +4 -1
  118. package/dist/runtime/components/Card.vue +3 -0
  119. package/dist/runtime/components/Carousel.vue +13 -8
  120. package/dist/runtime/components/Checkbox.vue +7 -6
  121. package/dist/runtime/components/Chip.vue +9 -2
  122. package/dist/runtime/components/Collapsible.vue +3 -0
  123. package/dist/runtime/components/CommandPalette.vue +28 -17
  124. package/dist/runtime/components/Container.vue +3 -0
  125. package/dist/runtime/components/ContextMenu.vue +95 -10
  126. package/dist/runtime/components/ContextMenuContent.vue +41 -13
  127. package/dist/runtime/components/Drawer.vue +3 -0
  128. package/dist/runtime/components/DropdownMenu.vue +83 -10
  129. package/dist/runtime/components/DropdownMenuContent.vue +43 -13
  130. package/dist/runtime/components/Form.vue +6 -1
  131. package/dist/runtime/components/FormField.vue +3 -0
  132. package/dist/runtime/components/Input.vue +7 -4
  133. package/dist/runtime/components/InputMenu.vue +61 -34
  134. package/dist/runtime/components/Kbd.vue +2 -0
  135. package/dist/runtime/components/Link.vue +50 -1
  136. package/dist/runtime/components/LinkBase.vue +4 -2
  137. package/dist/runtime/components/Modal.vue +3 -0
  138. package/dist/runtime/components/NavigationMenu.vue +159 -75
  139. package/dist/runtime/components/Pagination.vue +5 -1
  140. package/dist/runtime/components/Popover.vue +3 -0
  141. package/dist/runtime/components/Progress.vue +1 -1
  142. package/dist/runtime/components/RadioGroup.vue +26 -4
  143. package/dist/runtime/components/Select.vue +44 -21
  144. package/dist/runtime/components/SelectMenu.vue +67 -43
  145. package/dist/runtime/components/Separator.vue +1 -1
  146. package/dist/runtime/components/Skeleton.vue +3 -0
  147. package/dist/runtime/components/Slideover.vue +3 -0
  148. package/dist/runtime/components/Slider.vue +1 -1
  149. package/dist/runtime/components/Switch.vue +5 -1
  150. package/dist/runtime/components/Table.vue +241 -0
  151. package/dist/runtime/components/Tabs.vue +35 -8
  152. package/dist/runtime/components/Toast.vue +4 -0
  153. package/dist/runtime/components/Toaster.vue +8 -1
  154. package/dist/runtime/components/Tooltip.vue +3 -0
  155. package/dist/runtime/composables/defineShortcuts.js +1 -7
  156. package/dist/runtime/composables/extendDevtoolsMeta.d.ts +7 -0
  157. package/dist/runtime/composables/extendDevtoolsMeta.js +2 -0
  158. package/dist/runtime/composables/useComponentIcons.d.ts +3 -0
  159. package/dist/runtime/composables/useKbd.d.ts +10 -3
  160. package/dist/runtime/composables/useKbd.js +14 -8
  161. package/dist/runtime/composables/useModal.d.ts +1 -1
  162. package/dist/runtime/composables/useSlideover.d.ts +1 -1
  163. package/dist/runtime/index.css +1 -1
  164. package/dist/runtime/keyframes.css +1 -0
  165. package/dist/runtime/types/form.d.ts +2 -1
  166. package/dist/runtime/types/index.d.ts +1 -0
  167. package/dist/runtime/types/index.js +1 -0
  168. package/dist/runtime/types/utils.d.ts +7 -0
  169. package/dist/runtime/utils/form.d.ts +3 -0
  170. package/dist/runtime/utils/form.js +14 -0
  171. package/dist/runtime/utils/index.d.ts +1 -0
  172. package/dist/runtime/utils/index.js +3 -0
  173. package/dist/runtime/utils/link.d.ts +1 -1
  174. package/dist/runtime/vue/components/Icon.vue +15 -0
  175. package/dist/runtime/vue/components/Link.vue +195 -0
  176. package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
  177. package/dist/runtime/vue/plugins/color-mode.js +6 -0
  178. package/dist/runtime/vue/plugins/head.d.ts +4 -0
  179. package/dist/runtime/vue/plugins/head.js +6 -0
  180. package/dist/runtime/vue/stubs.d.ts +15 -0
  181. package/dist/runtime/vue/stubs.js +27 -0
  182. package/dist/shared/ui.BU7wzH0D.cjs +2872 -0
  183. package/dist/shared/ui.BufKhDiD.mjs +2865 -0
  184. package/dist/unplugin.cjs +192 -0
  185. package/dist/unplugin.d.cts +47 -0
  186. package/dist/unplugin.d.mts +47 -0
  187. package/dist/unplugin.d.ts +47 -0
  188. package/dist/unplugin.mjs +181 -0
  189. package/dist/vite.cjs +22 -0
  190. package/dist/vite.d.cts +13 -0
  191. package/dist/vite.d.mts +13 -0
  192. package/dist/vite.d.ts +13 -0
  193. package/dist/vite.mjs +20 -0
  194. package/package.json +73 -32
  195. package/vue-plugin.d.ts +5 -0
  196. package/cli/node_modules/.ignored/citty/LICENSE +0 -36
  197. package/cli/node_modules/.ignored/citty/README.md +0 -134
  198. package/cli/node_modules/.ignored/citty/dist/index.cjs +0 -475
  199. package/cli/node_modules/.ignored/citty/dist/index.d.cts +0 -80
  200. package/cli/node_modules/.ignored/citty/dist/index.d.mts +0 -80
  201. package/cli/node_modules/.ignored/citty/dist/index.d.ts +0 -80
  202. package/cli/node_modules/.ignored/citty/dist/index.mjs +0 -463
  203. package/cli/node_modules/.ignored/citty/package.json +0 -49
  204. package/cli/node_modules/.ignored/consola/LICENSE +0 -47
  205. package/cli/node_modules/.ignored/consola/README.md +0 -318
  206. package/cli/node_modules/.ignored/consola/core.d.ts +0 -1
  207. package/cli/node_modules/.ignored/consola/dist/basic.cjs +0 -32
  208. package/cli/node_modules/.ignored/consola/dist/basic.d.ts +0 -9
  209. package/cli/node_modules/.ignored/consola/dist/basic.mjs +0 -24
  210. package/cli/node_modules/.ignored/consola/dist/browser.cjs +0 -80
  211. package/cli/node_modules/.ignored/consola/dist/browser.d.ts +0 -7
  212. package/cli/node_modules/.ignored/consola/dist/browser.mjs +0 -72
  213. package/cli/node_modules/.ignored/consola/dist/chunks/prompt.cjs +0 -436
  214. package/cli/node_modules/.ignored/consola/dist/chunks/prompt.mjs +0 -429
  215. package/cli/node_modules/.ignored/consola/dist/core.cjs +0 -415
  216. package/cli/node_modules/.ignored/consola/dist/core.d.ts +0 -124
  217. package/cli/node_modules/.ignored/consola/dist/core.mjs +0 -410
  218. package/cli/node_modules/.ignored/consola/dist/index.cjs +0 -21
  219. package/cli/node_modules/.ignored/consola/dist/index.d.ts +0 -9
  220. package/cli/node_modules/.ignored/consola/dist/index.mjs +0 -8
  221. package/cli/node_modules/.ignored/consola/dist/shared/consola.06ad8a64.mjs +0 -62
  222. package/cli/node_modules/.ignored/consola/dist/shared/consola.36c0034f.mjs +0 -636
  223. package/cli/node_modules/.ignored/consola/dist/shared/consola.4bbae468.cjs +0 -645
  224. package/cli/node_modules/.ignored/consola/dist/shared/consola.deac7d5a.cjs +0 -65
  225. package/cli/node_modules/.ignored/consola/dist/utils.cjs +0 -308
  226. package/cli/node_modules/.ignored/consola/dist/utils.d.ts +0 -169
  227. package/cli/node_modules/.ignored/consola/dist/utils.mjs +0 -284
  228. package/cli/node_modules/.ignored/consola/lib/index.cjs +0 -9
  229. package/cli/node_modules/.ignored/consola/package.json +0 -101
  230. package/cli/node_modules/.ignored/consola/utils.d.ts +0 -1
  231. package/cli/node_modules/.ignored/pathe/LICENSE +0 -44
  232. package/cli/node_modules/.ignored/pathe/README.md +0 -69
  233. package/cli/node_modules/.ignored/pathe/dist/index.cjs +0 -23
  234. package/cli/node_modules/.ignored/pathe/dist/index.d.cts +0 -36
  235. package/cli/node_modules/.ignored/pathe/dist/index.d.mts +0 -36
  236. package/cli/node_modules/.ignored/pathe/dist/index.d.ts +0 -36
  237. package/cli/node_modules/.ignored/pathe/dist/index.mjs +0 -1
  238. package/cli/node_modules/.ignored/pathe/dist/shared/pathe.1f0a373c.cjs +0 -238
  239. package/cli/node_modules/.ignored/pathe/dist/shared/pathe.ff20891b.mjs +0 -221
  240. package/cli/node_modules/.ignored/pathe/dist/utils.cjs +0 -58
  241. package/cli/node_modules/.ignored/pathe/dist/utils.d.cts +0 -5
  242. package/cli/node_modules/.ignored/pathe/dist/utils.d.mts +0 -5
  243. package/cli/node_modules/.ignored/pathe/dist/utils.d.ts +0 -5
  244. package/cli/node_modules/.ignored/pathe/dist/utils.mjs +0 -54
  245. package/cli/node_modules/.ignored/pathe/package.json +0 -48
  246. package/cli/node_modules/.ignored/pathe/utils.d.ts +0 -1
  247. package/cli/node_modules/.ignored/scule/LICENSE +0 -21
  248. package/cli/node_modules/.ignored/scule/README.md +0 -149
  249. package/cli/node_modules/.ignored/scule/dist/index.cjs +0 -92
  250. package/cli/node_modules/.ignored/scule/dist/index.d.cts +0 -57
  251. package/cli/node_modules/.ignored/scule/dist/index.d.mts +0 -57
  252. package/cli/node_modules/.ignored/scule/dist/index.d.ts +0 -57
  253. package/cli/node_modules/.ignored/scule/dist/index.mjs +0 -80
  254. package/cli/node_modules/.ignored/scule/package.json +0 -43
  255. package/cli/node_modules/.package-lock.json +0 -33
  256. package/dist/runtime/types/component.d.ts +0 -17
  257. package/dist/runtime/types/component.js +0 -0
package/dist/module.mjs CHANGED
@@ -1,2617 +1,129 @@
1
- import { defuFn, defu } from 'defu';
2
- import { addTemplate, addTypeTemplate, defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
1
+ import defu, { defu as defu$1 } from 'defu';
2
+ import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir, extendPages, hasNuxtModule, installModule } from '@nuxt/kit';
3
+ import { d as defaultOptions, r as resolveColors, a as getDefaultUiConfig, b as addTemplates, c as buildTemplates } from './shared/ui.BufKhDiD.mjs';
4
+ import { addCustomTab } from '@nuxt/devtools-kit';
5
+ import sirv from 'sirv';
6
+ import 'get-port-please';
7
+ import { kebabCase, camelCase } from 'scule';
8
+ import fs from 'node:fs';
9
+ import '../dist/runtime/utils/index.js';
3
10
  import 'node:url';
4
- import { kebabCase } from 'scule';
5
- import { pick } from '../dist/runtime/utils/index.js';
6
11
 
7
- const accordion = {
8
- slots: {
9
- root: "w-full",
10
- item: "border-b border-[--ui-border] last:border-b-0",
11
- header: "flex",
12
- trigger: "group flex-1 flex items-center gap-1.5 font-medium text-sm py-3.5 focus-visible:outline-[--ui-primary] min-w-0",
13
- content: "data-[state=open]:animate-[accordion-down_200ms_ease-out] data-[state=closed]:animate-[accordion-up_200ms_ease-out] overflow-hidden focus:outline-none",
14
- body: "text-sm pb-3.5",
15
- leadingIcon: "shrink-0 size-5",
16
- trailingIcon: "shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200",
17
- label: "text-left break-words"
18
- },
19
- variants: {
20
- disabled: {
21
- true: {
22
- trigger: "cursor-not-allowed opacity-75"
23
- }
24
- }
25
- }
26
- };
27
-
28
- const alert = (options) => ({
29
- slots: {
30
- root: "relative overflow-hidden w-full rounded-[calc(var(--ui-radius)*2)] p-4 flex gap-2.5",
31
- wrapper: "min-w-0 flex-1 flex flex-col gap-1",
32
- title: "text-sm font-medium",
33
- description: "text-sm opacity-90",
34
- icon: "shrink-0 size-5",
35
- avatar: "shrink-0",
36
- avatarSize: "2xl",
37
- actions: "flex gap-1.5 shrink-0",
38
- close: "p-0.5"
39
- },
40
- variants: {
41
- color: {
42
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
43
- neutral: ""
44
- },
45
- variant: {
46
- solid: "",
47
- outline: "",
48
- soft: "",
49
- subtle: ""
50
- },
51
- multiline: {
52
- true: {
53
- root: "items-start",
54
- actions: "items-start mt-1"
55
- },
56
- false: {
57
- root: "items-center",
58
- actions: "items-center"
59
- }
60
- }
61
- },
62
- compoundVariants: [...(options.theme.colors || []).map((color) => ({
63
- color,
64
- variant: "solid",
65
- class: {
66
- root: `bg-[--ui-${color}] text-[--ui-bg]`
67
- }
68
- })), ...(options.theme.colors || []).map((color) => ({
69
- color,
70
- variant: "outline",
71
- class: {
72
- root: `text-[--ui-${color}] ring ring-inset ring-[--ui-${color}]/25`
73
- }
74
- })), ...(options.theme.colors || []).map((color) => ({
75
- color,
76
- variant: "soft",
77
- class: {
78
- root: `bg-[--ui-${color}]/10 text-[--ui-${color}]`
79
- }
80
- })), ...(options.theme.colors || []).map((color) => ({
81
- color,
82
- variant: "subtle",
83
- class: {
84
- root: `bg-[--ui-${color}]/10 text-[--ui-${color}] ring ring-inset ring-[--ui-${color}]/25`
85
- }
86
- })), {
87
- color: "neutral",
88
- variant: "solid",
89
- class: {
90
- root: "text-[--ui-bg] bg-[--ui-bg-inverted]"
91
- }
92
- }, {
93
- color: "neutral",
94
- variant: "outline",
95
- class: {
96
- root: "text-[--ui-text-highlighted] bg-[--ui-bg] ring ring-inset ring-[--ui-border]"
97
- }
98
- }, {
99
- color: "neutral",
100
- variant: "soft",
101
- class: {
102
- root: "text-[--ui-text-highlighted] bg-[--ui-bg-elevated]/50"
103
- }
104
- }, {
105
- color: "neutral",
106
- variant: "subtle",
107
- class: {
108
- root: "text-[--ui-text-highlighted] bg-[--ui-bg-elevated]/50 ring ring-inset ring-[--ui-border-accented]"
109
- }
110
- }],
111
- defaultVariants: {
112
- color: "primary",
113
- variant: "solid"
114
- }
115
- });
116
-
117
- const avatar = {
118
- slots: {
119
- root: "inline-flex items-center justify-center shrink-0 select-none overflow-hidden rounded-full align-middle bg-[--ui-bg-elevated]",
120
- image: "h-full w-full rounded-[inherit] object-cover",
121
- fallback: "font-medium leading-none text-[--ui-text-muted] truncate",
122
- icon: "text-[--ui-text-muted] shrink-0"
123
- },
124
- variants: {
125
- size: {
126
- "3xs": {
127
- root: "size-4 text-[8px]"
128
- },
129
- "2xs": {
130
- root: "size-5 text-[10px]"
131
- },
132
- "xs": {
133
- root: "size-6 text-xs"
134
- },
135
- "sm": {
136
- root: "size-7 text-sm"
137
- },
138
- "md": {
139
- root: "size-8 text-base"
140
- },
141
- "lg": {
142
- root: "size-9 text-lg"
143
- },
144
- "xl": {
145
- root: "size-10 text-xl"
146
- },
147
- "2xl": {
148
- root: "size-11 text-[22px]"
149
- },
150
- "3xl": {
151
- root: "size-12 text-2xl"
152
- }
153
- }
154
- },
155
- defaultVariants: {
156
- size: "md"
157
- }
158
- };
159
-
160
- const avatarGroup = {
161
- slots: {
162
- root: "inline-flex flex-row-reverse justify-end",
163
- base: "relative rounded-full ring-[--ui-bg] first:me-0"
164
- },
165
- variants: {
166
- size: {
167
- "3xs": {
168
- base: "ring-1 -me-0.5"
169
- },
170
- "2xs": {
171
- base: "ring-1 -me-0.5"
172
- },
173
- "xs": {
174
- base: "ring-1 -me-0.5"
175
- },
176
- "sm": {
177
- base: "ring-2 -me-1.5"
178
- },
179
- "md": {
180
- base: "ring-2 -me-1.5"
181
- },
182
- "lg": {
183
- base: "ring-2 -me-1.5"
184
- },
185
- "xl": {
186
- base: "ring-2.5 -me-2"
187
- },
188
- "2xl": {
189
- base: "ring-2.5 -me-2"
190
- },
191
- "3xl": {
192
- base: "ring-2.5 -me-2"
193
- }
194
- }
195
- },
196
- defaultVariants: {
197
- size: "md"
198
- }
199
- };
200
-
201
- const badge = (options) => ({
202
- base: "rounded-[calc(var(--ui-radius)*1.5)] font-medium inline-flex items-center",
203
- variants: {
204
- color: {
205
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
206
- neutral: ""
207
- },
208
- variant: {
209
- solid: "",
210
- outline: "",
211
- soft: "",
212
- subtle: ""
213
- },
214
- size: {
215
- sm: "text-xs px-1.5 py-0.5",
216
- md: "text-xs px-2 py-1",
217
- lg: "text-sm px-2 py-1"
218
- }
219
- },
220
- compoundVariants: [...(options.theme.colors || []).map((color) => ({
221
- color,
222
- variant: "solid",
223
- class: `bg-[--ui-${color}] text-[--ui-bg]`
224
- })), ...(options.theme.colors || []).map((color) => ({
225
- color,
226
- variant: "outline",
227
- class: `text-[--ui-${color}] ring ring-inset ring-[--ui-${color}]/50`
228
- })), ...(options.theme.colors || []).map((color) => ({
229
- color,
230
- variant: "soft",
231
- class: `bg-[--ui-${color}]/10 text-[--ui-${color}]`
232
- })), ...(options.theme.colors || []).map((color) => ({
233
- color,
234
- variant: "subtle",
235
- class: `bg-[--ui-${color}]/10 text-[--ui-${color}] ring ring-inset ring-[--ui-${color}]/25`
236
- })), {
237
- color: "neutral",
238
- variant: "solid",
239
- class: "text-[--ui-bg] bg-[--ui-bg-inverted]"
240
- }, {
241
- color: "neutral",
242
- variant: "outline",
243
- class: "ring ring-inset ring-[--ui-border-accented] text-[--ui-text] bg-[--ui-bg]"
244
- }, {
245
- color: "neutral",
246
- variant: "soft",
247
- class: "text-[--ui-text] bg-[--ui-bg-elevated]"
248
- }, {
249
- color: "neutral",
250
- variant: "subtle",
251
- class: "ring ring-inset ring-[--ui-border-accented] text-[--ui-text] bg-[--ui-bg-elevated]"
252
- }],
253
- defaultVariants: {
254
- color: "primary",
255
- variant: "solid",
256
- size: "md"
257
- }
258
- });
259
-
260
- const breadcrumb = (options) => ({
261
- slots: {
262
- root: "relative min-w-0",
263
- list: "flex items-center gap-1.5",
264
- item: "flex min-w-0",
265
- link: "group relative flex items-center gap-1.5 text-sm min-w-0 focus-visible:outline-[--ui-primary]",
266
- linkLeadingIcon: "shrink-0 size-5",
267
- linkLeadingAvatar: "shrink-0",
268
- linkLeadingAvatarSize: "2xs",
269
- linkLabel: "truncate",
270
- separator: "flex",
271
- separatorIcon: "shrink-0 size-5 text-[--ui-text-muted]"
272
- },
273
- variants: {
274
- active: {
275
- true: {
276
- link: "text-[--ui-primary] font-semibold"
277
- },
278
- false: {
279
- link: "text-[--ui-text-muted] font-medium"
280
- }
281
- },
282
- disabled: {
283
- true: {
284
- link: "cursor-not-allowed opacity-75"
285
- }
286
- },
287
- to: {
288
- true: ""
289
- }
290
- },
291
- compoundVariants: [{
292
- disabled: false,
293
- active: false,
294
- to: true,
295
- class: {
296
- link: ["hover:text-[--ui-text]", options.theme.transitions && "transition-colors"]
297
- }
298
- }]
299
- });
300
-
301
- const buttonGroupVariant = {
302
- buttonGroup: {
303
- horizontal: "not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none",
304
- vertical: "not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none"
305
- }
306
- };
307
- const buttonGroupVariantWithRoot = {
308
- buttonGroup: {
309
- horizontal: {
310
- root: "group",
311
- base: "group-not-only:group-first:rounded-e-none group-not-only:group-last:rounded-s-none group-not-last:group-not-first:rounded-none"
312
- },
313
- vertical: {
314
- root: "group",
315
- base: "group-not-only:group-first:rounded-b-none group-not-only:group-last:rounded-t-none group-not-last:group-not-first:rounded-none"
316
- }
317
- }
318
- };
319
- const buttonGroup = {
320
- base: "relative",
321
- variants: {
322
- size: {
323
- xs: "",
324
- sm: "",
325
- md: "",
326
- lg: "",
327
- xl: ""
328
- },
329
- orientation: {
330
- horizontal: "inline-flex -space-x-px",
331
- vertical: "flex flex-col -space-y-px"
332
- }
333
- }
334
- };
335
-
336
- const button = (options) => ({
337
- slots: {
338
- base: ["rounded-[calc(var(--ui-radius)*1.5)] font-medium inline-flex items-center focus:outline-none disabled:cursor-not-allowed aria-disabled:cursor-not-allowed disabled:opacity-75 aria-disabled:opacity-75", options.theme.transitions && "transition-colors"],
339
- label: "truncate",
340
- leadingIcon: "shrink-0",
341
- leadingAvatar: "shrink-0",
342
- trailingIcon: "shrink-0"
343
- },
344
- variants: {
345
- ...buttonGroupVariant,
346
- color: {
347
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
348
- neutral: ""
349
- },
350
- variant: {
351
- solid: "",
352
- outline: "",
353
- soft: "",
354
- subtle: "",
355
- ghost: "",
356
- link: ""
357
- },
358
- size: {
359
- xs: {
360
- base: "px-2 py-1 text-xs gap-1",
361
- leadingIcon: "size-4",
362
- trailingIcon: "size-4"
363
- },
364
- sm: {
365
- base: "px-2.5 py-1.5 text-xs gap-1.5",
366
- leadingIcon: "size-4",
367
- trailingIcon: "size-4"
368
- },
369
- md: {
370
- base: "px-2.5 py-1.5 text-sm gap-1.5",
371
- leadingIcon: "size-5",
372
- trailingIcon: "size-5"
373
- },
374
- lg: {
375
- base: "px-3 py-2 text-sm gap-2",
376
- leadingIcon: "size-5",
377
- trailingIcon: "size-5"
378
- },
379
- xl: {
380
- base: "px-3 py-2 text-base gap-2",
381
- leadingIcon: "size-6",
382
- trailingIcon: "size-6"
383
- }
384
- },
385
- block: {
386
- true: {
387
- base: "w-full justify-center",
388
- trailingIcon: "ms-auto"
389
- }
390
- },
391
- square: {
392
- true: ""
393
- },
394
- leading: {
395
- true: ""
396
- },
397
- trailing: {
398
- true: ""
399
- },
400
- loading: {
401
- true: ""
402
- }
403
- },
404
- compoundVariants: [...(options.theme.colors || []).map((color) => ({
405
- color,
406
- variant: "solid",
407
- class: `text-[--ui-bg] bg-[--ui-${color}] hover:bg-[--ui-${color}]/75 disabled:bg-[--ui-${color}] aria-disabled:bg-[--ui-${color}] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[--ui-${color}]`
408
- })), ...(options.theme.colors || []).map((color) => ({
409
- color,
410
- variant: "outline",
411
- class: `ring ring-inset ring-[--ui-${color}]/50 text-[--ui-${color}] hover:bg-[--ui-${color}]/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent focus-visible:ring-2 focus-visible:ring-[--ui-${color}]`
412
- })), ...(options.theme.colors || []).map((color) => ({
413
- color,
414
- variant: "soft",
415
- class: `text-[--ui-${color}] bg-[--ui-${color}]/10 hover:bg-[--ui-${color}]/15 focus-visible:bg-[--ui-${color}]/15 disabled:bg-[--ui-${color}]/10 aria-disabled:bg-[--ui-${color}]/10`
416
- })), ...(options.theme.colors || []).map((color) => ({
417
- color,
418
- variant: "subtle",
419
- class: `text-[--ui-${color}] ring ring-inset ring-[--ui-${color}]/25 bg-[--ui-${color}]/10 hover:bg-[--ui-${color}]/15 disabled:bg-[--ui-${color}]/10 aria-disabled:bg-[--ui-${color}]/10 focus-visible:ring-2 focus-visible:ring-[--ui-${color}]`
420
- })), ...(options.theme.colors || []).map((color) => ({
421
- color,
422
- variant: "ghost",
423
- class: `text-[--ui-${color}] hover:bg-[--ui-${color}]/10 focus-visible:bg-[--ui-${color}]/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent`
424
- })), ...(options.theme.colors || []).map((color) => ({
425
- color,
426
- variant: "link",
427
- class: `text-[--ui-${color}] hover:text-[--ui-${color}] disabled:text-[--ui-${color}] aria-disabled:text-[--ui-${color}] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[--ui-${color}]`
428
- })), {
429
- color: "neutral",
430
- variant: "solid",
431
- class: "text-[--ui-bg] bg-[--ui-bg-inverted] hover:bg-[--ui-bg-inverted]/80 disabled:bg-[--ui-bg-inverted] aria-disabled:bg-[--ui-bg-inverted] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[--ui-border-inverted]"
432
- }, {
433
- color: "neutral",
434
- variant: "outline",
435
- class: "ring ring-inset ring-[--ui-border-accented] text-[--ui-text] bg-[--ui-bg] hover:bg-[--ui-bg-elevated] disabled:bg-[--ui-bg] aria-disabled:bg-[--ui-bg] focus-visible:ring-2 focus-visible:ring-[--ui-border-inverted]"
436
- }, {
437
- color: "neutral",
438
- variant: "soft",
439
- class: "text-[--ui-text] bg-[--ui-bg-elevated] hover:bg-[--ui-bg-accented]/75 focus-visible:bg-[--ui-bg-accented]/75 disabled:bg-[--ui-bg-elevated] aria-disabled:bg-[--ui-bg-elevated]"
440
- }, {
441
- color: "neutral",
442
- variant: "subtle",
443
- class: "ring ring-inset ring-[--ui-border-accented] text-[--ui-text] bg-[--ui-bg-elevated] hover:bg-[--ui-bg-accented]/75 disabled:bg-[--ui-bg-elevated] aria-disabled:bg-[--ui-bg-elevated] focus-visible:ring-2 focus-visible:ring-[--ui-border-inverted]"
444
- }, {
445
- color: "neutral",
446
- variant: "ghost",
447
- class: "text-[--ui-text] hover:bg-[--ui-bg-elevated] focus-visible:bg-[--ui-bg-elevated] hover:disabled:bg-transparent dark:hover:disabled:bg-transparent hover:aria-disabled:bg-transparent dark:hover:aria-disabled:bg-transparent"
448
- }, {
449
- color: "neutral",
450
- variant: "link",
451
- class: "text-[--ui-text-muted] hover:text-[--ui-text] disabled:text-[--ui-text-muted] aria-disabled:text-[--ui-text-muted] focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-[--ui-border-inverted]"
452
- }, {
453
- size: "xs",
454
- square: true,
455
- class: "p-1"
456
- }, {
457
- size: "sm",
458
- square: true,
459
- class: "p-1.5"
460
- }, {
461
- size: "md",
462
- square: true,
463
- class: "p-1.5"
464
- }, {
465
- size: "lg",
466
- square: true,
467
- class: "p-2"
468
- }, {
469
- size: "xl",
470
- square: true,
471
- class: "p-2"
472
- }, {
473
- loading: true,
474
- leading: true,
475
- class: {
476
- leadingIcon: "animate-spin"
477
- }
478
- }, {
479
- loading: true,
480
- leading: false,
481
- trailing: true,
482
- class: {
483
- trailingIcon: "animate-spin"
484
- }
485
- }],
486
- defaultVariants: {
487
- color: "primary",
488
- variant: "solid",
489
- size: "md"
490
- }
491
- });
492
-
493
- const card = {
494
- slots: {
495
- root: "bg-[--ui-bg] ring ring-[--ui-border] divide-y divide-[--ui-border] rounded-[calc(var(--ui-radius)*2)] shadow",
496
- header: "p-4 sm:px-6",
497
- body: "p-4 sm:p-6",
498
- footer: "p-4 sm:px-6"
499
- }
500
- };
501
-
502
- const carousel = (options) => ({
503
- slots: {
504
- root: "relative focus:outline-none",
505
- viewport: "overflow-hidden",
506
- container: "flex items-start",
507
- item: "min-w-0 shrink-0 basis-full",
508
- controls: "",
509
- arrows: "",
510
- prev: "absolute rounded-full",
511
- next: "absolute rounded-full",
512
- dots: "absolute inset-x-0 -bottom-7 flex flex-wrap items-center justify-center gap-3",
513
- dot: ["cursor-pointer size-3 bg-[--ui-border-accented] rounded-full", options.theme.transitions && "transition"]
514
- },
515
- variants: {
516
- orientation: {
517
- vertical: {
518
- container: "flex-col -mt-4",
519
- item: "pt-4",
520
- prev: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
521
- next: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90"
522
- },
523
- horizontal: {
524
- container: "flex-row -ml-4",
525
- item: "pl-4",
526
- prev: "-left-12 top-1/2 -translate-y-1/2",
527
- next: "-right-12 top-1/2 -translate-y-1/2"
528
- }
529
- },
530
- active: {
531
- true: {
532
- dot: "bg-[--ui-border-inverted]"
533
- }
534
- }
535
- },
536
- defaultVariants: {
537
- orientation: "horizontal"
538
- }
539
- });
540
-
541
- const checkbox = (options) => ({
542
- slots: {
543
- root: "relative flex items-start",
544
- base: "shrink-0 flex items-center justify-center rounded-[--ui-radius] text-[--ui-bg] ring ring-inset ring-[--ui-border-accented] focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2",
545
- container: "flex items-center",
546
- wrapper: "ms-2",
547
- icon: "shrink-0 size-full",
548
- label: "block font-medium text-[--ui-text]",
549
- description: "text-[--ui-text-muted]"
550
- },
551
- variants: {
552
- color: {
553
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, `focus-visible:outline-[--ui-${color}]`])),
554
- neutral: "focus-visible:outline-[--ui-border-inverted]"
555
- },
556
- size: {
557
- xs: {
558
- base: "size-3",
559
- container: "h-4",
560
- wrapper: "text-xs"
561
- },
562
- sm: {
563
- base: "size-3.5",
564
- container: "h-4",
565
- wrapper: "text-xs"
566
- },
567
- md: {
568
- base: "size-4",
569
- container: "h-5",
570
- wrapper: "text-sm"
571
- },
572
- lg: {
573
- base: "size-4.5",
574
- container: "h-5",
575
- wrapper: "text-sm"
576
- },
577
- xl: {
578
- base: "size-5",
579
- container: "h-6",
580
- wrapper: "text-base"
581
- }
582
- },
583
- required: {
584
- true: {
585
- label: "after:content-['*'] after:ms-0.5 after:text-[--ui-error]"
586
- }
587
- },
588
- disabled: {
589
- true: {
590
- base: "cursor-not-allowed opacity-75",
591
- label: "cursor-not-allowed opacity-75",
592
- description: "cursor-not-allowed opacity-75"
593
- }
594
- },
595
- checked: {
596
- true: ""
597
- }
598
- },
599
- compoundVariants: [...(options.theme.colors || []).map((color) => ({
600
- color,
601
- checked: true,
602
- class: `ring-2 ring-[--ui-${color}] bg-[--ui-${color}]`
603
- })), {
604
- color: "neutral",
605
- checked: true,
606
- class: "ring-2 ring-[--ui-border-inverted] bg-[--ui-bg-inverted]"
607
- }],
608
- defaultVariants: {
609
- size: "md",
610
- color: "primary"
611
- }
612
- });
613
-
614
- const chip = (options) => ({
615
- slots: {
616
- root: "relative inline-flex items-center justify-center shrink-0",
617
- base: "rounded-full ring ring-[--ui-bg] flex items-center justify-center text-[--ui-bg] font-medium whitespace-nowrap"
618
- },
619
- variants: {
620
- color: {
621
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, `bg-[--ui-${color}]`])),
622
- neutral: "bg-[--ui-text-muted]"
623
- },
624
- size: {
625
- "3xs": "h-[4px] min-w-[4px] text-[4px]",
626
- "2xs": "h-[5px] min-w-[5px] text-[5px]",
627
- "xs": "h-[6px] min-w-[6px] text-[6px]",
628
- "sm": "h-[7px] min-w-[7px] text-[7px]",
629
- "md": "h-[8px] min-w-[8px] text-[8px]",
630
- "lg": "h-[9px] min-w-[9px] text-[9px]",
631
- "xl": "h-[10px] min-w-[10px] text-[10px]",
632
- "2xl": "h-[11px] min-w-[11px] text-[11px]",
633
- "3xl": "h-[12px] min-w-[12px] text-[12px]"
634
- },
635
- position: {
636
- "top-right": "top-0 right-0",
637
- "bottom-right": "bottom-0 right-0",
638
- "top-left": "top-0 left-0",
639
- "bottom-left": "bottom-0 left-0"
640
- },
641
- inset: {
642
- false: ""
643
- },
644
- standalone: {
645
- false: "absolute"
646
- }
647
- },
648
- compoundVariants: [{
649
- position: "top-right",
650
- inset: false,
651
- class: "-translate-y-1/2 translate-x-1/2 transform"
652
- }, {
653
- position: "bottom-right",
654
- inset: false,
655
- class: "translate-y-1/2 translate-x-1/2 transform"
656
- }, {
657
- position: "top-left",
658
- inset: false,
659
- class: "-translate-y-1/2 -translate-x-1/2 transform"
660
- }, {
661
- position: "bottom-left",
662
- inset: false,
663
- class: "translate-y-1/2 -translate-x-1/2 transform"
664
- }],
665
- defaultVariants: {
666
- size: "md",
667
- color: "primary",
668
- position: "top-right"
669
- }
670
- });
671
-
672
- const collapsible = {
673
- slots: {
674
- root: "flex flex-col gap-2",
675
- content: "data-[state=open]:animate-[collapsible-down_200ms_ease-out] data-[state=closed]:animate-[collapsible-up_200ms_ease-out] overflow-hidden"
676
- }
677
- };
678
-
679
- const commandPalette = (options) => ({
680
- slots: {
681
- root: "flex flex-col min-h-0 min-w-0 divide-y divide-[--ui-border]",
682
- input: "[&>input]:h-12",
683
- close: "",
684
- content: "relative overflow-hidden",
685
- viewport: "divide-y divide-[--ui-border] scroll-py-1",
686
- group: "p-1 isolate",
687
- empty: "py-6 text-center text-sm",
688
- label: "px-2 py-1.5 text-xs font-semibold text-[--ui-text-highlighted]",
689
- item: ["group relative w-full flex items-center gap-2 px-2 py-1.5 text-sm select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75 text-[--ui-text] data-highlighted:text-[--ui-text-highlighted] data-highlighted:before:bg-[--ui-bg-elevated]/50", options.theme.transitions && "transition-colors before:transition-colors"],
690
- itemLeadingIcon: ["shrink-0 size-5 text-[--ui-text-dimmed] group-data-highlighted:text-[--ui-text]", options.theme.transitions && "transition-colors"],
691
- itemLeadingAvatar: "shrink-0",
692
- itemLeadingAvatarSize: "2xs",
693
- itemLeadingChip: "shrink-0 size-5",
694
- itemLeadingChipSize: "md",
695
- itemTrailing: "ms-auto inline-flex gap-1.5 items-center",
696
- itemTrailingIcon: "shrink-0 size-5",
697
- itemTrailingHighlightedIcon: "shrink-0 size-5 text-[--ui-text-dimmed] hidden group-data-highlighted:inline-flex",
698
- itemTrailingKbds: "hidden lg:inline-flex items-center shrink-0 gap-0.5",
699
- itemTrailingKbdsSize: "md",
700
- itemLabel: "truncate space-x-1",
701
- itemLabelBase: "text-[--ui-text-highlighted] [&>mark]:text-[--ui-bg] [&>mark]:bg-[--ui-primary]",
702
- itemLabelPrefix: "text-[--ui-text]",
703
- itemLabelSuffix: "text-[--ui-text-dimmed] [&>mark]:text-[--ui-bg] [&>mark]:bg-[--ui-primary]"
704
- }
705
- });
706
-
707
- const container = {
708
- base: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"
709
- };
710
-
711
- const contextMenu = (options) => ({
712
- slots: {
713
- content: "min-w-32 bg-[--ui-bg] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[--ui-border] divide-y divide-[--ui-border] overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
714
- group: "p-1 isolate",
715
- label: "w-full flex items-center font-semibold text-[--ui-text-highlighted]",
716
- separator: "-mx-1 my-1 h-px bg-[--ui-border]",
717
- item: "group relative w-full flex items-center select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75",
718
- itemLeadingIcon: "shrink-0",
719
- itemLeadingAvatar: "shrink-0",
720
- itemLeadingAvatarSize: "",
721
- itemTrailing: "ms-auto inline-flex",
722
- itemTrailingIcon: "shrink-0",
723
- itemTrailingKbds: "hidden lg:inline-flex items-center shrink-0",
724
- itemTrailingKbdsSize: "",
725
- itemLabel: "truncate",
726
- itemLabelExternalIcon: "size-3 align-top text-[--ui-text-dimmed]"
727
- },
728
- variants: {
729
- active: {
730
- true: {
731
- item: "text-[--ui-text-highlighted] before:bg-[--ui-bg-elevated]",
732
- itemLeadingIcon: "text-[--ui-text]"
733
- },
734
- false: {
735
- item: ["text-[--ui-text] data-highlighted:text-[--ui-text-highlighted] data-[state=open]:text-[--ui-text-highlighted] data-highlighted:before:bg-[--ui-bg-elevated]/50 data-[state=open]:before:bg-[--ui-bg-elevated]/50", options.theme.transitions && "transition-colors before:transition-colors"],
736
- itemLeadingIcon: ["text-[--ui-text-dimmed] group-data-highlighted:text-[--ui-text] group-data-[state=open]:text-[--ui-text]", options.theme.transitions && "transition-colors"]
737
- }
738
- },
739
- size: {
740
- xs: {
741
- label: "p-1 text-xs gap-1",
742
- item: "p-1 text-xs gap-1",
743
- itemLeadingIcon: "size-4",
744
- itemLeadingAvatarSize: "3xs",
745
- itemTrailingIcon: "size-4",
746
- itemTrailingKbds: "gap-0.5",
747
- itemTrailingKbdsSize: "sm"
748
- },
749
- sm: {
750
- label: "p-1.5 text-xs gap-1.5",
751
- item: "p-1.5 text-xs gap-1.5",
752
- itemLeadingIcon: "size-4",
753
- itemLeadingAvatarSize: "3xs",
754
- itemTrailingIcon: "size-4",
755
- itemTrailingKbds: "gap-0.5",
756
- itemTrailingKbdsSize: "sm"
757
- },
758
- md: {
759
- label: "p-1.5 text-sm gap-1.5",
760
- item: "p-1.5 text-sm gap-1.5",
761
- itemLeadingIcon: "size-5",
762
- itemLeadingAvatarSize: "2xs",
763
- itemTrailingIcon: "size-5",
764
- itemTrailingKbds: "gap-0.5",
765
- itemTrailingKbdsSize: "md"
766
- },
767
- lg: {
768
- label: "p-2 text-sm gap-2",
769
- item: "p-2 text-sm gap-2",
770
- itemLeadingIcon: "size-5",
771
- itemLeadingAvatarSize: "2xs",
772
- itemTrailingIcon: "size-5",
773
- itemTrailingKbds: "gap-1",
774
- itemTrailingKbdsSize: "md"
775
- },
776
- xl: {
777
- label: "p-2 text-base gap-2",
778
- item: "p-2 text-base gap-2",
779
- itemLeadingIcon: "size-6",
780
- itemLeadingAvatarSize: "xs",
781
- itemTrailingIcon: "size-6",
782
- itemTrailingKbds: "gap-1",
783
- itemTrailingKbdsSize: "lg"
784
- }
785
- }
786
- },
787
- defaultVariants: {
788
- size: "md"
789
- }
790
- });
791
-
792
- const drawer = {
793
- slots: {
794
- overlay: "fixed inset-0 z-50 bg-[--ui-bg-elevated]/75",
795
- content: "fixed z-50 bg-[--ui-bg] ring ring-[--ui-border] flex focus:outline-none",
796
- handle: "shrink-0 rounded-full bg-[--ui-bg-accented]",
797
- container: "w-full flex flex-col gap-4 p-4 overflow-y-auto",
798
- header: "",
799
- title: "text-[--ui-text-highlighted] font-semibold",
800
- description: "mt-1 text-[--ui-text-muted] text-sm",
801
- body: "flex-1",
802
- footer: "flex flex-col gap-1.5"
803
- },
804
- variants: {
805
- direction: {
806
- top: {
807
- content: "top-0 mb-24 flex-col-reverse rounded-b-[calc(var(--ui-radius)*2)]",
808
- handle: "mb-4"
809
- },
810
- right: {
811
- content: "right-4 flex-row",
812
- handle: "ml-4"
813
- },
814
- bottom: {
815
- content: "bottom-0 mt-24 flex-col rounded-t-[calc(var(--ui-radius)*2)]",
816
- handle: "mt-4"
817
- },
818
- left: {
819
- content: "left-4 flex-row-reverse",
820
- handle: "mr-4"
821
- }
822
- }
823
- },
824
- compoundVariants: [{
825
- direction: ["top", "bottom"],
826
- class: {
827
- content: "inset-x-0 h-auto max-h-[96%]",
828
- handle: "w-12 h-1.5 mx-auto"
829
- }
830
- }, {
831
- direction: ["right", "left"],
832
- class: {
833
- content: "inset-y-4 w-auto max-w-[calc(100%-2rem)] rounded-[calc(var(--ui-radius)*2)] after:hidden",
834
- handle: "h-12 w-1.5 mt-auto mb-auto"
835
- }
836
- }]
837
- };
838
-
839
- const dropdownMenu = (options) => ({
840
- slots: {
841
- content: "min-w-32 bg-[--ui-bg] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[--ui-border] divide-y divide-[--ui-border] overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
842
- arrow: "fill-[--ui-border]",
843
- group: "p-1 isolate",
844
- label: "w-full flex items-center font-semibold text-[--ui-text-highlighted]",
845
- separator: "-mx-1 my-1 h-px bg-[--ui-border]",
846
- item: "group relative w-full flex items-center select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75",
847
- itemLeadingIcon: "shrink-0",
848
- itemLeadingAvatar: "shrink-0",
849
- itemLeadingAvatarSize: "",
850
- itemTrailing: "ms-auto inline-flex",
851
- itemTrailingIcon: "shrink-0",
852
- itemTrailingKbds: "hidden lg:inline-flex items-center shrink-0",
853
- itemTrailingKbdsSize: "",
854
- itemLabel: "truncate",
855
- itemLabelExternalIcon: "size-3 align-top text-[--ui-text-dimmed]"
856
- },
857
- variants: {
858
- active: {
859
- true: {
860
- item: "text-[--ui-text-highlighted] before:bg-[--ui-bg-elevated]",
861
- itemLeadingIcon: "text-[--ui-text]"
862
- },
863
- false: {
864
- item: ["text-[--ui-text] data-highlighted:text-[--ui-text-highlighted] data-[state=open]:text-[--ui-text-highlighted] data-highlighted:before:bg-[--ui-bg-elevated]/50 data-[state=open]:before:bg-[--ui-bg-elevated]/50", options.theme.transitions && "transition-colors before:transition-colors"],
865
- itemLeadingIcon: ["text-[--ui-text-dimmed] group-data-highlighted:text-[--ui-text] group-data-[state=open]:text-[--ui-text]", options.theme.transitions && "transition-colors"]
866
- }
867
- },
868
- size: {
869
- xs: {
870
- label: "p-1 text-xs gap-1",
871
- item: "p-1 text-xs gap-1",
872
- itemLeadingIcon: "size-4",
873
- itemLeadingAvatarSize: "3xs",
874
- itemTrailingIcon: "size-4",
875
- itemTrailingKbds: "gap-0.5",
876
- itemTrailingKbdsSize: "sm"
877
- },
878
- sm: {
879
- label: "p-1.5 text-xs gap-1.5",
880
- item: "p-1.5 text-xs gap-1.5",
881
- itemLeadingIcon: "size-4",
882
- itemLeadingAvatarSize: "3xs",
883
- itemTrailingIcon: "size-4",
884
- itemTrailingKbds: "gap-0.5",
885
- itemTrailingKbdsSize: "sm"
886
- },
887
- md: {
888
- label: "p-1.5 text-sm gap-1.5",
889
- item: "p-1.5 text-sm gap-1.5",
890
- itemLeadingIcon: "size-5",
891
- itemLeadingAvatarSize: "2xs",
892
- itemTrailingIcon: "size-5",
893
- itemTrailingKbds: "gap-0.5",
894
- itemTrailingKbdsSize: "md"
895
- },
896
- lg: {
897
- label: "p-2 text-sm gap-2",
898
- item: "p-2 text-sm gap-2",
899
- itemLeadingIcon: "size-5",
900
- itemLeadingAvatarSize: "2xs",
901
- itemTrailingIcon: "size-5",
902
- itemTrailingKbds: "gap-1",
903
- itemTrailingKbdsSize: "md"
904
- },
905
- xl: {
906
- label: "p-2 text-base gap-2",
907
- item: "p-2 text-base gap-2",
908
- itemLeadingIcon: "size-6",
909
- itemLeadingAvatarSize: "xs",
910
- itemTrailingIcon: "size-6",
911
- itemTrailingKbds: "gap-1",
912
- itemTrailingKbdsSize: "lg"
913
- }
914
- }
915
- },
916
- defaultVariants: {
917
- size: "md"
918
- }
919
- });
920
-
921
- const form = {
922
- base: ""
923
- };
924
-
925
- const formField = {
926
- slots: {
927
- root: "",
928
- wrapper: "",
929
- labelWrapper: "flex content-center items-center justify-between",
930
- label: "block font-medium text-[--ui-text]",
931
- container: "mt-1 relative",
932
- description: "text-[--ui-text-muted]",
933
- error: "mt-2 text-[--ui-error]",
934
- hint: "text-[--ui-text-muted]",
935
- help: "mt-2 text-[--ui-text-muted]"
936
- },
937
- variants: {
938
- size: {
939
- xs: { root: "text-xs" },
940
- sm: { root: "text-xs" },
941
- md: { root: "text-sm" },
942
- lg: { root: "text-sm" },
943
- xl: { root: "text-base" }
944
- },
945
- required: {
946
- true: {
947
- label: `after:content-['*'] after:ms-0.5 after:text-[--ui-error]`
948
- }
949
- }
950
- },
951
- defaultVariants: {
952
- size: "md"
953
- }
954
- };
955
-
956
- const input = (options) => ({
957
- slots: {
958
- root: "relative inline-flex items-center",
959
- base: ["w-full rounded-[calc(var(--ui-radius)*1.5)] border-0 placeholder-[--ui-text-dimmed] focus:outline-none disabled:cursor-not-allowed disabled:opacity-75", options.theme.transitions && "transition-colors"],
960
- leading: "absolute inset-y-0 start-0 flex items-center",
961
- leadingIcon: "shrink-0 text-[--ui-text-dimmed]",
962
- leadingAvatar: "shrink-0",
963
- trailing: "absolute inset-y-0 end-0 flex items-center",
964
- trailingIcon: "shrink-0 text-[--ui-text-dimmed]"
965
- },
966
- variants: {
967
- ...buttonGroupVariantWithRoot,
968
- size: {
969
- xs: {
970
- base: "px-2 py-1 text-xs gap-1",
971
- leading: "pl-2",
972
- trailing: "pr-2",
973
- leadingIcon: "size-4",
974
- trailingIcon: "size-4"
975
- },
976
- sm: {
977
- base: "px-2.5 py-1.5 text-xs gap-1.5",
978
- leading: "pl-2.5",
979
- trailing: "pr-2.5",
980
- leadingIcon: "size-4",
981
- trailingIcon: "size-4"
982
- },
983
- md: {
984
- base: "px-2.5 py-1.5 text-sm gap-1.5",
985
- leading: "pl-2.5",
986
- trailing: "pr-2.5",
987
- leadingIcon: "size-5",
988
- trailingIcon: "size-5"
989
- },
990
- lg: {
991
- base: "px-3 py-2 text-sm gap-2",
992
- leading: "pl-3",
993
- trailing: "pr-3",
994
- leadingIcon: "size-5",
995
- trailingIcon: "size-5"
996
- },
997
- xl: {
998
- base: "px-3 py-2 text-base gap-2",
999
- leading: "pl-3",
1000
- trailing: "pr-3",
1001
- leadingIcon: "size-6",
1002
- trailingIcon: "size-6"
1003
- }
1004
- },
1005
- variant: {
1006
- outline: "text-[--ui-text-highlighted] bg-[--ui-bg] ring ring-inset ring-[--ui-border-accented]",
1007
- soft: "text-[--ui-text-highlighted] bg-[--ui-bg-elevated]/50 hover:bg-[--ui-bg-elevated] focus:bg-[--ui-bg-elevated] disabled:bg-[--ui-bg-elevated]/50",
1008
- subtle: "text-[--ui-text-highlighted] bg-[--ui-bg-elevated] ring ring-inset ring-[--ui-border-accented]",
1009
- ghost: "text-[--ui-text-highlighted] hover:bg-[--ui-bg-elevated] focus:bg-[--ui-bg-elevated] disabled:bg-transparent dark:disabled:bg-transparent",
1010
- none: "text-[--ui-text-highlighted]"
1011
- },
1012
- color: {
1013
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
1014
- neutral: ""
1015
- },
1016
- leading: {
1017
- true: ""
1018
- },
1019
- trailing: {
1020
- true: ""
1021
- },
1022
- loading: {
1023
- true: ""
1024
- },
1025
- highlight: {
1026
- true: ""
1027
- },
1028
- type: {
1029
- file: "file:mr-1.5 file:font-medium file:text-[--ui-text-muted] file:outline-none"
1030
- }
1031
- },
1032
- compoundVariants: [...(options.theme.colors || []).map((color) => ({
1033
- color,
1034
- variant: ["outline", "subtle"],
1035
- class: `focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[--ui-${color}]`
1036
- })), ...(options.theme.colors || []).map((color) => ({
1037
- color,
1038
- highlight: true,
1039
- class: `ring ring-inset ring-[--ui-${color}]`
1040
- })), {
1041
- color: "neutral",
1042
- variant: ["outline", "subtle"],
1043
- class: "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[--ui-border-inverted]"
1044
- }, {
1045
- color: "neutral",
1046
- highlight: true,
1047
- class: "ring ring-inset ring-[--ui-border-inverted]"
1048
- }, {
1049
- leading: true,
1050
- size: "xs",
1051
- class: "pl-7"
1052
- }, {
1053
- leading: true,
1054
- size: "sm",
1055
- class: "pl-8"
1056
- }, {
1057
- leading: true,
1058
- size: "md",
1059
- class: "pl-9"
1060
- }, {
1061
- leading: true,
1062
- size: "lg",
1063
- class: "pl-10"
1064
- }, {
1065
- leading: true,
1066
- size: "xl",
1067
- class: "pl-11"
1068
- }, {
1069
- trailing: true,
1070
- size: "xs",
1071
- class: "pr-7"
1072
- }, {
1073
- trailing: true,
1074
- size: "sm",
1075
- class: "pr-8"
1076
- }, {
1077
- trailing: true,
1078
- size: "md",
1079
- class: "pr-9"
1080
- }, {
1081
- trailing: true,
1082
- size: "lg",
1083
- class: "pr-10"
1084
- }, {
1085
- trailing: true,
1086
- size: "xl",
1087
- class: "pr-11"
1088
- }, {
1089
- loading: true,
1090
- leading: true,
1091
- class: {
1092
- leadingIcon: "animate-spin"
1093
- }
1094
- }, {
1095
- loading: true,
1096
- leading: false,
1097
- trailing: true,
1098
- class: {
1099
- trailingIcon: "animate-spin"
1100
- }
1101
- }],
1102
- defaultVariants: {
1103
- size: "md",
1104
- color: "primary",
1105
- variant: "outline"
1106
- }
1107
- });
1108
-
1109
- const inputMenu = (options) => {
1110
- return defuFn({
1111
- slots: {
1112
- base: () => ["rounded-[calc(var(--ui-radius)*1.5)]", options.theme.transitions && "transition-colors"],
1113
- trailing: "group absolute inset-y-0 end-0 flex items-center disabled:cursor-not-allowed disabled:opacity-75",
1114
- arrow: "fill-[--ui-border]",
1115
- content: "max-h-60 w-[--radix-popper-anchor-width] bg-[--ui-bg] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[--ui-border] overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
1116
- viewport: "divide-y divide-[--ui-border] scroll-py-1",
1117
- group: "p-1 isolate",
1118
- empty: "py-2 text-center text-sm text-[--ui-text-muted]",
1119
- label: "font-semibold text-[--ui-text-highlighted]",
1120
- separator: "-mx-1 my-1 h-px bg-[--ui-border]",
1121
- item: ["group relative w-full flex items-center gap-1.5 p-1.5 text-sm select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75 text-[--ui-text] data-highlighted:text-[--ui-text-highlighted] data-highlighted:before:bg-[--ui-bg-elevated]/50", options.theme.transitions && "transition-colors before:transition-colors"],
1122
- itemLeadingIcon: ["shrink-0 text-[--ui-text-dimmed] group-data-highlighted:text-[--ui-text]", options.theme.transitions && "transition-colors"],
1123
- itemLeadingAvatar: "shrink-0",
1124
- itemLeadingAvatarSize: "",
1125
- itemLeadingChip: "shrink-0",
1126
- itemLeadingChipSize: "",
1127
- itemTrailing: "ms-auto inline-flex gap-1.5 items-center",
1128
- itemTrailingIcon: "shrink-0",
1129
- itemLabel: "truncate",
1130
- tagsItem: "px-1.5 py-0.5 rounded-[--ui-radius] font-medium inline-flex items-center gap-0.5 ring ring-inset ring-[--ui-border-accented] bg-[--ui-bg-elevated] text-[--ui-text] data-disabled:cursor-not-allowed data-disabled:opacity-75",
1131
- tagsItemText: "truncate",
1132
- tagsItemDelete: ["inline-flex items-center rounded-[calc(var(--ui-radius)/2)] text-[--ui-text-dimmed] hover:text-[--ui-text] hover:bg-[--ui-bg-accented]/75 disabled:pointer-events-none", options.theme.transitions && "transition-colors"],
1133
- tagsItemDeleteIcon: "",
1134
- tagsInput: "border-0 placeholder-[--ui-text-dimmed] focus:outline-none disabled:cursor-not-allowed disabled:opacity-75"
1135
- },
1136
- variants: {
1137
- multiple: {
1138
- true: {
1139
- root: "flex-wrap",
1140
- base: ""
1141
- },
1142
- false: {
1143
- base: "w-full rounded-[calc(var(--ui-radius)*1.5)] border-0 focus:outline-none disabled:cursor-not-allowed disabled:opacity-75"
1144
- }
1145
- },
1146
- size: {
1147
- xs: {
1148
- label: "p-1 text-[10px]/3 gap-1",
1149
- item: "p-1 text-xs gap-1",
1150
- itemLeadingIcon: "size-4",
1151
- itemLeadingAvatarSize: "3xs",
1152
- itemLeadingChip: "size-4",
1153
- itemLeadingChipSize: "sm",
1154
- itemTrailingIcon: "size-4",
1155
- tagsItem: "text-[10px]/3",
1156
- tagsItemDeleteIcon: "size-3"
1157
- },
1158
- sm: {
1159
- label: "p-1.5 text-[10px]/3 gap-1.5",
1160
- item: "p-1.5 text-xs gap-1.5",
1161
- itemLeadingIcon: "size-4",
1162
- itemLeadingAvatarSize: "3xs",
1163
- itemLeadingChip: "size-4",
1164
- itemLeadingChipSize: "sm",
1165
- itemTrailingIcon: "size-4",
1166
- tagsItem: "text-[10px]/3",
1167
- tagsItemDeleteIcon: "size-3"
1168
- },
1169
- md: {
1170
- label: "p-1.5 text-xs gap-1.5",
1171
- item: "p-1.5 text-sm gap-1.5",
1172
- itemLeadingIcon: "size-5",
1173
- itemLeadingAvatarSize: "2xs",
1174
- itemLeadingChip: "size-5",
1175
- itemLeadingChipSize: "md",
1176
- itemTrailingIcon: "size-5",
1177
- tagsItem: "text-xs",
1178
- tagsItemDeleteIcon: "size-3.5"
1179
- },
1180
- lg: {
1181
- label: "p-2 text-xs gap-2",
1182
- item: "p-2 text-sm gap-2",
1183
- itemLeadingIcon: "size-5",
1184
- itemLeadingAvatarSize: "2xs",
1185
- itemLeadingChip: "size-5",
1186
- itemLeadingChipSize: "md",
1187
- itemTrailingIcon: "size-5",
1188
- tagsItem: "text-xs",
1189
- tagsItemDeleteIcon: "size-3.5"
1190
- },
1191
- xl: {
1192
- label: "p-2 text-sm gap-2",
1193
- item: "p-2 text-base gap-2",
1194
- itemLeadingIcon: "size-6",
1195
- itemLeadingAvatarSize: "xs",
1196
- itemLeadingChip: "size-6",
1197
- itemLeadingChipSize: "lg",
1198
- itemTrailingIcon: "size-6",
1199
- tagsItem: "text-sm",
1200
- tagsItemDeleteIcon: "size-4"
12
+ const devtoolsComponentMeta = {};
13
+ function extractDevtoolsMeta(code) {
14
+ const match = code.match(/extendDevtoolsMeta(?:<.*?>)?\(/);
15
+ if (!match)
16
+ return null;
17
+ const startIndex = code.indexOf(match[0]) + match[0].length;
18
+ let openBraceCount = 0;
19
+ let closeBraceCount = 0;
20
+ let endIndex = startIndex;
21
+ for (let i = startIndex; i < code.length; i++) {
22
+ if (code[i] === "{")
23
+ openBraceCount++;
24
+ if (code[i] === "}")
25
+ closeBraceCount++;
26
+ if (openBraceCount > 0 && openBraceCount === closeBraceCount) {
27
+ endIndex = i + 1;
28
+ break;
29
+ }
30
+ }
31
+ return code.slice(startIndex, endIndex).trim();
32
+ }
33
+ function devtoolsMetaPlugin({ resolve, options, templates }) {
34
+ return {
35
+ name: "ui-devtools-component-meta",
36
+ enforce: "pre",
37
+ async transform(code, id) {
38
+ if (!id.match(/\/runtime\/components\/\w+.vue/))
39
+ return;
40
+ const fileName = id.split("/")[id.split("/").length - 1];
41
+ if (code && fileName) {
42
+ const slug = kebabCase(fileName.replace(/\..*/, ""));
43
+ const match = extractDevtoolsMeta(code);
44
+ if (match) {
45
+ const metaObject = new Function(`return ${match}`)();
46
+ devtoolsComponentMeta[slug] = { meta: { devtools: { ...metaObject } } };
1201
47
  }
1202
48
  }
1203
- },
1204
- compoundVariants: [...(options.theme.colors || []).map((color) => ({
1205
- color,
1206
- multiple: true,
1207
- variant: ["outline", "subtle"],
1208
- class: `has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-[--${color}]`
1209
- })), {
1210
- color: "neutral",
1211
- multiple: true,
1212
- variant: ["outline", "subtle"],
1213
- class: "has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-[--ui-border-inverted]"
1214
- }]
1215
- }, input(options));
1216
- };
1217
-
1218
- const kbd = {
1219
- base: "inline-flex items-center justify-center px-1 rounded-[--ui-radius] font-medium font-sans",
1220
- variants: {
1221
- variant: {
1222
- solid: "bg-[--ui-bg-inverted] text-[--ui-bg]",
1223
- outline: "bg-[--ui-bg] text-[--ui-text-highlighted] ring ring-inset ring-[--ui-border-accented]",
1224
- subtle: "bg-[--ui-bg-elevated] text-[--ui-text] ring ring-inset ring-[--ui-border-accented]"
1225
- },
1226
- size: {
1227
- sm: "h-4 min-w-[16px] text-[10px]",
1228
- md: "h-5 min-w-[20px] text-[11px]",
1229
- lg: "h-6 min-w-[24px] text-[12px]"
1230
- }
1231
- },
1232
- defaultVariants: {
1233
- variant: "outline",
1234
- size: "md"
1235
- }
1236
- };
1237
-
1238
- const link = (options) => ({
1239
- base: "focus-visible:outline-[--ui-primary]",
1240
- variants: {
1241
- active: {
1242
- true: "text-[--ui-primary]",
1243
- false: ["text-[--ui-text-muted] hover:text-[--ui-text]", options.theme.transitions && "transition-colors"]
1244
- },
1245
- disabled: {
1246
- true: "cursor-not-allowed opacity-75"
1247
- }
1248
- }
1249
- });
1250
-
1251
- const modal = {
1252
- slots: {
1253
- overlay: "fixed inset-0 z-50 bg-[--ui-bg-elevated]/75",
1254
- content: "fixed z-50 w-full h-dvh bg-[--ui-bg] divide-y divide-[--ui-border] flex flex-col focus:outline-none",
1255
- header: "px-4 py-5 sm:px-6",
1256
- body: "flex-1 p-4 sm:p-6",
1257
- footer: "flex items-center gap-1.5 p-4 sm:px-6",
1258
- title: "text-[--ui-text-highlighted] font-semibold",
1259
- description: "mt-1 text-[--ui-text-muted] text-sm",
1260
- close: "absolute top-4 right-4"
1261
- },
1262
- variants: {
1263
- transition: {
1264
- true: {
1265
- overlay: "data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]",
1266
- content: "data-[state=open]:animate-[scale-in_200ms_ease-out] data-[state=closed]:animate-[scale-out_200ms_ease-in]"
1267
- }
1268
- },
1269
- fullscreen: {
1270
- true: {
1271
- content: "inset-0"
1272
- },
1273
- false: {
1274
- content: "top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] sm:max-w-lg sm:h-auto sm:my-8 sm:rounded-[calc(var(--ui-radius)*2)] sm:shadow-lg sm:ring ring-[--ui-border]"
1275
- }
1276
- }
1277
- }
1278
- };
1279
-
1280
- const navigationMenu = (options) => ({
1281
- slots: {
1282
- root: "relative flex gap-1.5",
1283
- list: "isolate min-w-0",
1284
- item: "min-w-0",
1285
- link: "group relative w-full flex items-center gap-1.5 font-medium text-sm before:absolute before:z-[-1] before:rounded-[calc(var(--ui-radius)*1.5)] focus:outline-none focus-visible:outline-none dark:focus-visible:outline-none focus-visible:before:ring-inset focus-visible:before:ring-2",
1286
- linkLeadingIcon: "shrink-0 size-5",
1287
- linkLeadingAvatar: "shrink-0",
1288
- linkLeadingAvatarSize: "2xs",
1289
- linkTrailing: "ms-auto inline-flex",
1290
- linkTrailingBadge: "shrink-0 rounded",
1291
- linkTrailingBadgeSize: "sm",
1292
- linkTrailingIcon: "size-5 transform shrink-0 group-data-[state=open]:rotate-180 transition-transform duration-200",
1293
- linkLabel: "truncate",
1294
- linkLabelExternalIcon: "size-3 align-top text-[--ui-text-dimmed]",
1295
- childList: "grid grid-cols-2 gap-2 p-2",
1296
- childItem: "",
1297
- childLink: "group size-full px-3 py-2 rounded-[calc(var(--ui-radius)*1.5)] flex items-start gap-2 text-left",
1298
- childLinkWrapper: "flex flex-col items-start",
1299
- childLinkIcon: "size-5 shrink-0",
1300
- childLinkLabel: "font-semibold text-sm relative inline-flex",
1301
- childLinkLabelExternalIcon: "size-3 align-top text-[--ui-text-dimmed]",
1302
- childLinkDescription: "text-sm text-[--ui-text-muted]",
1303
- separator: "px-2 h-px bg-[--ui-border]",
1304
- viewportWrapper: "absolute top-full inset-x-0 flex w-full",
1305
- // FIXME: add `sm:w-[var(--radix-navigation-menu-viewport-width)]` / `transition-[width,height]` / `origin-[top_center]` once position is based on trigger
1306
- viewport: "relative overflow-hidden bg-[--ui-bg] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[--ui-border] h-[--radix-navigation-menu-viewport-height] w-full data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
1307
- content: "absolute top-0 left-0 w-full data-[motion=from-start]:animate-[enter-from-left_200ms_ease] data-[motion=from-end]:animate-[enter-from-right_200ms_ease] data-[motion=to-start]:animate-[exit-to-left_200ms_ease] data-[motion=to-end]:animate-[exit-to-right_200ms_ease]",
1308
- indicator: "data-[state=visible]:animate-[fade-in_100ms_ease-out] data-[state=hidden]:animate-[fade-out_100ms_ease-in] bottom-0 z-[1] flex h-2.5 items-end justify-center overflow-hidden transition-transform duration-200 ease-out",
1309
- arrow: "relative top-[50%] size-2.5 rotate-45 border border-[--ui-border] bg-[--ui-bg] z-[1] rounded-[calc(var(--ui-radius)/2)]"
1310
- },
1311
- variants: {
1312
- color: {
1313
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
1314
- link: `focus-visible:before:ring-[--ui-${color}]`,
1315
- childLink: `focus-visible:outline-[--ui-${color}]`
1316
- }])),
1317
- neutral: {
1318
- link: "focus-visible:before:ring-[--ui-border-inverted]",
1319
- childLink: "focus-visible:outline-[--ui-border-inverted]"
1320
- }
1321
- },
1322
- highlightColor: {
1323
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
1324
- neutral: ""
1325
- },
1326
- variant: {
1327
- pill: "",
1328
- link: ""
1329
- },
1330
- orientation: {
1331
- horizontal: {
1332
- root: "w-full items-center justify-between",
1333
- list: "flex items-center",
1334
- item: "py-2",
1335
- link: "px-2.5 py-1.5 before:inset-x-px before:inset-y-0"
1336
- },
1337
- vertical: {
1338
- root: "flex-col",
1339
- link: "px-2.5 py-1.5 before:inset-y-px before:inset-x-0"
1340
- }
1341
- },
1342
- active: {
1343
- true: {
1344
- childLink: "bg-[--ui-bg-elevated] text-[--ui-text-highlighted]",
1345
- childLinkIcon: "text-[--ui-text]"
1346
- },
1347
- false: {
1348
- link: "text-[--ui-text-muted]",
1349
- linkLeadingIcon: "text-[--ui-text-dimmed]",
1350
- childLink: ["hover:bg-[--ui-bg-elevated]/50 text-[--ui-text] hover:text-[--ui-text-highlighted]", options.theme.transitions && "transition-colors"],
1351
- childLinkIcon: ["text-[--ui-text-dimmed] group-hover:text-[--ui-text]", options.theme.transitions && "transition-colors"]
1352
- }
1353
- },
1354
- disabled: {
1355
- true: {
1356
- link: "cursor-not-allowed opacity-75"
1357
- }
1358
- },
1359
- highlight: {
1360
- true: ""
1361
- }
1362
- },
1363
- compoundVariants: [{
1364
- highlight: true,
1365
- orientation: "horizontal",
1366
- class: {
1367
- item: "-mb-px",
1368
- link: "after:absolute after:-bottom-2 after:inset-x-2.5 after:block after:h-px after:rounded-full"
1369
- }
1370
- }, {
1371
- highlight: true,
1372
- orientation: "vertical",
1373
- class: {
1374
- item: "px-1.5 -ml-px",
1375
- link: "after:absolute after:-left-1.5 after:inset-y-0.5 after:block after:w-px after:rounded-full"
1376
- }
1377
- }, {
1378
- disabled: false,
1379
- active: false,
1380
- variant: "pill",
1381
- class: {
1382
- link: ["hover:text-[--ui-text-highlighted] hover:before:bg-[--ui-bg-elevated]/50 data-[state=open]:text-[--ui-text-highlighted] data-[state=open]:before:bg-[--ui-bg-elevated]/50", options.theme.transitions && "transition-colors before:transition-colors"],
1383
- linkLeadingIcon: ["group-hover:text-[--ui-text] group-data-[state=open]:text-[--ui-text]", options.theme.transitions && "transition-colors"]
1384
- }
1385
- }, ...(options.theme.colors || []).map((color) => ({
1386
- color,
1387
- variant: "pill",
1388
- active: true,
1389
- class: {
1390
- link: `text-[--ui-${color}]`,
1391
- linkLeadingIcon: `text-[--ui-${color}]`
1392
- }
1393
- })), {
1394
- color: "neutral",
1395
- variant: "pill",
1396
- active: true,
1397
- class: {
1398
- link: "text-[--ui-text-highlighted]",
1399
- linkLeadingIcon: "text-[--ui-text-highlighted]"
1400
- }
1401
- }, {
1402
- variant: "pill",
1403
- active: true,
1404
- highlight: false,
1405
- class: {
1406
- link: "before:bg-[--ui-bg-elevated]"
1407
- }
1408
- }, {
1409
- variant: "pill",
1410
- active: true,
1411
- highlight: true,
1412
- class: {
1413
- link: ["hover:before:bg-[--ui-bg-elevated]/50", options.theme.transitions && "before:transition-colors"]
1414
- }
1415
- }, {
1416
- disabled: false,
1417
- active: false,
1418
- variant: "link",
1419
- class: {
1420
- link: ["hover:text-[--ui-text-highlighted] data-[state=open]:text-[--ui-text-highlighted]", options.theme.transitions && "transition-colors"],
1421
- linkLeadingIcon: ["group-hover:text-[--ui-text] group-data-[state=open]:text-[--ui-text]", options.theme.transitions && "transition-colors"]
1422
- }
1423
- }, ...(options.theme.colors || []).map((color) => ({
1424
- color,
1425
- variant: "link",
1426
- active: true,
1427
- class: {
1428
- link: `text-[--ui-${color}]`,
1429
- linkLeadingIcon: `text-[--ui-${color}]`
1430
- }
1431
- })), {
1432
- color: "neutral",
1433
- variant: "link",
1434
- active: true,
1435
- class: {
1436
- link: "text-[--ui-text-highlighted]",
1437
- linkLeadingIcon: "text-[--ui-text-highlighted]"
1438
- }
1439
- }, ...(options.theme.colors || []).map((highlightColor) => ({
1440
- highlightColor,
1441
- highlight: true,
1442
- active: true,
1443
- class: {
1444
- link: `after:bg-[--ui-${highlightColor}]`
1445
- }
1446
- })), {
1447
- highlightColor: "neutral",
1448
- highlight: true,
1449
- active: true,
1450
- class: {
1451
- link: "after:bg-[--ui-bg-inverted]"
1452
- }
1453
- }],
1454
- defaultVariants: {
1455
- color: "primary",
1456
- highlightColor: "primary",
1457
- variant: "pill"
1458
- }
1459
- });
1460
-
1461
- const pagination = {
1462
- slots: {
1463
- root: "",
1464
- list: "flex items-center gap-1",
1465
- ellipsis: "pointer-events-none",
1466
- label: "min-w-5 text-center"
1467
- }
1468
- };
1469
-
1470
- const popover = {
1471
- slots: {
1472
- content: "bg-[--ui-bg] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[--ui-border] data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] focus:outline-none",
1473
- arrow: "fill-[--ui-border]"
1474
- }
1475
- };
1476
-
1477
- const progress = (options) => ({
1478
- slots: {
1479
- root: "gap-2",
1480
- base: "relative overflow-hidden rounded-full bg-[--ui-bg-accented]",
1481
- indicator: "rounded-full size-full transition-transform duration-200 ease-out",
1482
- status: "flex justify-end text-[--ui-text-dimmed] transition-[width] duration-200",
1483
- steps: "grid items-end",
1484
- step: "truncate text-end row-start-1 col-start-1 transition-opacity"
1485
- },
1486
- variants: {
1487
- animation: {
1488
- "carousel": "",
1489
- "carousel-inverse": "",
1490
- "swing": "",
1491
- "elastic": ""
1492
- },
1493
- color: {
1494
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
1495
- indicator: `bg-[--ui-${color}]`,
1496
- steps: `text-[--ui-${color}]`
1497
- }])),
1498
- neutral: {
1499
- indicator: "bg-[--ui-bg-inverted]",
1500
- steps: "text-[--ui-bg]"
1501
- }
1502
- },
1503
- size: {
1504
- "2xs": {
1505
- status: "text-xs",
1506
- steps: "text-xs"
1507
- },
1508
- "xs": {
1509
- status: "text-xs",
1510
- steps: "text-xs"
1511
- },
1512
- "sm": {
1513
- status: "text-sm",
1514
- steps: "text-sm"
1515
- },
1516
- "md": {
1517
- status: "text-sm",
1518
- steps: "text-sm"
1519
- },
1520
- "lg": {
1521
- status: "text-sm",
1522
- steps: "text-sm"
1523
- },
1524
- "xl": {
1525
- status: "text-base",
1526
- steps: "text-base"
1527
- },
1528
- "2xl": {
1529
- status: "text-base",
1530
- steps: "text-base"
1531
- }
1532
- },
1533
- step: {
1534
- active: {
1535
- step: "opacity-100"
1536
- },
1537
- first: {
1538
- step: "opacity-100 text-[--ui-text-muted]"
1539
- },
1540
- other: {
1541
- step: "opacity-0"
1542
- },
1543
- last: {
1544
- step: ""
1545
- }
1546
- },
1547
- orientation: {
1548
- horizontal: {
1549
- root: "w-full flex flex-col",
1550
- base: "w-full",
1551
- status: "flex-row"
1552
- },
1553
- vertical: {
1554
- root: "h-full flex flex-row-reverse",
1555
- base: "h-full",
1556
- status: "flex-col"
1557
- }
1558
- },
1559
- inverted: {
1560
- true: {
1561
- status: "self-end"
1562
- }
1563
- }
1564
- },
1565
- compoundVariants: [{
1566
- inverted: true,
1567
- orientation: "horizontal",
1568
- class: {
1569
- step: "text-start",
1570
- status: "flex-row-reverse"
1571
- }
1572
- }, {
1573
- inverted: true,
1574
- orientation: "vertical",
1575
- class: {
1576
- steps: "items-start",
1577
- status: "flex-col-reverse"
1578
- }
1579
- }, {
1580
- orientation: "horizontal",
1581
- size: "2xs",
1582
- class: "h-px"
1583
- }, {
1584
- orientation: "horizontal",
1585
- size: "xs",
1586
- class: "h-0.5"
1587
- }, {
1588
- orientation: "horizontal",
1589
- size: "sm",
1590
- class: "h-1"
1591
- }, {
1592
- orientation: "horizontal",
1593
- size: "md",
1594
- class: "h-2"
1595
- }, {
1596
- orientation: "horizontal",
1597
- size: "lg",
1598
- class: "h-3"
1599
- }, {
1600
- orientation: "horizontal",
1601
- size: "xl",
1602
- class: "h-4"
1603
- }, {
1604
- orientation: "horizontal",
1605
- size: "2xl",
1606
- class: "h-5"
1607
- }, {
1608
- orientation: "vertical",
1609
- size: "2xs",
1610
- class: "w-px"
1611
- }, {
1612
- orientation: "vertical",
1613
- size: "xs",
1614
- class: "w-0.5"
1615
- }, {
1616
- orientation: "vertical",
1617
- size: "sm",
1618
- class: "w-1"
1619
- }, {
1620
- orientation: "vertical",
1621
- size: "md",
1622
- class: "w-2"
1623
- }, {
1624
- orientation: "vertical",
1625
- size: "lg",
1626
- class: "w-3"
1627
- }, {
1628
- orientation: "vertical",
1629
- size: "xl",
1630
- class: "w-4"
1631
- }, {
1632
- orientation: "vertical",
1633
- size: "2xl",
1634
- class: "w-5"
1635
- }, {
1636
- orientation: "horizontal",
1637
- animation: "carousel",
1638
- class: {
1639
- indicator: "data-[state=indeterminate]:animate-[carousel_2s_ease-in-out_infinite]"
1640
- }
1641
- }, {
1642
- orientation: "vertical",
1643
- animation: "carousel",
1644
- class: {
1645
- indicator: "data-[state=indeterminate]:animate-[carousel-vertical_2s_ease-in-out_infinite]"
1646
- }
1647
- }, {
1648
- orientation: "horizontal",
1649
- animation: "carousel-inverse",
1650
- class: {
1651
- indicator: "data-[state=indeterminate]:animate-[carousel-inverse_2s_ease-in-out_infinite]"
1652
- }
1653
- }, {
1654
- orientation: "vertical",
1655
- animation: "carousel-inverse",
1656
- class: {
1657
- indicator: "data-[state=indeterminate]:animate-[carousel-inverse-vertical_2s_ease-in-out_infinite]"
1658
- }
1659
- }, {
1660
- orientation: "horizontal",
1661
- animation: "swing",
1662
- class: {
1663
- indicator: "data-[state=indeterminate]:animate-[swing_2s_ease-in-out_infinite]"
1664
- }
1665
- }, {
1666
- orientation: "vertical",
1667
- animation: "swing",
1668
- class: {
1669
- indicator: "data-[state=indeterminate]:animate-[swing-vertical_2s_ease-in-out_infinite]"
1670
- }
1671
- }, {
1672
- orientation: "horizontal",
1673
- animation: "elastic",
1674
- class: {
1675
- indicator: "data-[state=indeterminate]:animate-[elastic_2s_ease-in-out_infinite]"
1676
- }
1677
- }, {
1678
- orientation: "vertical",
1679
- animation: "elastic",
1680
- class: {
1681
- indicator: "data-[state=indeterminate]:animate-[elastic-vertical_2s_ease-in-out_infinite]"
1682
- }
1683
- }],
1684
- defaultVariants: {
1685
- animation: "carousel",
1686
- color: "primary",
1687
- size: "md"
1688
- }
1689
- });
1690
-
1691
- const radioGroup = (options) => ({
1692
- slots: {
1693
- root: "relative",
1694
- fieldset: "flex",
1695
- legend: "mb-1 block font-medium text-[--ui-text]",
1696
- item: "flex items-start",
1697
- base: "rounded-full ring ring-inset ring-[--ui-border-accented] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-offset-[--ui-bg]",
1698
- indicator: "flex items-center justify-center size-full rounded-full after:bg-[--ui-bg] after:rounded-full",
1699
- container: "flex items-center",
1700
- wrapper: "ms-2",
1701
- label: "block font-medium text-[--ui-text]",
1702
- description: "text-[--ui-text-muted]"
1703
- },
1704
- variants: {
1705
- color: {
1706
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
1707
- base: `focus-visible:outline-[--ui-${color}]`,
1708
- indicator: `bg-[--ui-${color}]`
1709
- }])),
1710
- neutral: {
1711
- base: "focus-visible:outline-[--ui-border-inverted]",
1712
- indicator: "bg-[--ui-bg-inverted]"
1713
- }
1714
- },
1715
- orientation: {
1716
- horizontal: {
1717
- fieldset: "flex-row",
1718
- wrapper: "me-2"
1719
- },
1720
- vertical: {
1721
- fieldset: "flex-col"
1722
- }
1723
- },
1724
- size: {
1725
- xs: {
1726
- fieldset: "gap-0.5",
1727
- legend: "text-xs",
1728
- base: "size-3",
1729
- item: "text-xs",
1730
- container: "h-4",
1731
- indicator: "after:size-1"
1732
- },
1733
- sm: {
1734
- fieldset: "gap-0.5",
1735
- legend: "text-xs",
1736
- base: "size-3.5",
1737
- item: "text-xs",
1738
- container: "h-4",
1739
- indicator: "after:size-1"
1740
- },
1741
- md: {
1742
- fieldset: "gap-1",
1743
- legend: "text-sm",
1744
- base: "size-4",
1745
- item: "text-sm",
1746
- container: "h-5",
1747
- indicator: "after:size-1.5"
1748
- },
1749
- lg: {
1750
- fieldset: "gap-1",
1751
- legend: "text-sm",
1752
- base: "size-4.5",
1753
- item: "text-sm",
1754
- container: "h-5",
1755
- indicator: "after:size-1.5"
1756
- },
1757
- xl: {
1758
- fieldset: "gap-1.5",
1759
- legend: "text-base",
1760
- base: "size-5",
1761
- item: "text-base",
1762
- container: "h-6",
1763
- indicator: "after:size-2"
1764
- }
1765
- },
1766
- disabled: {
1767
- true: {
1768
- base: "cursor-not-allowed opacity-75",
1769
- label: "cursor-not-allowed opacity-75"
1770
- }
1771
- },
1772
- required: {
1773
- true: {
1774
- legend: "after:content-['*'] after:ms-0.5 after:text-[--ui-error]"
1775
- }
1776
- }
1777
- },
1778
- defaultVariants: {
1779
- size: "md",
1780
- color: "primary"
1781
- }
1782
- });
1783
-
1784
- const select = (options) => {
1785
- return defuFn({
1786
- slots: {
1787
- root: () => void 0,
1788
- base: () => ["relative group rounded-[calc(var(--ui-radius)*1.5)] inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75", options.theme.transitions && "transition-colors"],
1789
- value: "truncate group-data-placeholder:text-current/50",
1790
- arrow: "fill-[--ui-border]",
1791
- content: "max-h-60 w-[--radix-popper-anchor-width] bg-[--ui-bg] shadow-lg rounded-[calc(var(--ui-radius)*1.5)] ring ring-[--ui-border] overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
1792
- viewport: "divide-y divide-[--ui-border] scroll-py-1",
1793
- group: "p-1 isolate",
1794
- empty: "py-2 text-center text-sm text-[--ui-text-muted]",
1795
- label: "font-semibold text-[--ui-text-highlighted]",
1796
- separator: "-mx-1 my-1 h-px bg-[--ui-border]",
1797
- item: ["group relative w-full flex items-center select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-[calc(var(--ui-radius)*1.5)] data-disabled:cursor-not-allowed data-disabled:opacity-75 text-[--ui-text] data-highlighted:text-[--ui-text-highlighted] data-highlighted:before:bg-[--ui-bg-elevated]/50", options.theme.transitions && "transition-colors before:transition-colors"],
1798
- itemLeadingIcon: ["shrink-0 text-[--ui-text-dimmed] group-data-highlighted:text-[--ui-text]", options.theme.transitions && "transition-colors"],
1799
- itemLeadingAvatar: "shrink-0",
1800
- itemLeadingAvatarSize: "",
1801
- itemLeadingChip: "shrink-0",
1802
- itemLeadingChipSize: "",
1803
- itemTrailing: "ms-auto inline-flex gap-1.5 items-center",
1804
- itemTrailingIcon: "shrink-0",
1805
- itemLabel: "truncate"
1806
- },
1807
- variants: {
1808
- ...buttonGroupVariant,
1809
- size: {
1810
- xs: {
1811
- label: "p-1 text-[10px]/3 gap-1",
1812
- item: "p-1 text-xs gap-1",
1813
- itemLeadingIcon: "size-4",
1814
- itemLeadingAvatarSize: "3xs",
1815
- itemLeadingChip: "size-4",
1816
- itemLeadingChipSize: "sm",
1817
- itemTrailingIcon: "size-4"
1818
- },
1819
- sm: {
1820
- label: "p-1.5 text-[10px]/3 gap-1.5",
1821
- item: "p-1.5 text-xs gap-1.5",
1822
- itemLeadingIcon: "size-4",
1823
- itemLeadingAvatarSize: "3xs",
1824
- itemLeadingChip: "size-4",
1825
- itemLeadingChipSize: "sm",
1826
- itemTrailingIcon: "size-4"
1827
- },
1828
- md: {
1829
- label: "p-1.5 text-xs gap-1.5",
1830
- item: "p-1.5 text-sm gap-1.5",
1831
- itemLeadingIcon: "size-5",
1832
- itemLeadingAvatarSize: "2xs",
1833
- itemLeadingChip: "size-5",
1834
- itemLeadingChipSize: "md",
1835
- itemTrailingIcon: "size-5"
1836
- },
1837
- lg: {
1838
- label: "p-2 text-xs gap-2",
1839
- item: "p-2 text-sm gap-2",
1840
- itemLeadingIcon: "size-5",
1841
- itemLeadingAvatarSize: "2xs",
1842
- itemLeadingChip: "size-5",
1843
- itemLeadingChipSize: "md",
1844
- itemTrailingIcon: "size-5"
1845
- },
1846
- xl: {
1847
- label: "p-2 text-sm gap-2",
1848
- item: "p-2 text-base gap-2",
1849
- itemLeadingIcon: "size-6",
1850
- itemLeadingAvatarSize: "xs",
1851
- itemLeadingChip: "size-6",
1852
- itemLeadingChipSize: "lg",
1853
- itemTrailingIcon: "size-6"
49
+ return {
50
+ code
51
+ };
52
+ },
53
+ configureServer(server) {
54
+ server.middlewares.use("/__nuxt_ui__/devtools/api/component-meta", async (_req, res) => {
55
+ res.setHeader("Content-Type", "application/json");
56
+ try {
57
+ const componentMeta = await import('./chunks/component-meta.mjs');
58
+ const meta = defu(
59
+ Object.entries(componentMeta.default).reduce((acc, [key, value]) => {
60
+ if (!key.startsWith("U"))
61
+ return acc;
62
+ const name = key.substring(1);
63
+ const slug = kebabCase(name);
64
+ const template = templates?.[camelCase(name)];
65
+ if (devtoolsComponentMeta[slug] === void 0) {
66
+ const path = resolve(`./runtime/components/${name}.vue`);
67
+ const code = fs.readFileSync(path, "utf-8");
68
+ const match = extractDevtoolsMeta(code);
69
+ if (match) {
70
+ const metaObject = new Function(`return ${match}`)();
71
+ devtoolsComponentMeta[slug] = { meta: { devtools: { ...metaObject } } };
72
+ } else {
73
+ devtoolsComponentMeta[slug] = null;
74
+ }
75
+ }
76
+ value.meta.props = value.meta.props.map((prop) => {
77
+ let defaultValue = prop.default ? prop.default : prop?.tags?.find((tag) => tag.name === "defaultValue" && !tag.text?.includes("appConfig"))?.text ?? template?.defaultVariants?.[prop.name];
78
+ if (typeof defaultValue === "string")
79
+ defaultValue = defaultValue?.replaceAll(/["'`]/g, "");
80
+ if (defaultValue === "true")
81
+ defaultValue = true;
82
+ if (defaultValue === "false")
83
+ defaultValue = false;
84
+ if (!Number.isNaN(Number.parseInt(defaultValue)))
85
+ defaultValue = Number.parseInt(defaultValue);
86
+ return {
87
+ ...prop,
88
+ default: defaultValue
89
+ };
90
+ });
91
+ const label = key.replace(/^U/, options.prefix ?? "U");
92
+ acc[kebabCase(key.replace(/^U/, ""))] = { ...value, label, slug };
93
+ return acc;
94
+ }, {}),
95
+ devtoolsComponentMeta
96
+ );
97
+ res.end(JSON.stringify(meta));
98
+ } catch (error) {
99
+ console.error(`Failed to fetch component meta`, error);
100
+ res.statusCode = 500;
101
+ res.end(JSON.stringify({ error: "Failed to fetch component meta" }));
1854
102
  }
1855
- }
1856
- }
1857
- }, input(options));
1858
- };
1859
-
1860
- const selectMenu = (options) => {
1861
- return defu({
1862
- slots: {
1863
- value: "truncate",
1864
- placeholder: "truncate text-current/50",
1865
- input: "placeholder-[--ui-text-dimmed] border-0 border-b border-[--ui-border] focus:outline-none"
1866
- },
1867
- variants: {
1868
- size: {
1869
- xs: {
1870
- input: "text-xs px-2 py-1"
1871
- },
1872
- sm: {
1873
- input: "text-xs px-2.5 py-1.5"
1874
- },
1875
- md: {
1876
- input: "text-sm px-2.5 py-1.5"
1877
- },
1878
- lg: {
1879
- input: "text-sm px-3 py-2"
1880
- },
1881
- xl: {
1882
- input: "text-base px-3 py-2"
103
+ });
104
+ server.middlewares.use("/__nuxt_ui__/devtools/api/component-example", async (req, res) => {
105
+ const query = new URL(req.url, "http://localhost").searchParams;
106
+ const name = query.get("component");
107
+ if (!name) {
108
+ res.statusCode = 400;
109
+ res.end(JSON.stringify({ error: "Component name is required" }));
110
+ return;
1883
111
  }
1884
- }
1885
- }
1886
- }, select(options));
1887
- };
1888
-
1889
- const separator = (options) => ({
1890
- slots: {
1891
- root: "flex items-center align-center text-center",
1892
- border: "",
1893
- container: "font-medium text-[--ui-text] flex",
1894
- icon: "shrink-0 size-5",
1895
- avatar: "shrink-0",
1896
- avatarSize: "2xs",
1897
- label: "text-sm"
1898
- },
1899
- variants: {
1900
- color: {
1901
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, { border: `border-[--ui-${color}]` }])),
1902
- neutral: { border: "border-[--ui-border]" }
1903
- },
1904
- orientation: {
1905
- horizontal: {
1906
- root: "w-full flex-row",
1907
- border: "w-full",
1908
- container: "mx-3 whitespace-nowrap"
1909
- },
1910
- vertical: {
1911
- root: "h-full flex-col",
1912
- border: "h-full",
1913
- container: "my-2"
1914
- }
1915
- },
1916
- size: {
1917
- xs: "",
1918
- sm: "",
1919
- md: "",
1920
- lg: "",
1921
- xl: ""
1922
- },
1923
- type: {
1924
- solid: {
1925
- border: "border-solid"
1926
- },
1927
- dashed: {
1928
- border: "border-dashed"
1929
- },
1930
- dotted: {
1931
- border: "border-dotted"
1932
- }
1933
- }
1934
- },
1935
- compoundVariants: [{
1936
- orientation: "horizontal",
1937
- size: "xs",
1938
- class: { border: "border-t" }
1939
- }, {
1940
- orientation: "horizontal",
1941
- size: "sm",
1942
- class: { border: "border-t-[2px]" }
1943
- }, {
1944
- orientation: "horizontal",
1945
- size: "md",
1946
- class: { border: "border-t-[3px]" }
1947
- }, {
1948
- orientation: "horizontal",
1949
- size: "lg",
1950
- class: { border: "border-t-[4px]" }
1951
- }, {
1952
- orientation: "horizontal",
1953
- size: "xl",
1954
- class: { border: "border-t-[5px]" }
1955
- }, {
1956
- orientation: "vertical",
1957
- size: "xs",
1958
- class: { border: "border-s" }
1959
- }, {
1960
- orientation: "vertical",
1961
- size: "sm",
1962
- class: { border: "border-s-[2px]" }
1963
- }, {
1964
- orientation: "vertical",
1965
- size: "md",
1966
- class: { border: "border-s-[3px]" }
1967
- }, {
1968
- orientation: "vertical",
1969
- size: "lg",
1970
- class: { border: "border-s-[4px]" }
1971
- }, {
1972
- orientation: "vertical",
1973
- size: "xl",
1974
- class: { border: "border-s-[5px]" }
1975
- }],
1976
- defaultVariants: {
1977
- color: "neutral",
1978
- size: "xs",
1979
- type: "solid"
1980
- }
1981
- });
1982
-
1983
- const skeleton = {
1984
- base: "animate-pulse rounded-[calc(var(--ui-radius)*1.5)] bg-[--ui-bg-elevated]"
1985
- };
1986
-
1987
- const slideover = {
1988
- slots: {
1989
- overlay: "fixed inset-0 z-50 bg-[--ui-bg-elevated]/75",
1990
- content: "fixed z-50 bg-[--ui-bg] divide-y divide-[--ui-border] sm:ring ring-[--ui-border] sm:shadow-lg flex flex-col focus:outline-none",
1991
- header: "px-4 py-5 sm:px-6",
1992
- body: "flex-1 overflow-y-auto p-4 sm:p-6",
1993
- footer: "flex items-center gap-1.5 p-4 sm:px-6",
1994
- title: "text-[--ui-text-highlighted] font-semibold",
1995
- description: "mt-1 text-[--ui-text-muted] text-sm",
1996
- close: "absolute top-4 right-4"
1997
- },
1998
- variants: {
1999
- side: {
2000
- top: {
2001
- content: "inset-x-0 top-0"
2002
- },
2003
- right: {
2004
- content: "right-0 inset-y-0 w-full max-w-md"
2005
- },
2006
- bottom: {
2007
- content: "inset-x-0 bottom-0"
2008
- },
2009
- left: {
2010
- content: "left-0 inset-y-0 w-full max-w-md"
2011
- }
2012
- },
2013
- transition: {
2014
- true: {
2015
- overlay: "data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]"
2016
- }
2017
- }
2018
- },
2019
- compoundVariants: [{
2020
- transition: true,
2021
- side: "top",
2022
- class: {
2023
- content: "data-[state=open]:animate-[slide-in-from-top_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-top_200ms_ease-in-out]"
2024
- }
2025
- }, {
2026
- transition: true,
2027
- side: "right",
2028
- class: {
2029
- content: "data-[state=open]:animate-[slide-in-from-right_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-right_200ms_ease-in-out]"
2030
- }
2031
- }, {
2032
- transition: true,
2033
- side: "bottom",
2034
- class: {
2035
- content: "data-[state=open]:animate-[slide-in-from-bottom_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-bottom_200ms_ease-in-out]"
2036
- }
2037
- }, {
2038
- transition: true,
2039
- side: "left",
2040
- class: {
2041
- content: "data-[state=open]:animate-[slide-in-from-left_200ms_ease-in-out] data-[state=closed]:animate-[slide-out-to-left_200ms_ease-in-out]"
2042
- }
2043
- }]
2044
- };
2045
-
2046
- const slider = (options) => ({
2047
- slots: {
2048
- root: "relative flex items-center select-none touch-none",
2049
- track: "relative bg-[--ui-bg-accented] overflow-hidden rounded-full grow",
2050
- range: "absolute rounded-full",
2051
- thumb: "rounded-full bg-[--ui-bg] ring-2 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2"
2052
- },
2053
- variants: {
2054
- color: {
2055
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
2056
- range: `bg-[--ui-${color}]`,
2057
- thumb: `ring-[--ui-${color}] focus-visible:outline-[--ui-${color}]`
2058
- }])),
2059
- neutral: {
2060
- range: "bg-[--ui-bg-inverted]",
2061
- thumb: "ring-[--ui-border-inverted] focus-visible:outline-[--ui-border-inverted]/50"
2062
- }
2063
- },
2064
- size: {
2065
- xs: {
2066
- thumb: "size-3"
2067
- },
2068
- sm: {
2069
- thumb: "size-3.5"
2070
- },
2071
- md: {
2072
- thumb: "size-4"
2073
- },
2074
- lg: {
2075
- thumb: "size-4.5"
2076
- },
2077
- xl: {
2078
- thumb: "size-5"
2079
- }
2080
- },
2081
- orientation: {
2082
- horizontal: {
2083
- root: "w-full",
2084
- range: "h-full"
2085
- },
2086
- vertical: {
2087
- root: "flex-col h-full",
2088
- range: "w-full"
2089
- }
2090
- },
2091
- disabled: {
2092
- true: {
2093
- root: "opacity-75 cursor-not-allowed"
2094
- }
2095
- }
2096
- },
2097
- compoundVariants: [{
2098
- orientation: "horizontal",
2099
- size: "xs",
2100
- class: {
2101
- track: "h-[6px]"
2102
- }
2103
- }, {
2104
- orientation: "horizontal",
2105
- size: "sm",
2106
- class: {
2107
- track: "h-[7px]"
2108
- }
2109
- }, {
2110
- orientation: "horizontal",
2111
- size: "md",
2112
- class: {
2113
- track: "h-[8px]"
2114
- }
2115
- }, {
2116
- orientation: "horizontal",
2117
- size: "lg",
2118
- class: {
2119
- track: "h-[9px]"
2120
- }
2121
- }, {
2122
- orientation: "horizontal",
2123
- size: "xl",
2124
- class: {
2125
- track: "h-[10px]"
2126
- }
2127
- }, {
2128
- orientation: "vertical",
2129
- size: "xs",
2130
- class: {
2131
- track: "w-[6px]"
2132
- }
2133
- }, {
2134
- orientation: "vertical",
2135
- size: "sm",
2136
- class: {
2137
- track: "w-[7px]"
2138
- }
2139
- }, {
2140
- orientation: "vertical",
2141
- size: "md",
2142
- class: {
2143
- track: "w-[8px]"
2144
- }
2145
- }, {
2146
- orientation: "vertical",
2147
- size: "lg",
2148
- class: {
2149
- track: "w-[9px]"
2150
- }
2151
- }, {
2152
- orientation: "vertical",
2153
- size: "xl",
2154
- class: {
2155
- track: "w-[10px]"
2156
- }
2157
- }],
2158
- defaultVariants: {
2159
- size: "md",
2160
- color: "primary"
2161
- }
2162
- });
2163
-
2164
- const _switch = (options) => ({
2165
- slots: {
2166
- root: "relative flex items-start",
2167
- base: ["inline-flex items-center shrink-0 rounded-full border-2 border-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-[--ui-bg] data-[state=unchecked]:bg-[--ui-bg-accented]", options.theme.transitions && "transition-colors duration-200"],
2168
- container: "flex items-center",
2169
- thumb: "group pointer-events-none block rounded-full bg-[--ui-bg] shadow-lg ring-0 transition-transform duration-200 data-[state=unchecked]:translate-x-0 flex items-center justify-center",
2170
- icon: ["absolute shrink-0 group-data-[state=unchecked]:text-[--ui-text-dimmed] opacity-0 size-10/12", options.theme.transitions && "transition-[color,opacity] duration-200"],
2171
- wrapper: "ms-2",
2172
- label: "block font-medium text-[--ui-text]",
2173
- description: "text-[--ui-text-muted]"
2174
- },
2175
- variants: {
2176
- color: {
2177
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
2178
- base: `data-[state=checked]:bg-[--ui-${color}] focus-visible:ring-[--ui-${color}]`,
2179
- icon: `group-data-[state=checked]:text-[--ui-${color}]`
2180
- }])),
2181
- neutral: {
2182
- base: "data-[state=checked]:bg-[--ui-bg-inverted] focus-visible:ring-[--ui-border-inverted]",
2183
- icon: "group-data-[state=checked]:text-[--ui-text-highlighted]"
2184
- }
2185
- },
2186
- size: {
2187
- xs: {
2188
- base: "w-7",
2189
- container: "h-4",
2190
- thumb: "size-3 data-[state=checked]:translate-x-3",
2191
- wrapper: "text-xs"
2192
- },
2193
- sm: {
2194
- base: "w-8",
2195
- container: "h-4",
2196
- thumb: "size-3.5 data-[state=checked]:translate-x-3.5",
2197
- wrapper: "text-xs"
2198
- },
2199
- md: {
2200
- base: "w-9",
2201
- container: "h-5",
2202
- thumb: "size-4 data-[state=checked]:translate-x-4",
2203
- wrapper: "text-sm"
2204
- },
2205
- lg: {
2206
- base: "w-10",
2207
- container: "h-5",
2208
- thumb: "size-4.5 data-[state=checked]:translate-x-4.5",
2209
- wrapper: "text-sm"
2210
- },
2211
- xl: {
2212
- base: "w-11",
2213
- container: "h-6",
2214
- thumb: "size-5 data-[state=checked]:translate-x-5",
2215
- wrapper: "text-base"
2216
- }
2217
- },
2218
- checked: {
2219
- true: {
2220
- icon: "group-data-[state=checked]:opacity-100"
2221
- }
2222
- },
2223
- unchecked: {
2224
- true: {
2225
- icon: "group-data-[state=unchecked]:opacity-100"
2226
- }
2227
- },
2228
- loading: {
2229
- true: {
2230
- icon: "animate-spin"
2231
- }
2232
- },
2233
- required: {
2234
- true: {
2235
- label: "after:content-['*'] after:ms-0.5 after:text-[--ui-error]"
2236
- }
2237
- },
2238
- disabled: {
2239
- true: {
2240
- base: "cursor-not-allowed opacity-75",
2241
- label: "cursor-not-allowed opacity-75",
2242
- description: "cursor-not-allowed opacity-75"
2243
- }
2244
- }
2245
- },
2246
- defaultVariants: {
2247
- color: "primary",
2248
- size: "md"
2249
- }
2250
- });
2251
-
2252
- const tabs = (options) => ({
2253
- slots: {
2254
- root: "flex items-center gap-2",
2255
- list: "relative flex p-1 group",
2256
- indicator: "absolute transition-[translate,width] duration-200",
2257
- trigger: ["relative inline-flex items-center shrink-0 data-[state=inactive]:text-[--ui-text-muted] hover:data-[state=inactive]:text-[--ui-text] font-medium rounded-[calc(var(--ui-radius)*1.5)] disabled:cursor-not-allowed disabled:opacity-75 focus:outline-none", options.theme.transitions && "transition-colors"],
2258
- content: "focus:outline-none w-full",
2259
- leadingIcon: "shrink-0",
2260
- leadingAvatar: "shrink-0",
2261
- leadingAvatarSize: "",
2262
- label: "truncate"
2263
- },
2264
- variants: {
2265
- color: {
2266
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, ""])),
2267
- neutral: ""
2268
- },
2269
- variant: {
2270
- pill: {
2271
- list: "bg-[--ui-bg-elevated] rounded-[calc(var(--ui-radius)*2)]",
2272
- trigger: "flex-1",
2273
- indicator: "rounded-[calc(var(--ui-radius)*1.5)] shadow-sm"
2274
- },
2275
- link: {
2276
- list: "border-[--ui-border]",
2277
- indicator: "rounded-full"
2278
- }
2279
- },
2280
- orientation: {
2281
- horizontal: {
2282
- root: "flex-col",
2283
- list: "w-full",
2284
- indicator: "left-0 w-[--radix-tabs-indicator-size] translate-x-[--radix-tabs-indicator-position]",
2285
- trigger: "justify-center"
2286
- },
2287
- vertical: {
2288
- list: "flex-col",
2289
- indicator: "top-0 h-[--radix-tabs-indicator-size] translate-y-[--radix-tabs-indicator-position]"
2290
- }
2291
- },
2292
- size: {
2293
- xs: {
2294
- trigger: "px-2 py-1 text-xs gap-1",
2295
- leadingIcon: "size-4",
2296
- leadingAvatarSize: "3xs"
2297
- },
2298
- sm: {
2299
- trigger: "px-2.5 py-1.5 text-xs gap-1.5",
2300
- leadingIcon: "size-4",
2301
- leadingAvatarSize: "3xs"
2302
- },
2303
- md: {
2304
- trigger: "px-3 py-1.5 text-sm gap-1.5",
2305
- leadingIcon: "size-5",
2306
- leadingAvatarSize: "2xs"
2307
- },
2308
- lg: {
2309
- trigger: "px-3 py-2 text-sm gap-2",
2310
- leadingIcon: "size-5",
2311
- leadingAvatarSize: "2xs"
2312
- },
2313
- xl: {
2314
- trigger: "px-3 py-2 text-base gap-2",
2315
- leadingIcon: "size-6",
2316
- leadingAvatarSize: "xs"
2317
- }
2318
- }
2319
- },
2320
- compoundVariants: [{
2321
- orientation: "horizontal",
2322
- variant: "pill",
2323
- class: {
2324
- indicator: "inset-y-1"
2325
- }
2326
- }, {
2327
- orientation: "horizontal",
2328
- variant: "link",
2329
- class: {
2330
- list: "border-b",
2331
- indicator: "-bottom-px h-px"
2332
- }
2333
- }, {
2334
- orientation: "vertical",
2335
- variant: "pill",
2336
- class: {
2337
- indicator: "inset-x-1",
2338
- list: "items-center"
2339
- }
2340
- }, {
2341
- orientation: "vertical",
2342
- variant: "link",
2343
- class: {
2344
- list: "border-l",
2345
- indicator: "-left-px w-px"
2346
- }
2347
- }, ...(options.theme.colors || []).map((color) => ({
2348
- color,
2349
- variant: "pill",
2350
- class: {
2351
- indicator: `bg-[--ui-${color}]`,
2352
- trigger: `data-[state=active]:text-[--ui-bg] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[--ui-${color}]`
2353
- }
2354
- })), {
2355
- color: "neutral",
2356
- variant: "pill",
2357
- class: {
2358
- indicator: "bg-[--ui-bg-inverted]",
2359
- trigger: "data-[state=active]:text-[--ui-bg] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[--ui-border-inverted]"
2360
- }
2361
- }, ...(options.theme.colors || []).map((color) => ({
2362
- color,
2363
- variant: "link",
2364
- class: {
2365
- indicator: `bg-[--ui-${color}]`,
2366
- trigger: `data-[state=active]:text-[--ui-${color}] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[--ui-${color}]`
2367
- }
2368
- })), {
2369
- color: "neutral",
2370
- variant: "link",
2371
- class: {
2372
- indicator: "bg-[--ui-bg-inverted]",
2373
- trigger: "data-[state=active]:text-[--ui-text-highlighted] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[--ui-border-inverted]"
2374
- }
2375
- }],
2376
- defaultVariants: {
2377
- color: "primary",
2378
- variant: "pill",
2379
- size: "md"
2380
- }
2381
- });
2382
-
2383
- const textarea = (options) => {
2384
- return input(options);
2385
- };
2386
-
2387
- const toast = (options) => ({
2388
- slots: {
2389
- root: "relative group overflow-hidden bg-[--ui-bg] shadow-lg rounded-[calc(var(--ui-radius)*2)] ring ring-[--ui-border] p-4 flex gap-2.5 focus:outline-none",
2390
- wrapper: "w-0 flex-1 flex flex-col gap-1",
2391
- title: "text-sm font-medium text-[--ui-text-highlighted]",
2392
- description: "text-sm text-[--ui-text-muted]",
2393
- icon: "shrink-0 size-5",
2394
- avatar: "shrink-0",
2395
- avatarSize: "2xl",
2396
- actions: "flex gap-1.5 shrink-0",
2397
- progress: "absolute inset-x-0 bottom-0 h-1 z-[-1]",
2398
- close: "p-0.5"
2399
- },
2400
- variants: {
2401
- color: {
2402
- ...Object.fromEntries((options.theme.colors || []).map((color) => [color, {
2403
- root: `focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[--ui-${color}]`,
2404
- icon: `text-[--ui-${color}]`,
2405
- progress: `bg-[--ui-${color}]`
2406
- }])),
2407
- neutral: {
2408
- root: "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[--ui-border-inverted]",
2409
- icon: "text-[--ui-text-highlighted]",
2410
- progress: "bg-[--ui-bg-inverted]"
2411
- }
2412
- },
2413
- multiline: {
2414
- true: {
2415
- root: "items-start",
2416
- actions: "items-start mt-1"
2417
- },
2418
- false: {
2419
- root: "items-center",
2420
- actions: "items-center"
2421
- }
2422
- }
2423
- },
2424
- defaultVariants: {
2425
- color: "primary"
2426
- }
2427
- });
2428
-
2429
- const toaster = {
2430
- slots: {
2431
- viewport: "fixed flex flex-col w-[calc(100%-2rem)] sm:w-96 z-[100] data-[expanded=true]:h-[--height] focus:outline-none",
2432
- base: "absolute inset-x-0 z-[--index] transform-[--transform] data-[expanded=false]:data-[front=false]:h-[--front-height] data-[expanded=false]:data-[front=false]:*:invisible data-[state=closed]:animate-[toast-closed_200ms_ease-in-out] data-[state=closed]:data-[expanded=false]:data-[front=false]:animate-[toast-collapsed-closed_200ms_ease-in-out] data-[swipe=move]:transition-none transition-[transform,translate,height] duration-200 ease-out"
2433
- },
2434
- variants: {
2435
- position: {
2436
- "top-left": {
2437
- viewport: "left-4"
2438
- },
2439
- "top-center": {
2440
- viewport: "left-1/2 transform -translate-x-1/2"
2441
- },
2442
- "top-right": {
2443
- viewport: "right-4"
2444
- },
2445
- "bottom-left": {
2446
- viewport: "left-4"
2447
- },
2448
- "bottom-center": {
2449
- viewport: "left-1/2 transform -translate-x-1/2"
2450
- },
2451
- "bottom-right": {
2452
- viewport: "right-4"
2453
- }
2454
- },
2455
- swipeDirection: {
2456
- up: "data-[swipe=end]:animate-[toast-slide-up_200ms_ease-out]",
2457
- right: "data-[swipe=end]:animate-[toast-slide-right_200ms_ease-out]",
2458
- down: "data-[swipe=end]:animate-[toast-slide-down_200ms_ease-out]",
2459
- left: "data-[swipe=end]:animate-[toast-slide-left_200ms_ease-out]"
2460
- }
2461
- },
2462
- compoundVariants: [{
2463
- position: ["top-left", "top-center", "top-right"],
2464
- class: {
2465
- viewport: "top-4",
2466
- base: "top-0 data-[state=open]:animate-[slide-in-from-top_200ms_ease-in-out]"
2467
- }
2468
- }, {
2469
- position: ["bottom-left", "bottom-center", "bottom-right"],
2470
- class: {
2471
- viewport: "bottom-4",
2472
- base: "bottom-0 data-[state=open]:animate-[slide-in-from-bottom_200ms_ease-in-out]"
2473
- }
2474
- }, {
2475
- swipeDirection: ["left", "right"],
2476
- class: "data-[swipe=move]:translate-x-[--radix-toast-swipe-move-x] data-[swipe=end]:translate-x-[--radix-toast-swipe-end-x] data-[swipe=cancel]:translate-x-0"
2477
- }, {
2478
- swipeDirection: ["up", "down"],
2479
- class: "data-[swipe=move]:translate-y-[--radix-toast-swipe-move-y] data-[swipe=end]:translate-y-[--radix-toast-swipe-end-y] data-[swipe=cancel]:translate-y-0"
2480
- }],
2481
- defaultVariants: {
2482
- position: "bottom-right"
2483
- }
2484
- };
2485
-
2486
- const tooltip = {
2487
- slots: {
2488
- content: "flex items-center gap-1 bg-[--ui-bg] text-[--ui-text-highlighted] shadow rounded-[--ui-radius] ring ring-[--ui-border] h-6 px-2 py-1 text-xs select-none data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]",
2489
- arrow: "fill-[--ui-border]",
2490
- text: "truncate",
2491
- kbds: `hidden lg:inline-flex items-center shrink-0 gap-0.5 before:content-['\xB7'] before:mr-0.5`,
2492
- kbdsSize: "sm"
2493
- }
2494
- };
2495
-
2496
- const theme = {
2497
- __proto__: null,
2498
- accordion: accordion,
2499
- alert: alert,
2500
- avatar: avatar,
2501
- avatarGroup: avatarGroup,
2502
- badge: badge,
2503
- breadcrumb: breadcrumb,
2504
- button: button,
2505
- buttonGroup: buttonGroup,
2506
- card: card,
2507
- carousel: carousel,
2508
- checkbox: checkbox,
2509
- chip: chip,
2510
- collapsible: collapsible,
2511
- commandPalette: commandPalette,
2512
- container: container,
2513
- contextMenu: contextMenu,
2514
- drawer: drawer,
2515
- dropdownMenu: dropdownMenu,
2516
- form: form,
2517
- formField: formField,
2518
- input: input,
2519
- inputMenu: inputMenu,
2520
- kbd: kbd,
2521
- link: link,
2522
- modal: modal,
2523
- navigationMenu: navigationMenu,
2524
- pagination: pagination,
2525
- popover: popover,
2526
- progress: progress,
2527
- radioGroup: radioGroup,
2528
- select: select,
2529
- selectMenu: selectMenu,
2530
- separator: separator,
2531
- skeleton: skeleton,
2532
- slideover: slideover,
2533
- slider: slider,
2534
- switch: _switch,
2535
- tabs: tabs,
2536
- textarea: textarea,
2537
- toast: toast,
2538
- toaster: toaster,
2539
- tooltip: tooltip
2540
- };
2541
-
2542
- function addTemplates(options, nuxt) {
2543
- for (const component in theme) {
2544
- addTemplate({
2545
- filename: `ui/${kebabCase(component)}.ts`,
2546
- write: true,
2547
- getContents: async () => {
2548
- const template = theme[component];
2549
- const result = typeof template === "function" ? template(options) : template;
2550
- const variants = Object.keys(result.variants || {});
2551
- let json = JSON.stringify(result, null, 2);
2552
- for (const variant of variants) {
2553
- json = json.replace(new RegExp(`("${variant}": "[^"]+")`, "g"), "$1 as const");
2554
- json = json.replace(new RegExp(`("${variant}": \\[\\s*)((?:"[^"]+",?\\s*)+)(\\])`, "g"), (_, before, match, after) => {
2555
- const replaced = match.replace(/("[^"]+")/g, "$1 as const");
2556
- return `${before}${replaced}${after}`;
2557
- });
112
+ try {
113
+ const path = resolve(`./devtools/runtime/examples/${name}.vue`);
114
+ const source = fs.readFileSync(path, "utf-8");
115
+ res.setHeader("Content-Type", "application/json");
116
+ res.end(JSON.stringify({ component: name, source }));
117
+ } catch (error) {
118
+ console.error(`Failed to read component source for ${name}:`, error);
119
+ res.statusCode = 500;
120
+ res.end(JSON.stringify({ error: "Failed to read component source" }));
2558
121
  }
2559
- return `export default ${json}`;
2560
- }
2561
- });
2562
- }
2563
- addTemplate({
2564
- filename: "ui/index.ts",
2565
- write: true,
2566
- getContents: () => Object.keys(theme).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n")
2567
- });
2568
- addTypeTemplate({
2569
- filename: "types/ui.d.ts",
2570
- getContents: () => `import * as ui from '#build/ui'
2571
- import type { DeepPartial } from '#ui/types/utils'
2572
- import colors from 'tailwindcss/colors'
2573
-
2574
- const icons = ${JSON.stringify(nuxt.options.appConfig.ui.icons)};
2575
-
2576
- type NeutralColor = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone'
2577
- type Color = Exclude<keyof typeof colors, 'inherit' | 'current' | 'transparent' | 'black' | 'white' | NeutralColor>
2578
-
2579
- type AppConfigUI = {
2580
- colors?: {
2581
- ${options.theme?.colors?.map((color) => `${color}?: Color`).join("\n ")}
2582
- neutral?: NeutralColor
2583
- }
2584
- icons?: Partial<typeof icons>
2585
- } & DeepPartial<typeof ui, string>
2586
-
2587
- declare module '@nuxt/schema' {
2588
- interface AppConfigInput {
2589
- ui?: AppConfigUI
2590
- }
2591
- }
2592
-
2593
- export {}
2594
- `
2595
- });
122
+ });
123
+ }
124
+ };
2596
125
  }
2597
126
 
2598
- const icons = {
2599
- chevronDoubleLeft: "i-heroicons-chevron-double-left-20-solid",
2600
- chevronDoubleRight: "i-heroicons-chevron-double-right-20-solid",
2601
- chevronDown: "i-heroicons-chevron-down-20-solid",
2602
- chevronLeft: "i-heroicons-chevron-left-20-solid",
2603
- chevronRight: "i-heroicons-chevron-right-20-solid",
2604
- arrowLeft: "i-heroicons-arrow-left-20-solid",
2605
- arrowRight: "i-heroicons-arrow-right-20-solid",
2606
- check: "i-heroicons-check-20-solid",
2607
- close: "i-heroicons-x-mark-20-solid",
2608
- ellipsis: "i-heroicons-ellipsis-horizontal-20-solid",
2609
- external: "i-heroicons-arrow-up-right-20-solid",
2610
- loading: "i-heroicons-arrow-path-20-solid",
2611
- minus: "i-heroicons-minus-20-solid",
2612
- search: "i-heroicons-magnifying-glass-20-solid"
2613
- };
2614
-
2615
127
  const module = defineNuxtModule({
2616
128
  meta: {
2617
129
  name: "ui",
@@ -2621,33 +133,14 @@ const module = defineNuxtModule({
2621
133
  },
2622
134
  docs: "https://ui3.nuxt.dev/getting-started/installation"
2623
135
  },
2624
- defaults: {
2625
- prefix: "U",
2626
- fonts: true,
2627
- colorMode: true,
2628
- theme: {
2629
- colors: void 0,
2630
- transitions: true
2631
- }
2632
- },
136
+ defaults: defaultOptions,
2633
137
  async setup(options, nuxt) {
2634
138
  const { resolve } = createResolver(import.meta.url);
2635
139
  options.theme = options.theme || {};
2636
- options.theme.colors = options.theme.colors?.length ? [.../* @__PURE__ */ new Set(["primary", ...options.theme.colors])] : ["primary", "secondary", "success", "info", "warning", "error"];
140
+ options.theme.colors = resolveColors(options.theme.colors);
2637
141
  nuxt.options.ui = options;
2638
142
  nuxt.options.alias["#ui"] = resolve("./runtime");
2639
- nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui || {}, {
2640
- colors: pick({
2641
- primary: "green",
2642
- secondary: "blue",
2643
- success: "green",
2644
- info: "blue",
2645
- warning: "yellow",
2646
- error: "red",
2647
- neutral: "slate"
2648
- }, [...options.theme?.colors || [], "neutral"]),
2649
- icons
2650
- });
143
+ nuxt.options.appConfig.ui = defu$1(nuxt.options.appConfig.ui || {}, getDefaultUiConfig(options.theme.colors));
2651
144
  nuxt.options.app.rootAttrs = nuxt.options.app.rootAttrs || {};
2652
145
  nuxt.options.app.rootAttrs.class = [nuxt.options.app.rootAttrs.class, "isolate"].filter(Boolean).join(" ");
2653
146
  if (nuxt.options.builder === "@nuxt/vite-builder") {
@@ -2660,7 +153,7 @@ const module = defineNuxtModule({
2660
153
  if (!hasNuxtModule(name)) {
2661
154
  await installModule(name, options2);
2662
155
  } else {
2663
- nuxt.options[name] = defu(nuxt.options[name], options2);
156
+ nuxt.options[name] = defu$1(nuxt.options[name], options2);
2664
157
  }
2665
158
  }
2666
159
  await registerModule("@nuxt/icon", { cssLayer: "components" });
@@ -2679,7 +172,42 @@ const module = defineNuxtModule({
2679
172
  pathPrefix: false
2680
173
  });
2681
174
  addImportsDir(resolve("./runtime/composables"));
2682
- addTemplates(options, nuxt);
175
+ addTemplates(options, nuxt, resolve);
176
+ nuxt.options.vite = defu$1(nuxt.options?.vite, { optimizeDeps: { include: ["fast-deep-equal"] } });
177
+ if (nuxt.options.dev && nuxt.options.devtools.enabled && options.devtools?.enabled) {
178
+ const templates = buildTemplates(options);
179
+ nuxt.options.vite = defu$1(nuxt.options?.vite, { plugins: [devtoolsMetaPlugin({ resolve, templates, options })] });
180
+ {
181
+ nuxt.hook("vite:serverCreated", async (server) => {
182
+ server.middlewares.use("/__nuxt_ui__/devtools", sirv(resolve("../dist/client/devtools"), {
183
+ single: true,
184
+ dev: true
185
+ }));
186
+ });
187
+ }
188
+ nuxt.options.routeRules = defu$1(nuxt.options.routeRules, { "/__nuxt_ui__/**": { ssr: false } });
189
+ extendPages((pages) => {
190
+ pages.unshift({
191
+ name: "ui-devtools",
192
+ path: "/__nuxt_ui__/components/:slug",
193
+ file: resolve("./devtools/runtime/DevtoolsRenderer.vue"),
194
+ meta: {
195
+ // https://github.com/nuxt/nuxt/pull/29366
196
+ // isolate: true
197
+ layout: false
198
+ }
199
+ });
200
+ });
201
+ addCustomTab({
202
+ name: "nuxt-ui",
203
+ title: "Nuxt UI",
204
+ icon: "/__nuxt_ui__/devtools/favicon.svg",
205
+ view: {
206
+ type: "iframe",
207
+ src: "/__nuxt_ui__/devtools"
208
+ }
209
+ });
210
+ }
2683
211
  }
2684
212
  });
2685
213