@bitrix24/b24ui-nuxt 2.0.7 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/meta.d.mts +28 -6
  2. package/dist/meta.mjs +28 -6
  3. package/dist/module.d.mts +13 -1
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +6 -5
  6. package/dist/runtime/air-design-tokens/001_b24_global.css +1 -1
  7. package/dist/runtime/air-design-tokens/003_b24_context_light.css +1 -1
  8. package/dist/runtime/air-design-tokens/004_b24_context_dark.css +1 -1
  9. package/dist/runtime/air-design-tokens/005_b24_context_edge-light.css +1 -1
  10. package/dist/runtime/air-design-tokens/006_b24_context_edge-dark.css +1 -1
  11. package/dist/runtime/air-design-tokens/007_b24_global.css +1 -1
  12. package/dist/runtime/air-design-tokens/008_ui_global.css +1 -1
  13. package/dist/runtime/air-design-tokens/009_b24_tools.css +1 -1
  14. package/dist/runtime/air-design-tokens/components/badge-counter.css +1 -1
  15. package/dist/runtime/air-design-tokens/components/button.css +1 -1
  16. package/dist/runtime/air-design-tokens/components/navigation-menu.css +1 -1
  17. package/dist/runtime/air-design-tokens/components/popup.css +1 -1
  18. package/dist/runtime/air-design-tokens/components/scrollbar.css +1 -2
  19. package/dist/runtime/air-design-tokens/index.css +1 -1
  20. package/dist/runtime/components/Form.d.vue.ts +1 -1
  21. package/dist/runtime/components/Form.vue +3 -4
  22. package/dist/runtime/components/Form.vue.d.ts +1 -1
  23. package/dist/runtime/components/Modal.d.vue.ts +5 -0
  24. package/dist/runtime/components/Modal.vue +37 -9
  25. package/dist/runtime/components/Modal.vue.d.ts +5 -0
  26. package/dist/runtime/components/RadioGroup.d.vue.ts +5 -5
  27. package/dist/runtime/components/RadioGroup.vue +1 -1
  28. package/dist/runtime/components/RadioGroup.vue.d.ts +5 -5
  29. package/dist/runtime/index.css +1 -1
  30. package/dist/runtime/plugins/colors.js +4 -8
  31. package/dist/shared/{b24ui-nuxt.CPlfZAfR.mjs → b24ui-nuxt.4XNR9Ysu.mjs} +219 -126
  32. package/dist/unplugin.d.mts +3 -1
  33. package/dist/unplugin.mjs +32 -3
  34. package/dist/vite.mjs +5 -3
  35. package/package.json +4 -11
  36. package/.nuxt/b24ui/accordion.ts +0 -20
  37. package/.nuxt/b24ui/advice.ts +0 -36
  38. package/.nuxt/b24ui/alert.ts +0 -176
  39. package/.nuxt/b24ui/avatar-group.ts +0 -52
  40. package/.nuxt/b24ui/avatar.ts +0 -63
  41. package/.nuxt/b24ui/badge.ts +0 -333
  42. package/.nuxt/b24ui/banner.ts +0 -78
  43. package/.nuxt/b24ui/breadcrumb.ts +0 -42
  44. package/.nuxt/b24ui/button.ts +0 -350
  45. package/.nuxt/b24ui/calendar.ts +0 -112
  46. package/.nuxt/b24ui/card.ts +0 -180
  47. package/.nuxt/b24ui/chat-message.ts +0 -123
  48. package/.nuxt/b24ui/chat-messages.ts +0 -14
  49. package/.nuxt/b24ui/chat-palette.ts +0 -8
  50. package/.nuxt/b24ui/chat-prompt-submit.ts +0 -5
  51. package/.nuxt/b24ui/chat-prompt.ts +0 -35
  52. package/.nuxt/b24ui/checkbox-group.ts +0 -255
  53. package/.nuxt/b24ui/checkbox.ts +0 -195
  54. package/.nuxt/b24ui/chip.ts +0 -238
  55. package/.nuxt/b24ui/collapsible.ts +0 -6
  56. package/.nuxt/b24ui/color-picker.ts +0 -42
  57. package/.nuxt/b24ui/command-palette.ts +0 -56
  58. package/.nuxt/b24ui/container.ts +0 -3
  59. package/.nuxt/b24ui/content/content-search-button.ts +0 -6
  60. package/.nuxt/b24ui/content/content-search.ts +0 -13
  61. package/.nuxt/b24ui/content/content-surround.ts +0 -21
  62. package/.nuxt/b24ui/content/content-toc.ts +0 -41
  63. package/.nuxt/b24ui/context-menu.ts +0 -91
  64. package/.nuxt/b24ui/countdown.ts +0 -89
  65. package/.nuxt/b24ui/dashboard-group.ts +0 -3
  66. package/.nuxt/b24ui/dashboard-search-button.ts +0 -6
  67. package/.nuxt/b24ui/dashboard-search.ts +0 -13
  68. package/.nuxt/b24ui/description-list.ts +0 -67
  69. package/.nuxt/b24ui/dropdown-menu.ts +0 -166
  70. package/.nuxt/b24ui/empty.ts +0 -145
  71. package/.nuxt/b24ui/error.ts +0 -9
  72. package/.nuxt/b24ui/field-group.ts +0 -17
  73. package/.nuxt/b24ui/file-upload.ts +0 -241
  74. package/.nuxt/b24ui/form-field.ts +0 -58
  75. package/.nuxt/b24ui/form.ts +0 -3
  76. package/.nuxt/b24ui/index.ts +0 -88
  77. package/.nuxt/b24ui/input-menu.ts +0 -631
  78. package/.nuxt/b24ui/input-number.ts +0 -426
  79. package/.nuxt/b24ui/input-tags.ts +0 -412
  80. package/.nuxt/b24ui/input.ts +0 -386
  81. package/.nuxt/b24ui/kbd.ts +0 -33
  82. package/.nuxt/b24ui/link.ts +0 -22
  83. package/.nuxt/b24ui/modal.ts +0 -57
  84. package/.nuxt/b24ui/navbar-divider.ts +0 -5
  85. package/.nuxt/b24ui/navbar-section.ts +0 -5
  86. package/.nuxt/b24ui/navbar-spacer.ts +0 -5
  87. package/.nuxt/b24ui/navbar.ts +0 -5
  88. package/.nuxt/b24ui/navigation-menu.ts +0 -155
  89. package/.nuxt/b24ui/page-card.ts +0 -489
  90. package/.nuxt/b24ui/page-columns.ts +0 -3
  91. package/.nuxt/b24ui/page-grid.ts +0 -3
  92. package/.nuxt/b24ui/page-links.ts +0 -26
  93. package/.nuxt/b24ui/page-list.ts +0 -8
  94. package/.nuxt/b24ui/pagination.ts +0 -13
  95. package/.nuxt/b24ui/pin-input.ts +0 -152
  96. package/.nuxt/b24ui/popover.ts +0 -6
  97. package/.nuxt/b24ui/progress.ts +0 -289
  98. package/.nuxt/b24ui/prose/a.ts +0 -5
  99. package/.nuxt/b24ui/prose/accordion-item.ts +0 -3
  100. package/.nuxt/b24ui/prose/accordion.ts +0 -6
  101. package/.nuxt/b24ui/prose/badge.ts +0 -3
  102. package/.nuxt/b24ui/prose/blockquote.ts +0 -5
  103. package/.nuxt/b24ui/prose/callout.ts +0 -83
  104. package/.nuxt/b24ui/prose/card-group.ts +0 -3
  105. package/.nuxt/b24ui/prose/card.ts +0 -86
  106. package/.nuxt/b24ui/prose/code-collapse.ts +0 -19
  107. package/.nuxt/b24ui/prose/code-group.ts +0 -10
  108. package/.nuxt/b24ui/prose/code-icon.ts +0 -66
  109. package/.nuxt/b24ui/prose/code-preview.ts +0 -14
  110. package/.nuxt/b24ui/prose/code.ts +0 -75
  111. package/.nuxt/b24ui/prose/collapsible.ts +0 -9
  112. package/.nuxt/b24ui/prose/em.ts +0 -5
  113. package/.nuxt/b24ui/prose/field-group.ts +0 -3
  114. package/.nuxt/b24ui/prose/field.ts +0 -11
  115. package/.nuxt/b24ui/prose/h1.ts +0 -26
  116. package/.nuxt/b24ui/prose/h2.ts +0 -28
  117. package/.nuxt/b24ui/prose/h3.ts +0 -28
  118. package/.nuxt/b24ui/prose/h4.ts +0 -28
  119. package/.nuxt/b24ui/prose/h5.ts +0 -25
  120. package/.nuxt/b24ui/prose/h6.ts +0 -25
  121. package/.nuxt/b24ui/prose/hr.ts +0 -5
  122. package/.nuxt/b24ui/prose/img.ts +0 -23
  123. package/.nuxt/b24ui/prose/index.ts +0 -41
  124. package/.nuxt/b24ui/prose/kbd.ts +0 -3
  125. package/.nuxt/b24ui/prose/li.ts +0 -5
  126. package/.nuxt/b24ui/prose/ol.ts +0 -5
  127. package/.nuxt/b24ui/prose/p.ts +0 -30
  128. package/.nuxt/b24ui/prose/pre.ts +0 -17
  129. package/.nuxt/b24ui/prose/steps.ts +0 -19
  130. package/.nuxt/b24ui/prose/strong.ts +0 -5
  131. package/.nuxt/b24ui/prose/table.ts +0 -6
  132. package/.nuxt/b24ui/prose/tabs-item.ts +0 -3
  133. package/.nuxt/b24ui/prose/tabs.ts +0 -5
  134. package/.nuxt/b24ui/prose/tbody.ts +0 -5
  135. package/.nuxt/b24ui/prose/td.ts +0 -5
  136. package/.nuxt/b24ui/prose/th.ts +0 -5
  137. package/.nuxt/b24ui/prose/thead.ts +0 -5
  138. package/.nuxt/b24ui/prose/tr.ts +0 -5
  139. package/.nuxt/b24ui/prose/ul.ts +0 -5
  140. package/.nuxt/b24ui/radio-group.ts +0 -303
  141. package/.nuxt/b24ui/range.ts +0 -184
  142. package/.nuxt/b24ui/select-menu.ts +0 -554
  143. package/.nuxt/b24ui/select.ts +0 -533
  144. package/.nuxt/b24ui/separator.ts +0 -131
  145. package/.nuxt/b24ui/sidebar-body.ts +0 -15
  146. package/.nuxt/b24ui/sidebar-footer.ts +0 -5
  147. package/.nuxt/b24ui/sidebar-header.ts +0 -5
  148. package/.nuxt/b24ui/sidebar-heading.ts +0 -5
  149. package/.nuxt/b24ui/sidebar-layout.ts +0 -160
  150. package/.nuxt/b24ui/sidebar-section.ts +0 -5
  151. package/.nuxt/b24ui/sidebar-spacer.ts +0 -5
  152. package/.nuxt/b24ui/sidebar.ts +0 -5
  153. package/.nuxt/b24ui/skeleton.ts +0 -21
  154. package/.nuxt/b24ui/slideover.ts +0 -130
  155. package/.nuxt/b24ui/stepper.ts +0 -187
  156. package/.nuxt/b24ui/switch.ts +0 -139
  157. package/.nuxt/b24ui/table-wrapper.ts +0 -46
  158. package/.nuxt/b24ui/table.ts +0 -131
  159. package/.nuxt/b24ui/tabs.ts +0 -119
  160. package/.nuxt/b24ui/textarea.ts +0 -186
  161. package/.nuxt/b24ui/timeline.ts +0 -211
  162. package/.nuxt/b24ui/toast.ts +0 -95
  163. package/.nuxt/b24ui/toaster.ts +0 -91
  164. package/.nuxt/b24ui/tooltip.ts +0 -10
  165. package/.nuxt/b24ui/user.ts +0 -95
  166. package/.nuxt/b24ui.css +0 -5
  167. package/dist/runtime/air-design-tokens/002_b24_context_utility.css +0 -0
@@ -1,16 +1,25 @@
1
1
  import 'node:url';
2
+ import { pascalCase, kebabCase, camelCase } from 'scule';
3
+ import { genExport } from 'knitwork';
4
+ import { hasNuxtModule, addTypeTemplate, addTemplate, updateTemplates, logger } from '@nuxt/kit';
2
5
  import { readFile } from 'node:fs/promises';
3
6
  import { join } from 'pathe';
4
7
  import { globSync } from 'tinyglobby';
5
- import { kebabCase, camelCase, pascalCase } from 'scule';
6
- import { genExport } from 'knitwork';
7
- import { addTypeTemplate, addTemplate, updateTemplates, hasNuxtModule, logger } from '@nuxt/kit';
8
8
  import { defuFn } from 'defu';
9
9
 
10
10
  const name = "@bitrix24/b24ui-nuxt";
11
- const version = "2.0.7";
11
+ const version = "2.0.9";
12
12
 
13
- const getDefaultUiConfig = () => ({});
13
+ function getDefaultConfig(theme) {
14
+ return {
15
+ prefix: theme?.prefix,
16
+ tv: {
17
+ twMergeConfig: {
18
+ prefix: theme?.prefix
19
+ }
20
+ }
21
+ };
22
+ }
14
23
  const defaultOptions = {
15
24
  colorMode: true,
16
25
  colorModeTypeLight: "light",
@@ -19,6 +28,120 @@ const defaultOptions = {
19
28
  content: false
20
29
  };
21
30
 
31
+ function prefixClasses(classString, prefix) {
32
+ if (!prefix || !classString) {
33
+ return classString;
34
+ }
35
+ return classString.split(" ").filter(Boolean).map((cls) => `${prefix}:${cls}`).join(" ");
36
+ }
37
+ function isSizeValue(value) {
38
+ return /^(?:[2-9]x[sl]|base|xs|sm|md|lg|1[01]xl|4\.5xl|xl)$/.test(value.trim());
39
+ }
40
+ function applyPrefixToObject(obj, prefix, context = []) {
41
+ if (!obj || !prefix) {
42
+ return obj;
43
+ }
44
+ const currentKey = context[context.length - 1];
45
+ const compoundVariantsIndex = context.indexOf("compoundVariants");
46
+ const isInCompoundVariant = compoundVariantsIndex !== -1 && !context.slice(compoundVariantsIndex).includes("class");
47
+ const isInDefaultVariants = context.includes("defaultVariants");
48
+ const isComponentSizeValue = typeof obj === "string" && typeof currentKey === "string" && currentKey.endsWith("Size") && isSizeValue(obj);
49
+ if (typeof obj === "string" && (isInCompoundVariant || isInDefaultVariants || isComponentSizeValue)) {
50
+ return obj;
51
+ }
52
+ if (typeof obj === "string") {
53
+ return prefixClasses(obj, prefix);
54
+ }
55
+ if (Array.isArray(obj)) {
56
+ return obj.map((item, index) => applyPrefixToObject(item, prefix, [...context, String(index)]));
57
+ }
58
+ if (typeof obj === "object") {
59
+ const result = {};
60
+ for (const [key, value] of Object.entries(obj)) {
61
+ result[key] = applyPrefixToObject(value, prefix, [...context, key]);
62
+ }
63
+ return result;
64
+ }
65
+ return obj;
66
+ }
67
+
68
+ async function buildComponentDependencyGraph(componentDir, componentPattern) {
69
+ const dependencyGraph = /* @__PURE__ */ new Map();
70
+ const componentFiles = globSync(["**/*.vue"], {
71
+ cwd: componentDir,
72
+ absolute: true
73
+ });
74
+ for (const componentFile of componentFiles) {
75
+ try {
76
+ const content = await readFile(componentFile, "utf-8");
77
+ const componentName = pascalCase(componentFile.split("/").pop().replace(".vue", ""));
78
+ const dependencies = /* @__PURE__ */ new Set();
79
+ const matches = content.matchAll(componentPattern);
80
+ for (const match of matches) {
81
+ const depName = match[1] || match[2];
82
+ if (depName && depName !== componentName) {
83
+ dependencies.add(depName);
84
+ }
85
+ }
86
+ dependencyGraph.set(componentName, dependencies);
87
+ } catch {
88
+ }
89
+ }
90
+ return dependencyGraph;
91
+ }
92
+ function resolveComponentDependencies(component, dependencyGraph, resolved = /* @__PURE__ */ new Set()) {
93
+ if (resolved.has(component)) {
94
+ return resolved;
95
+ }
96
+ resolved.add(component);
97
+ const dependencies = dependencyGraph.get(component);
98
+ if (dependencies) {
99
+ for (const dep of dependencies) {
100
+ resolveComponentDependencies(dep, dependencyGraph, resolved);
101
+ }
102
+ }
103
+ return resolved;
104
+ }
105
+ async function detectUsedComponents(rootDir, prefix, componentDir, includeComponents) {
106
+ const detectedComponents = /* @__PURE__ */ new Set();
107
+ if (includeComponents && includeComponents.length > 0) {
108
+ for (const component of includeComponents) {
109
+ detectedComponents.add(component);
110
+ }
111
+ }
112
+ const appFiles = globSync(["**/*.{vue,ts,js,tsx,jsx}"], {
113
+ cwd: rootDir,
114
+ ignore: ["node_modules/**", ".nuxt/**", "dist/**"]
115
+ });
116
+ const componentPattern = new RegExp(`<(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)|\\b(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)\\b`, "g");
117
+ for (const file of appFiles) {
118
+ try {
119
+ const filePath = join(rootDir, file);
120
+ const content = await readFile(filePath, "utf-8");
121
+ const matches = content.matchAll(componentPattern);
122
+ for (const match of matches) {
123
+ const componentName = match[1] || match[2];
124
+ if (componentName) {
125
+ detectedComponents.add(componentName);
126
+ }
127
+ }
128
+ } catch {
129
+ }
130
+ }
131
+ if (detectedComponents.size === 0) {
132
+ return void 0;
133
+ }
134
+ const dependencyGraph = await buildComponentDependencyGraph(componentDir, componentPattern);
135
+ const allComponents = /* @__PURE__ */ new Set();
136
+ for (const component of detectedComponents) {
137
+ const resolved = resolveComponentDependencies(component, dependencyGraph);
138
+ for (const resolvedComponent of resolved) {
139
+ allComponents.add(resolvedComponent);
140
+ }
141
+ }
142
+ return allComponents;
143
+ }
144
+
22
145
  const accordion$1 = {
23
146
  slots: {
24
147
  root: "w-full",
@@ -4711,20 +4834,23 @@ const link = (options) => ({
4711
4834
 
4712
4835
  const modal = {
4713
4836
  slots: {
4714
- overlay: "fixed inset-0 bg-[#003366]/20",
4837
+ overlay: "fixed inset-0",
4715
4838
  content: [
4716
4839
  "light",
4717
4840
  "bg-(--popup-window-background-color)",
4718
- "fixed",
4719
4841
  "flex flex-col gap-[20px]",
4720
4842
  "focus:outline-none",
4721
4843
  "p-[24px] pt-[20px]"
4722
4844
  ].join(" "),
4723
- contentWrapper: [
4724
- "flex flex-col gap-[15px] pt-[4px]"
4725
- ].join(" "),
4845
+ contentWrapper: "flex flex-col gap-[15px] pt-[4px]",
4726
4846
  header: "flex items-start justify-between gap-[6px]",
4727
4847
  wrapper: "",
4848
+ body: "flex-1 text-(length:--ui-font-size-md) leading-normal",
4849
+ footer: [
4850
+ "flex items-center justify-between gap-[10px]",
4851
+ "border-t border-t-1 border-t-(--ui-color-divider-default)",
4852
+ "pt-[18px]"
4853
+ ].join(" "),
4728
4854
  title: [
4729
4855
  "font-[family-name:var(--ui-font-family-primary)]",
4730
4856
  "text-(--b24ui-typography-label-color)",
@@ -4737,13 +4863,7 @@ const modal = {
4737
4863
  "text-(--b24ui-typography-description-color)",
4738
4864
  "text-(length:--ui-font-size-sm)"
4739
4865
  ].join(" "),
4740
- close: "-mt-[4px]",
4741
- body: "flex-1 overflow-y-auto text-(length:--ui-font-size-md) leading-normal",
4742
- footer: [
4743
- "flex items-center justify-between gap-[10px]",
4744
- "border-t border-t-1 border-t-(--ui-color-divider-default)",
4745
- "pt-[18px]"
4746
- ].join(" ")
4866
+ close: "-mt-[4px]"
4747
4867
  },
4748
4868
  variants: {
4749
4869
  overlayBlur: {
@@ -4763,13 +4883,30 @@ const modal = {
4763
4883
  },
4764
4884
  false: {
4765
4885
  content: [
4766
- "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
4767
- "w-[calc(100vw-2rem)] max-w-[32rem] max-h-[calc(100dvh-2rem)] sm:max-h-[calc(100dvh-4rem)]",
4886
+ // // 'top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2',
4887
+ "w-[calc(100vw-2rem)] max-w-[32rem]",
4888
+ // // 'max-h-[calc(100dvh-2rem)] sm:max-h-[calc(100dvh-4rem)]',
4768
4889
  "rounded-[calc(var(--popup-window-border-radius)-2px)] shadow-lg"
4769
4890
  // @memo see components/popup.css
4770
4891
  // 'ring ring-(--popup-window-border)'
4771
4892
  ].join(" "),
4772
- contentWrapper: "overflow-hidden"
4893
+ contentWrapper: ""
4894
+ // // overflow-hidden
4895
+ }
4896
+ },
4897
+ overlay: {
4898
+ true: {
4899
+ overlay: "bg-[#003366]/20"
4900
+ }
4901
+ },
4902
+ scrollable: {
4903
+ true: {
4904
+ overlay: "overflow-y-auto",
4905
+ content: "relative"
4906
+ },
4907
+ false: {
4908
+ content: "fixed",
4909
+ body: "overflow-y-auto"
4773
4910
  }
4774
4911
  },
4775
4912
  scrollbarThin: {
@@ -4778,6 +4915,27 @@ const modal = {
4778
4915
  }
4779
4916
  }
4780
4917
  },
4918
+ compoundVariants: [
4919
+ {
4920
+ scrollable: true,
4921
+ fullscreen: false,
4922
+ class: {
4923
+ overlay: "grid place-items-center p-4 sm:py-8"
4924
+ }
4925
+ },
4926
+ {
4927
+ scrollable: false,
4928
+ fullscreen: false,
4929
+ class: {
4930
+ content: [
4931
+ "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
4932
+ "max-h-[calc(100dvh-2rem)] sm:max-h-[calc(100dvh-4rem)]"
4933
+ // // overflow-hidden
4934
+ ].join(" "),
4935
+ contentWrapper: "overflow-hidden"
4936
+ }
4937
+ }
4938
+ ],
4781
4939
  defaultVariants: {
4782
4940
  scrollbarThin: true,
4783
4941
  overlayBlur: "auto"
@@ -9983,82 +10141,6 @@ const themeContent = {
9983
10141
  contentToc: contentToc
9984
10142
  };
9985
10143
 
9986
- async function buildComponentDependencyGraph(componentDir, componentPattern) {
9987
- const dependencyGraph = /* @__PURE__ */ new Map();
9988
- const componentFiles = globSync(["**/*.vue"], {
9989
- cwd: componentDir,
9990
- absolute: true
9991
- });
9992
- for (const componentFile of componentFiles) {
9993
- try {
9994
- const content = await readFile(componentFile, "utf-8");
9995
- const componentName = pascalCase(componentFile.split("/").pop().replace(".vue", ""));
9996
- const dependencies = /* @__PURE__ */ new Set();
9997
- const matches = content.matchAll(componentPattern);
9998
- for (const match of matches) {
9999
- const depName = match[1] || match[2];
10000
- if (depName && depName !== componentName) {
10001
- dependencies.add(depName);
10002
- }
10003
- }
10004
- dependencyGraph.set(componentName, dependencies);
10005
- } catch {
10006
- }
10007
- }
10008
- return dependencyGraph;
10009
- }
10010
- function resolveComponentDependencies(component, dependencyGraph, resolved = /* @__PURE__ */ new Set()) {
10011
- if (resolved.has(component)) {
10012
- return resolved;
10013
- }
10014
- resolved.add(component);
10015
- const dependencies = dependencyGraph.get(component);
10016
- if (dependencies) {
10017
- for (const dep of dependencies) {
10018
- resolveComponentDependencies(dep, dependencyGraph, resolved);
10019
- }
10020
- }
10021
- return resolved;
10022
- }
10023
- async function detectUsedComponents(rootDir, prefix, componentDir, includeComponents) {
10024
- const detectedComponents = /* @__PURE__ */ new Set();
10025
- if (includeComponents && includeComponents.length > 0) {
10026
- for (const component of includeComponents) {
10027
- detectedComponents.add(component);
10028
- }
10029
- }
10030
- const appFiles = globSync(["**/*.{vue,ts,js,tsx,jsx}"], {
10031
- cwd: rootDir,
10032
- ignore: ["node_modules/**", ".nuxt/**", "dist/**"]
10033
- });
10034
- const componentPattern = new RegExp(`<(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)|\\b(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)\\b`, "g");
10035
- for (const file of appFiles) {
10036
- try {
10037
- const filePath = join(rootDir, file);
10038
- const content = await readFile(filePath, "utf-8");
10039
- const matches = content.matchAll(componentPattern);
10040
- for (const match of matches) {
10041
- const componentName = match[1] || match[2];
10042
- if (componentName) {
10043
- detectedComponents.add(componentName);
10044
- }
10045
- }
10046
- } catch {
10047
- }
10048
- }
10049
- if (detectedComponents.size === 0) {
10050
- return void 0;
10051
- }
10052
- const dependencyGraph = await buildComponentDependencyGraph(componentDir, componentPattern);
10053
- const allComponents = /* @__PURE__ */ new Set();
10054
- for (const component of detectedComponents) {
10055
- const resolved = resolveComponentDependencies(component, dependencyGraph);
10056
- for (const resolvedComponent of resolved) {
10057
- allComponents.add(resolvedComponent);
10058
- }
10059
- }
10060
- return allComponents;
10061
- }
10062
10144
  function getTemplates(options, uiConfig, nuxt, resolve) {
10063
10145
  const templates = [];
10064
10146
  let hasProse = false;
@@ -10071,7 +10153,8 @@ function getTemplates(options, uiConfig, nuxt, resolve) {
10071
10153
  write: true,
10072
10154
  getContents: async () => {
10073
10155
  const template = theme2[component];
10074
- const result = typeof template === "function" ? template(options) : template;
10156
+ let result = typeof template === "function" ? template(options) : template;
10157
+ result = applyPrefixToObject(result, options.theme?.prefix);
10075
10158
  const variants = Object.entries(result.variants || {}).filter(([_, values]) => {
10076
10159
  const keys = Object.keys(values);
10077
10160
  return keys.some((key) => key !== "true" && key !== "false");
@@ -10098,7 +10181,24 @@ function getTemplates(options, uiConfig, nuxt, resolve) {
10098
10181
  });
10099
10182
  }
10100
10183
  }
10101
- async function getSources() {
10184
+ const forNuxt = !!nuxt && (hasNuxtModule("@nuxtjs/mdc") || options.mdc || (hasNuxtModule("@nuxt/content") || options.content));
10185
+ const forVue = !nuxt && options.mdc;
10186
+ if (forNuxt || forVue) {
10187
+ hasProse = true;
10188
+ const path = "prose";
10189
+ writeThemeTemplate(themeProse, path);
10190
+ templates.push({
10191
+ filename: `b24ui/${path}/index.ts`,
10192
+ write: true,
10193
+ getContents: () => Object.keys(themeProse).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n")
10194
+ });
10195
+ }
10196
+ if (!!nuxt && (hasNuxtModule("@nuxt/content") || options.content)) {
10197
+ hasContent = true;
10198
+ writeThemeTemplate(themeContent, "content");
10199
+ }
10200
+ writeThemeTemplate(theme);
10201
+ async function generateSources() {
10102
10202
  let sources = "";
10103
10203
  if (!!nuxt && !!resolve && options.experimental?.componentDetection) {
10104
10204
  const detectedComponents = await detectUsedComponents(
@@ -10142,28 +10242,26 @@ function getTemplates(options, uiConfig, nuxt, resolve) {
10142
10242
  }
10143
10243
  return sources || '@source "./b24ui";';
10144
10244
  }
10145
- if (!!nuxt && (hasNuxtModule("@nuxtjs/mdc") || options.mdc || (hasNuxtModule("@nuxt/content") || options.content))) {
10146
- hasProse = true;
10147
- const path = "prose";
10148
- writeThemeTemplate(themeProse, path);
10149
- templates.push({
10150
- filename: `b24ui/${path}/index.ts`,
10151
- write: true,
10152
- getContents: () => Object.keys(themeProse).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n")
10153
- });
10154
- }
10155
- if (!!nuxt && (hasNuxtModule("@nuxt/content") || options.content)) {
10156
- hasContent = true;
10157
- writeThemeTemplate(themeContent, "content");
10158
- }
10159
- writeThemeTemplate(theme);
10160
10245
  templates.push({
10161
10246
  filename: "b24ui.css",
10162
10247
  write: true,
10163
10248
  getContents: async () => {
10164
- const sources = await getSources();
10249
+ const sources = await generateSources();
10250
+ const prefix = options.theme?.prefix ? `${options.theme.prefix}:` : "";
10165
10251
  return `${sources}
10166
10252
 
10253
+ @layer base {
10254
+ body {
10255
+ scrollbar-gutter: stable;
10256
+ background: var(--air-theme-background);
10257
+ @apply ${prefix}antialiased ${prefix}font-(family-name:--ui-font-family-system) ${prefix}text-(--b24ui-typography-legend-color) ${prefix}scheme-light ${prefix}dark:scheme-dark ${prefix}edge-light:scheme-light ${prefix}edge-dark:scheme-light;
10258
+ }
10259
+
10260
+ .sidebar-layout.--inner {
10261
+ background: var(--air-theme-background);
10262
+ }
10263
+ }
10264
+
10167
10265
  @theme static {}
10168
10266
 
10169
10267
  @theme default inline {}
@@ -10173,17 +10271,11 @@ function getTemplates(options, uiConfig, nuxt, resolve) {
10173
10271
  templates.push({
10174
10272
  filename: "b24ui/index.ts",
10175
10273
  write: true,
10176
- getContents: () => {
10177
- let contents = Object.keys(theme).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`).join("\n");
10178
- if (hasContent) {
10179
- contents += "\n";
10180
- contents += Object.keys(themeContent).map((component) => `export { default as ${component} } from './content/${kebabCase(component)}'`).join("\n");
10181
- }
10182
- if (hasProse) contents += `
10183
- export * as prose from './prose'
10184
- `;
10185
- return contents;
10186
- }
10274
+ getContents: () => [
10275
+ ...Object.keys(theme).map((component) => `export { default as ${component} } from './${kebabCase(component)}'`),
10276
+ ...hasContent ? Object.keys(themeContent).map((component) => `export { default as ${component} } from './content/${kebabCase(component)}'`) : [],
10277
+ ...hasProse ? [`export * as prose from './prose'`] : []
10278
+ ].join("\n")
10187
10279
  });
10188
10280
  templates.push({
10189
10281
  filename: "types/b24ui.d.ts",
@@ -10193,6 +10285,7 @@ import type { TVConfig } from '@bitrix24/b24ui-nuxt'
10193
10285
  import type { defaultConfig } from 'tailwind-variants'
10194
10286
 
10195
10287
  type AppConfigUI = {
10288
+ prefix?: string
10196
10289
  tv?: typeof defaultConfig
10197
10290
  } & TVConfig<typeof b24ui>
10198
10291
 
@@ -10241,4 +10334,4 @@ function addTemplates(options, nuxt, resolve) {
10241
10334
  }
10242
10335
  }
10243
10336
 
10244
- export { getDefaultUiConfig as a, addTemplates as b, defaultOptions as d, getTemplates as g, name as n, version as v };
10337
+ export { getDefaultConfig as a, addTemplates as b, defaultOptions as d, getTemplates as g, name as n, version as v };
@@ -7,7 +7,9 @@ import { TVConfig } from '../dist/runtime/types/tv.js';
7
7
  import { ColorModeTypeLight } from '../dist/runtime/types/index.js';
8
8
  import '@nuxt/schema';
9
9
 
10
- type AppConfigB24UI = {} & TVConfig<typeof b24ui>;
10
+ type AppConfigB24UI = {
11
+ prefix?: string;
12
+ } & TVConfig<typeof b24ui>;
11
13
  interface Bitrix24UIOptions extends Omit<ModuleOptions, 'colorMode'> {
12
14
  /** Whether to generate declaration files for auto-imported components. */
13
15
  dts?: boolean;
package/dist/unplugin.mjs CHANGED
@@ -3,23 +3,51 @@ import { join, normalize } from 'pathe';
3
3
  import { createUnplugin } from 'unplugin';
4
4
  import { defu } from 'defu';
5
5
  import tailwind from '@tailwindcss/vite';
6
- import { g as getTemplates, d as defaultOptions, a as getDefaultUiConfig } from './shared/b24ui-nuxt.CPlfZAfR.mjs';
6
+ import { g as getTemplates, d as defaultOptions, a as getDefaultConfig } from './shared/b24ui-nuxt.4XNR9Ysu.mjs';
7
+ import fs from 'node:fs';
8
+ import path from 'node:path';
7
9
  import MagicString from 'magic-string';
8
10
  import { genSafeVariableName } from 'knitwork';
9
11
  import { resolvePathSync } from 'mlly';
10
12
  import { globSync } from 'tinyglobby';
11
13
  import AutoImportComponents from 'unplugin-vue-components';
12
14
  import AutoImport from 'unplugin-auto-import';
13
- import 'node:fs/promises';
14
15
  import 'scule';
15
16
  import '@nuxt/kit';
17
+ import 'node:fs/promises';
16
18
 
17
19
  function TemplatePlugin(options, appConfig) {
18
20
  const templates = getTemplates(options, appConfig.b24ui);
19
21
  const templateKeys = new Set(templates.map((t) => `#build/${t.filename}`));
22
+ async function writeTemplates(root) {
23
+ const map = {};
24
+ const dir = path.join(root, "node_modules", ".b24ui-nuxt");
25
+ for (const template of templates) {
26
+ if (!template.write || !template.filename) {
27
+ continue;
28
+ }
29
+ const filePath = path.join(dir, template.filename);
30
+ if (!fs.existsSync(path.dirname(filePath))) {
31
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
32
+ }
33
+ fs.writeFileSync(filePath, await template.getContents({}));
34
+ map[`#build/${template.filename}`] = filePath;
35
+ }
36
+ return map;
37
+ }
20
38
  return {
21
39
  name: "bitrix24:b24ui:templates",
22
40
  enforce: "pre",
41
+ vite: {
42
+ async config(config) {
43
+ const alias = await writeTemplates(config.root || process.cwd());
44
+ return {
45
+ resolve: {
46
+ alias
47
+ }
48
+ };
49
+ }
50
+ },
23
51
  resolveId(id) {
24
52
  if (templateKeys.has(id + ".ts")) {
25
53
  return id.replace("#build/", "virtual:bitrix24-ui-templates/") + ".ts";
@@ -252,6 +280,7 @@ function AutoImportPlugin(options, meta) {
252
280
  const runtimeDir = normalize(fileURLToPath(new URL("./runtime", import.meta.url)));
253
281
  const Bitrix24UIPlugin = createUnplugin((_options = {}, meta) => {
254
282
  const options = defu(_options, {}, defaultOptions);
283
+ options.theme = options.theme || {};
255
284
  const appConfig = defu(
256
285
  {
257
286
  b24ui: options.b24ui,
@@ -260,7 +289,7 @@ const Bitrix24UIPlugin = createUnplugin((_options = {}, meta) => {
260
289
  colorModeTypeLight: options.colorModeTypeLight
261
290
  },
262
291
  {
263
- b24ui: getDefaultUiConfig()
292
+ b24ui: getDefaultConfig(options.theme)
264
293
  }
265
294
  );
266
295
  return [
package/dist/vite.mjs CHANGED
@@ -4,12 +4,14 @@ import 'pathe';
4
4
  import 'unplugin';
5
5
  import 'defu';
6
6
  import '@tailwindcss/vite';
7
- import './shared/b24ui-nuxt.CPlfZAfR.mjs';
8
- import 'node:fs/promises';
9
- import 'tinyglobby';
7
+ import './shared/b24ui-nuxt.4XNR9Ysu.mjs';
10
8
  import 'scule';
11
9
  import 'knitwork';
12
10
  import '@nuxt/kit';
11
+ import 'node:fs/promises';
12
+ import 'tinyglobby';
13
+ import 'node:fs';
14
+ import 'node:path';
13
15
  import 'magic-string';
14
16
  import 'mlly';
15
17
  import 'unplugin-vue-components';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrix24/b24ui-nuxt",
3
3
  "description": "Bitrix24 UI-Kit for developing web applications REST API for NUXT & VUE",
4
- "version": "2.0.7",
4
+ "version": "2.0.9",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/bitrix24/b24ui.git"
@@ -80,10 +80,6 @@
80
80
  ]
81
81
  }
82
82
  },
83
- "imports": {
84
- "#build/b24ui/*": "./.nuxt/b24ui/*.ts",
85
- "#build/b24ui.css": "./.nuxt/b24ui.css"
86
- },
87
83
  "bin": {
88
84
  "bitrix24-ui": "./cli/index.mjs"
89
85
  },
@@ -93,14 +89,12 @@
93
89
  "README.md",
94
90
  "README-AI.md",
95
91
  "LICENSE",
96
- ".nuxt/b24ui",
97
- ".nuxt/b24ui.css",
98
92
  "dist",
99
93
  "cli",
100
94
  "vue-plugin.d.ts"
101
95
  ],
102
96
  "dependencies": {
103
- "@bitrix24/b24icons-vue": "^2.0.4",
97
+ "@bitrix24/b24icons-vue": "^2.0.5",
104
98
  "@internationalized/date": "^3.10.0",
105
99
  "@internationalized/number": "^3.6.5",
106
100
  "@nuxt/kit": "^4.2.0",
@@ -142,7 +136,7 @@
142
136
  "unplugin-auto-import": "^20.2.0",
143
137
  "unplugin-vue-components": "^30.0.0",
144
138
  "vaul-vue": "0.4.1",
145
- "vue-component-type-helpers": "^3.1.2"
139
+ "vue-component-type-helpers": "^3.1.3"
146
140
  },
147
141
  "devDependencies": {
148
142
  "@nuxt/content": "^3.7.1",
@@ -163,7 +157,7 @@
163
157
  "vitest": "^3.2.4",
164
158
  "vitest-axe": "^0.1.0",
165
159
  "vitest-environment-nuxt": "^1.0.1",
166
- "vue-tsc": "^3.1.2"
160
+ "vue-tsc": "^3.1.3"
167
161
  },
168
162
  "peerDependencies": {
169
163
  "@inertiajs/vue3": "^2.0.7",
@@ -203,7 +197,6 @@
203
197
  "@bitrix24/b24ui-nuxt": "workspace:*",
204
198
  "debug": "4.3.7",
205
199
  "typescript": "5.8.3",
206
- "unimport": "4.1.1",
207
200
  "unplugin": "^2.3.10"
208
201
  },
209
202
  "keywords": [
@@ -1,20 +0,0 @@
1
- export default {
2
- "slots": {
3
- "root": "w-full",
4
- "item": "text-(--b24ui-typography-label-color) border-b border-(--ui-color-divider-vibrant-accent-more) last:border-b-0",
5
- "header": "flex",
6
- "trigger": "min-w-0 group flex-1 flex items-center gap-1.5 py-[12px] font-(--ui-font-weight-medium) text-(length:--ui-font-size-sm) leading-[20px] focus-visible:outline-(--ui-color-accent-soft-element-blue) cursor-pointer",
7
- "content": "motion-safe:data-[state=open]:animate-[accordion-down_200ms_ease-out] motion-safe:data-[state=closed]:animate-[accordion-up_200ms_ease-out] overflow-hidden focus:outline-none",
8
- "body": "text-(length:--ui-font-size-sm) pb-[12px]",
9
- "leadingIcon": "shrink-0 size-[20px]",
10
- "trailingIcon": "shrink-0 size-[20px] ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200",
11
- "label": "text-start break-words"
12
- },
13
- "variants": {
14
- "disabled": {
15
- "true": {
16
- "trigger": "cursor-not-allowed opacity-75"
17
- }
18
- }
19
- }
20
- }
@@ -1,36 +0,0 @@
1
- const angle = [
2
- "top",
3
- "bottom"
4
- ] as const
5
-
6
- export default {
7
- "slots": {
8
- "root": "light style-outline-accent-1 flex items-end",
9
- "descriptionWrapper": "relative",
10
- "descriptionBorder": "fill-(--b24ui-border-color)",
11
- "descriptionBg": "fill-(--b24ui-background) dark:fill-(--ui-color-base-6)",
12
- "descriptionAngle": "absolute w-[14px] h-[12px]",
13
- "description": "grow w-11/12 py-3 px-md2 ms-2 rounded-[23px] font-[family-name:var(--ui-font-family-secondary)] text-(length:--ui-font-size-md)/(--ui-font-line-height-md) font-(--ui-font-weight-normal) border-1 border-(--b24ui-border-color) bg-(--b24ui-background) text-(--b24ui-color) dark:bg-(--ui-color-base-6)",
14
- "leading": "me-1.5 ms-2 font-(--ui-font-weight-medium) text-(--ui-color-design-plain-content-icon-secondary)",
15
- "leadingIcon": "shrink-0 size-[42px]",
16
- "leadingAvatar": "shrink-0",
17
- "leadingAvatarIcon": "text-(--b24ui-typography-label-color) bg-(--ui-color-base-8)",
18
- "leadingAvatarSize": "lg"
19
- },
20
- "variants": {
21
- "angle": {
22
- "top": {
23
- "root": "items-start",
24
- "leading": "mt-0.5",
25
- "descriptionAngle": "start-[0.8px] top-[9px] scale-x-100 -scale-y-100 rtl:-scale-x-100"
26
- },
27
- "bottom": {
28
- "root": "items-end",
29
- "descriptionAngle": "start-[0.8px] bottom-[9px] rtl:-scale-x-100"
30
- }
31
- }
32
- },
33
- "defaultVariants": {
34
- "angle": "bottom" as typeof angle[number]
35
- }
36
- }