@bitrix24/b24ui-nuxt 0.1.1

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 (159) hide show
  1. package/.nuxt/b24ui/advice.ts +52 -0
  2. package/.nuxt/b24ui/alert.ts +118 -0
  3. package/.nuxt/b24ui/avatar-group.ts +52 -0
  4. package/.nuxt/b24ui/avatar.ts +63 -0
  5. package/.nuxt/b24ui/badge.ts +256 -0
  6. package/.nuxt/b24ui/button-group.ts +27 -0
  7. package/.nuxt/b24ui/button.ts +342 -0
  8. package/.nuxt/b24ui/checkbox.ts +128 -0
  9. package/.nuxt/b24ui/chip.ts +205 -0
  10. package/.nuxt/b24ui/container.ts +3 -0
  11. package/.nuxt/b24ui/content/description-list.ts +62 -0
  12. package/.nuxt/b24ui/countdown.ts +94 -0
  13. package/.nuxt/b24ui/form-field.ts +57 -0
  14. package/.nuxt/b24ui/form.ts +3 -0
  15. package/.nuxt/b24ui/index.ts +28 -0
  16. package/.nuxt/b24ui/input.ts +472 -0
  17. package/.nuxt/b24ui/kbd.ts +31 -0
  18. package/.nuxt/b24ui/link.ts +20 -0
  19. package/.nuxt/b24ui/progress.ts +303 -0
  20. package/.nuxt/b24ui/radio-group.ts +135 -0
  21. package/.nuxt/b24ui/range.ts +172 -0
  22. package/.nuxt/b24ui/select.ts +550 -0
  23. package/.nuxt/b24ui/separator.ts +176 -0
  24. package/.nuxt/b24ui/skeleton.ts +3 -0
  25. package/.nuxt/b24ui/switch.ts +134 -0
  26. package/.nuxt/b24ui/tabs.ts +341 -0
  27. package/.nuxt/b24ui/textarea.ts +332 -0
  28. package/.nuxt/b24ui/toast.ts +89 -0
  29. package/.nuxt/b24ui/toaster.ts +91 -0
  30. package/.nuxt/b24ui/tooltip.ts +16 -0
  31. package/LICENSE +21 -0
  32. package/README.md +101 -0
  33. package/cli/commands/make/component.mjs +95 -0
  34. package/cli/commands/make/index.mjs +14 -0
  35. package/cli/commands/make/locale.mjs +64 -0
  36. package/cli/index.mjs +15 -0
  37. package/cli/package.json +13 -0
  38. package/cli/templates.mjs +240 -0
  39. package/cli/utils.mjs +31 -0
  40. package/dist/meta.cjs +23610 -0
  41. package/dist/meta.d.cts +23608 -0
  42. package/dist/meta.d.mts +23608 -0
  43. package/dist/meta.d.ts +23608 -0
  44. package/dist/meta.mjs +23608 -0
  45. package/dist/module.cjs +54 -0
  46. package/dist/module.d.cts +14 -0
  47. package/dist/module.d.mts +14 -0
  48. package/dist/module.d.ts +14 -0
  49. package/dist/module.json +13 -0
  50. package/dist/module.mjs +51 -0
  51. package/dist/runtime/components/Advice.vue +115 -0
  52. package/dist/runtime/components/Alert.vue +136 -0
  53. package/dist/runtime/components/App.vue +52 -0
  54. package/dist/runtime/components/Avatar.vue +118 -0
  55. package/dist/runtime/components/AvatarGroup.vue +99 -0
  56. package/dist/runtime/components/Badge.vue +114 -0
  57. package/dist/runtime/components/Button.vue +177 -0
  58. package/dist/runtime/components/ButtonGroup.vue +58 -0
  59. package/dist/runtime/components/Checkbox.vue +110 -0
  60. package/dist/runtime/components/Chip.vue +81 -0
  61. package/dist/runtime/components/Container.vue +36 -0
  62. package/dist/runtime/components/Countdown.vue +498 -0
  63. package/dist/runtime/components/Form.vue +271 -0
  64. package/dist/runtime/components/FormField.vue +128 -0
  65. package/dist/runtime/components/Input.vue +224 -0
  66. package/dist/runtime/components/Kbd.vue +50 -0
  67. package/dist/runtime/components/Link.vue +219 -0
  68. package/dist/runtime/components/LinkBase.vue +63 -0
  69. package/dist/runtime/components/Progress.vue +182 -0
  70. package/dist/runtime/components/RadioGroup.vue +178 -0
  71. package/dist/runtime/components/Range.vue +114 -0
  72. package/dist/runtime/components/Select.vue +328 -0
  73. package/dist/runtime/components/Separator.vue +82 -0
  74. package/dist/runtime/components/Skeleton.vue +31 -0
  75. package/dist/runtime/components/Switch.vue +133 -0
  76. package/dist/runtime/components/Tabs.vue +127 -0
  77. package/dist/runtime/components/Textarea.vue +216 -0
  78. package/dist/runtime/components/Toast.vue +168 -0
  79. package/dist/runtime/components/Toaster.vue +143 -0
  80. package/dist/runtime/components/Tooltip.vue +94 -0
  81. package/dist/runtime/components/content/DescriptionList.vue +220 -0
  82. package/dist/runtime/composables/defineLocale.d.ts +9 -0
  83. package/dist/runtime/composables/defineLocale.js +4 -0
  84. package/dist/runtime/composables/defineShortcuts.d.ts +15 -0
  85. package/dist/runtime/composables/defineShortcuts.js +135 -0
  86. package/dist/runtime/composables/useAvatarGroup.d.ts +10 -0
  87. package/dist/runtime/composables/useAvatarGroup.js +10 -0
  88. package/dist/runtime/composables/useButtonGroup.d.ts +17 -0
  89. package/dist/runtime/composables/useButtonGroup.js +10 -0
  90. package/dist/runtime/composables/useComponentIcons.d.ts +20 -0
  91. package/dist/runtime/composables/useComponentIcons.js +25 -0
  92. package/dist/runtime/composables/useFormField.d.ts +42 -0
  93. package/dist/runtime/composables/useFormField.js +65 -0
  94. package/dist/runtime/composables/useKbd.d.ts +35 -0
  95. package/dist/runtime/composables/useKbd.js +52 -0
  96. package/dist/runtime/composables/useLocale.d.ts +4 -0
  97. package/dist/runtime/composables/useLocale.js +10 -0
  98. package/dist/runtime/composables/useToast.d.ts +12 -0
  99. package/dist/runtime/composables/useToast.js +62 -0
  100. package/dist/runtime/dictionary/icons.d.ts +20 -0
  101. package/dist/runtime/dictionary/icons.js +35 -0
  102. package/dist/runtime/index.css +1 -0
  103. package/dist/runtime/keyframes.css +1 -0
  104. package/dist/runtime/locale/en.d.ts +2 -0
  105. package/dist/runtime/locale/en.js +48 -0
  106. package/dist/runtime/locale/es.d.ts +2 -0
  107. package/dist/runtime/locale/es.js +48 -0
  108. package/dist/runtime/locale/index.d.ts +3 -0
  109. package/dist/runtime/locale/index.js +3 -0
  110. package/dist/runtime/locale/ru.d.ts +2 -0
  111. package/dist/runtime/locale/ru.js +48 -0
  112. package/dist/runtime/plugins/colors.d.ts +2 -0
  113. package/dist/runtime/plugins/colors.js +40 -0
  114. package/dist/runtime/types/app.config.d.ts +6 -0
  115. package/dist/runtime/types/form.d.ts +84 -0
  116. package/dist/runtime/types/form.js +12 -0
  117. package/dist/runtime/types/icons.d.ts +3 -0
  118. package/dist/runtime/types/icons.js +0 -0
  119. package/dist/runtime/types/index.d.ts +33 -0
  120. package/dist/runtime/types/index.js +33 -0
  121. package/dist/runtime/types/locale.d.ts +50 -0
  122. package/dist/runtime/types/locale.js +0 -0
  123. package/dist/runtime/types/utils.d.ts +22 -0
  124. package/dist/runtime/types/utils.js +0 -0
  125. package/dist/runtime/utils/form.d.ts +17 -0
  126. package/dist/runtime/utils/form.js +153 -0
  127. package/dist/runtime/utils/fuse.d.ts +4 -0
  128. package/dist/runtime/utils/fuse.js +63 -0
  129. package/dist/runtime/utils/index.d.ts +6 -0
  130. package/dist/runtime/utils/index.js +63 -0
  131. package/dist/runtime/utils/link.d.ts +29 -0
  132. package/dist/runtime/utils/link.js +4 -0
  133. package/dist/runtime/utils/locale.d.ts +15 -0
  134. package/dist/runtime/utils/locale.js +25 -0
  135. package/dist/runtime/utils/tv.d.ts +1 -0
  136. package/dist/runtime/utils/tv.js +4 -0
  137. package/dist/runtime/vue/components/Link.vue +203 -0
  138. package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
  139. package/dist/runtime/vue/plugins/color-mode.js +6 -0
  140. package/dist/runtime/vue/plugins/head.d.ts +4 -0
  141. package/dist/runtime/vue/plugins/head.js +6 -0
  142. package/dist/runtime/vue/stubs.d.ts +15 -0
  143. package/dist/runtime/vue/stubs.js +27 -0
  144. package/dist/shared/b24ui-nuxt.CNGvMe2S.mjs +4074 -0
  145. package/dist/shared/b24ui-nuxt.D22QQtm8.cjs +4079 -0
  146. package/dist/types.d.mts +1 -0
  147. package/dist/types.d.ts +1 -0
  148. package/dist/unplugin.cjs +213 -0
  149. package/dist/unplugin.d.cts +22 -0
  150. package/dist/unplugin.d.mts +22 -0
  151. package/dist/unplugin.d.ts +22 -0
  152. package/dist/unplugin.mjs +202 -0
  153. package/dist/vite.cjs +21 -0
  154. package/dist/vite.d.cts +12 -0
  155. package/dist/vite.d.mts +12 -0
  156. package/dist/vite.d.ts +12 -0
  157. package/dist/vite.mjs +19 -0
  158. package/package.json +166 -0
  159. package/vue-plugin.d.ts +5 -0
@@ -0,0 +1 @@
1
+ export { type ModuleOptions, default } from './module.js'
@@ -0,0 +1 @@
1
+ export { type ModuleOptions, default } from './module'
@@ -0,0 +1,213 @@
1
+ 'use strict';
2
+
3
+ const node_url = require('node:url');
4
+ const pathe = require('pathe');
5
+ const unplugin = require('unplugin');
6
+ const AutoImport = require('unplugin-auto-import');
7
+ const defu = require('defu');
8
+ const tailwind = require('@tailwindcss/vite');
9
+ const templates = require('./shared/b24ui-nuxt.D22QQtm8.cjs');
10
+ const tinyglobby = require('tinyglobby');
11
+ const knitwork = require('knitwork');
12
+ const MagicString = require('magic-string');
13
+ const mlly = require('mlly');
14
+ const AutoImportComponents = require('unplugin-vue-components');
15
+ require('scule');
16
+ require('@nuxt/kit');
17
+
18
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
19
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
20
+
21
+ const AutoImport__default = /*#__PURE__*/_interopDefaultCompat(AutoImport);
22
+ const tailwind__default = /*#__PURE__*/_interopDefaultCompat(tailwind);
23
+ const MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
24
+ const AutoImportComponents__default = /*#__PURE__*/_interopDefaultCompat(AutoImportComponents);
25
+
26
+ function TemplatePlugin(options) {
27
+ const templates$1 = templates.getTemplates(options);
28
+ const templateKeys = new Set(templates$1.map((t) => `#build/${t.filename}`));
29
+ return {
30
+ name: "bitrix24:b24ui:templates",
31
+ enforce: "pre",
32
+ resolveId(id) {
33
+ if (templateKeys.has(id + ".ts")) {
34
+ return id.replace("#build/", "virtual:bitrix24-ui-templates/") + ".ts";
35
+ }
36
+ },
37
+ loadInclude: (id) => templateKeys.has(id.replace("virtual:bitrix24-ui-templates/", "#build/")),
38
+ load(id) {
39
+ id = id.replace("virtual:bitrix24-ui-templates/", "#build/");
40
+ return templates$1.find((t) => `#build/${t.filename}` === id).getContents({});
41
+ }
42
+ };
43
+ }
44
+
45
+ function PluginsPlugin(options) {
46
+ const plugins = tinyglobby.globSync(["**/*", "!*.d.ts"], { cwd: pathe.join(runtimeDir, "plugins"), absolute: true });
47
+ plugins.unshift(mlly.resolvePathSync("../runtime/vue/plugins/head", { extensions: [".ts", ".mjs", ".js"], url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('unplugin.cjs', document.baseURI).href)) }));
48
+ if (options.colorMode) {
49
+ plugins.push(mlly.resolvePathSync("../runtime/vue/plugins/color-mode", { extensions: [".ts", ".mjs", ".js"], url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('unplugin.cjs', document.baseURI).href)) }));
50
+ }
51
+ return {
52
+ name: "bitrix24:b24ui:plugins",
53
+ enforce: "pre",
54
+ resolveId(id) {
55
+ if (id === "@bitrix24/b24ui-nuxt/vue-plugin") {
56
+ return "virtual:bitrix24-ui-plugins";
57
+ }
58
+ },
59
+ transform(code, id) {
60
+ if (plugins.some((p) => id.startsWith(p)) && code.includes("import.meta.client")) {
61
+ const s = new MagicString__default(code);
62
+ s.replaceAll("import.meta.client", "true");
63
+ if (s.hasChanged()) {
64
+ return {
65
+ code: s.toString(),
66
+ map: s.generateMap({ hires: true })
67
+ };
68
+ }
69
+ }
70
+ },
71
+ loadInclude: (id) => id === "virtual:bitrix24-ui-plugins",
72
+ load() {
73
+ return `
74
+ ${plugins.map((p) => `import ${knitwork.genSafeVariableName(p)} from "${p}"`).join("\n")}
75
+ export default {
76
+ install (app) {
77
+ ${plugins.map((p) => ` app.use(${knitwork.genSafeVariableName(p)})`).join("\n")}
78
+ }
79
+ }
80
+ `;
81
+ }
82
+ };
83
+ }
84
+
85
+ function AppConfigPlugin(options, appConfig) {
86
+ return {
87
+ name: "bitrix24:b24ui:app-config",
88
+ enforce: "pre",
89
+ resolveId(id) {
90
+ if (id === "#build/app.config") {
91
+ return "virtual:bitrix24-ui-app-config";
92
+ }
93
+ },
94
+ loadInclude: (id) => id === "virtual:bitrix24-ui-app-config",
95
+ load() {
96
+ return `
97
+ export default ${JSON.stringify(appConfig)}
98
+ `;
99
+ }
100
+ };
101
+ }
102
+
103
+ function ComponentImportPlugin(framework, options) {
104
+ const components = tinyglobby.globSync("**/*.vue", { cwd: pathe.join(runtimeDir, "components") });
105
+ const componentNames = new Set(components.map((c) => `B24${c.replace(/\.vue$/, "")}`));
106
+ const componentsContent = tinyglobby.globSync("**/*.vue", { cwd: pathe.join(runtimeDir, "components/content") });
107
+ const componentContentNames = new Set(componentsContent.map((c) => `B24${c.replace(/\.vue$/, "")}`));
108
+ const componentsProse = tinyglobby.globSync("**/*.vue", { cwd: pathe.join(runtimeDir, "components/prose") });
109
+ const componentProseNames = new Set(componentsProse.map((c) => `B24${c.replace(/\.vue$/, "")}`));
110
+ const overrides = tinyglobby.globSync("**/*.vue", { cwd: pathe.join(runtimeDir, "vue/components") });
111
+ const overrideNames = new Set(overrides.map((c) => `B24${c.replace(/\.vue$/, "")}`));
112
+ return [
113
+ /**
114
+ * This plugin aims to ensure we override certain components with Vue-compatible versions:
115
+ * <B24Icon> and <B24Link> currently.
116
+ */
117
+ {
118
+ name: "bitrix24:b24ui:components",
119
+ enforce: "pre",
120
+ resolveId(id, importer) {
121
+ if (!importer || !pathe.normalize(importer).includes(runtimeDir)) {
122
+ return;
123
+ }
124
+ if (!RELATIVE_IMPORT_RE.test(id)) {
125
+ return;
126
+ }
127
+ const filename = id.match(/([^/]+)\.vue$/)?.[1];
128
+ if (filename && overrideNames.has(`B24${filename}`)) {
129
+ return pathe.join(runtimeDir, "vue/components", `${filename}.vue`);
130
+ }
131
+ }
132
+ },
133
+ AutoImportComponents__default[framework]({
134
+ dts: options.dts ?? true,
135
+ exclude: [/[\\/]node_modules[\\/](?!\.pnpm|@bitrix24\/b24ui)/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
136
+ resolvers: [
137
+ (componentName) => {
138
+ if (overrideNames.has(componentName)) {
139
+ return {
140
+ name: "default",
141
+ from: pathe.join(runtimeDir, "vue/components", `${componentName.slice("B24".length)}.vue`)
142
+ };
143
+ }
144
+ if (componentContentNames.has(componentName)) {
145
+ return {
146
+ name: "default",
147
+ from: pathe.join(runtimeDir, "components/content", `${componentName.slice("B24".length)}.vue`)
148
+ };
149
+ }
150
+ if (componentProseNames.has(componentName)) {
151
+ return {
152
+ name: "default",
153
+ from: pathe.join(runtimeDir, "components/prose", `${componentName.slice("B24".length)}.vue`)
154
+ };
155
+ }
156
+ if (componentNames.has(componentName)) {
157
+ return {
158
+ name: "default",
159
+ from: pathe.join(runtimeDir, "components", `${componentName.slice("B24".length)}.vue`)
160
+ };
161
+ }
162
+ }
163
+ ]
164
+ })
165
+ ];
166
+ }
167
+ const RELATIVE_IMPORT_RE = /^\.{1,2}\//;
168
+
169
+ function Bitrix24EnvironmentPlugin() {
170
+ const stubPath = mlly.resolvePathSync("../runtime/vue/stubs", { extensions: [".ts", ".mjs", ".js"], url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('unplugin.cjs', document.baseURI).href)) });
171
+ return {
172
+ name: "bitrix24:b24ui",
173
+ enforce: "pre",
174
+ resolveId(id) {
175
+ if (id === "#imports") {
176
+ return stubPath;
177
+ }
178
+ },
179
+ transformInclude(id) {
180
+ return pathe.normalize(id).includes(runtimeDir);
181
+ },
182
+ transform(code) {
183
+ if (code.includes("import.meta.client")) {
184
+ const s = new MagicString__default(code);
185
+ s.replaceAll("import.meta.client", "true");
186
+ if (s.hasChanged()) {
187
+ return {
188
+ code: s.toString(),
189
+ map: s.generateMap({ hires: true })
190
+ };
191
+ }
192
+ }
193
+ }
194
+ };
195
+ }
196
+
197
+ const runtimeDir = pathe.normalize(node_url.fileURLToPath(new URL("./runtime", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('unplugin.cjs', document.baseURI).href)))));
198
+ const Bitrix24UIPlugin = unplugin.createUnplugin((_options = {}, meta) => {
199
+ const options = defu.defu(_options, { fonts: false, devtools: { enabled: false } }, templates.defaultOptions);
200
+ const appConfig = defu.defu({ b24ui: options.b24ui }, { b24ui: templates.getDefaultUiConfig() });
201
+ return [
202
+ Bitrix24EnvironmentPlugin(),
203
+ ...ComponentImportPlugin(meta.framework, options),
204
+ AutoImport__default[meta.framework]({ dts: options.dts ?? true, dirs: [pathe.join(runtimeDir, "composables")] }),
205
+ tailwind__default(),
206
+ PluginsPlugin(options),
207
+ TemplatePlugin(options),
208
+ AppConfigPlugin(options, appConfig)
209
+ ];
210
+ });
211
+
212
+ exports.Bitrix24UIPlugin = Bitrix24UIPlugin;
213
+ exports.runtimeDir = runtimeDir;
@@ -0,0 +1,22 @@
1
+ import * as unplugin from 'unplugin';
2
+ import * as b24ui from '#build/b24ui';
3
+ import { ModuleOptions } from './module.cjs';
4
+ import { DeepPartial } from '../dist/runtime/types/utils.js';
5
+ import '@nuxt/schema';
6
+ import '../dist/runtime/types/index.js';
7
+
8
+ type AppConfigB24UI = {} & DeepPartial<typeof b24ui>;
9
+ interface Bitrix24UIOptions extends Omit<ModuleOptions, 'colorMode'> {
10
+ /** Whether to generate declaration files for auto-imported components. */
11
+ dts?: boolean;
12
+ b24ui?: AppConfigB24UI;
13
+ /**
14
+ * Enable or disable `@vueuse/core` color-mode integration
15
+ * @defaultValue `true`
16
+ */
17
+ colorMode?: boolean;
18
+ }
19
+ declare const runtimeDir: string;
20
+ declare const Bitrix24UIPlugin: unplugin.UnpluginInstance<Bitrix24UIOptions | undefined, boolean>;
21
+
22
+ export { type Bitrix24UIOptions, Bitrix24UIPlugin, runtimeDir };
@@ -0,0 +1,22 @@
1
+ import * as unplugin from 'unplugin';
2
+ import * as b24ui from '#build/b24ui';
3
+ import { ModuleOptions } from './module.mjs';
4
+ import { DeepPartial } from '../dist/runtime/types/utils.js';
5
+ import '@nuxt/schema';
6
+ import '../dist/runtime/types/index.js';
7
+
8
+ type AppConfigB24UI = {} & DeepPartial<typeof b24ui>;
9
+ interface Bitrix24UIOptions extends Omit<ModuleOptions, 'colorMode'> {
10
+ /** Whether to generate declaration files for auto-imported components. */
11
+ dts?: boolean;
12
+ b24ui?: AppConfigB24UI;
13
+ /**
14
+ * Enable or disable `@vueuse/core` color-mode integration
15
+ * @defaultValue `true`
16
+ */
17
+ colorMode?: boolean;
18
+ }
19
+ declare const runtimeDir: string;
20
+ declare const Bitrix24UIPlugin: unplugin.UnpluginInstance<Bitrix24UIOptions | undefined, boolean>;
21
+
22
+ export { type Bitrix24UIOptions, Bitrix24UIPlugin, runtimeDir };
@@ -0,0 +1,22 @@
1
+ import * as unplugin from 'unplugin';
2
+ import * as b24ui from '#build/b24ui';
3
+ import { ModuleOptions } from './module.js';
4
+ import { DeepPartial } from '../dist/runtime/types/utils.js';
5
+ import '@nuxt/schema';
6
+ import '../dist/runtime/types/index.js';
7
+
8
+ type AppConfigB24UI = {} & DeepPartial<typeof b24ui>;
9
+ interface Bitrix24UIOptions extends Omit<ModuleOptions, 'colorMode'> {
10
+ /** Whether to generate declaration files for auto-imported components. */
11
+ dts?: boolean;
12
+ b24ui?: AppConfigB24UI;
13
+ /**
14
+ * Enable or disable `@vueuse/core` color-mode integration
15
+ * @defaultValue `true`
16
+ */
17
+ colorMode?: boolean;
18
+ }
19
+ declare const runtimeDir: string;
20
+ declare const Bitrix24UIPlugin: unplugin.UnpluginInstance<Bitrix24UIOptions | undefined, boolean>;
21
+
22
+ export { type Bitrix24UIOptions, Bitrix24UIPlugin, runtimeDir };
@@ -0,0 +1,202 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { join, normalize } from 'pathe';
3
+ import { createUnplugin } from 'unplugin';
4
+ import AutoImport from 'unplugin-auto-import';
5
+ import { defu } from 'defu';
6
+ import tailwind from '@tailwindcss/vite';
7
+ import { g as getTemplates, d as defaultOptions, a as getDefaultUiConfig } from './shared/b24ui-nuxt.CNGvMe2S.mjs';
8
+ import { globSync } from 'tinyglobby';
9
+ import { genSafeVariableName } from 'knitwork';
10
+ import MagicString from 'magic-string';
11
+ import { resolvePathSync } from 'mlly';
12
+ import AutoImportComponents from 'unplugin-vue-components';
13
+ import 'scule';
14
+ import '@nuxt/kit';
15
+
16
+ function TemplatePlugin(options) {
17
+ const templates = getTemplates(options);
18
+ const templateKeys = new Set(templates.map((t) => `#build/${t.filename}`));
19
+ return {
20
+ name: "bitrix24:b24ui:templates",
21
+ enforce: "pre",
22
+ resolveId(id) {
23
+ if (templateKeys.has(id + ".ts")) {
24
+ return id.replace("#build/", "virtual:bitrix24-ui-templates/") + ".ts";
25
+ }
26
+ },
27
+ loadInclude: (id) => templateKeys.has(id.replace("virtual:bitrix24-ui-templates/", "#build/")),
28
+ load(id) {
29
+ id = id.replace("virtual:bitrix24-ui-templates/", "#build/");
30
+ return templates.find((t) => `#build/${t.filename}` === id).getContents({});
31
+ }
32
+ };
33
+ }
34
+
35
+ function PluginsPlugin(options) {
36
+ const plugins = globSync(["**/*", "!*.d.ts"], { cwd: join(runtimeDir, "plugins"), absolute: true });
37
+ plugins.unshift(resolvePathSync("../runtime/vue/plugins/head", { extensions: [".ts", ".mjs", ".js"], url: import.meta.url }));
38
+ if (options.colorMode) {
39
+ plugins.push(resolvePathSync("../runtime/vue/plugins/color-mode", { extensions: [".ts", ".mjs", ".js"], url: import.meta.url }));
40
+ }
41
+ return {
42
+ name: "bitrix24:b24ui:plugins",
43
+ enforce: "pre",
44
+ resolveId(id) {
45
+ if (id === "@bitrix24/b24ui-nuxt/vue-plugin") {
46
+ return "virtual:bitrix24-ui-plugins";
47
+ }
48
+ },
49
+ transform(code, id) {
50
+ if (plugins.some((p) => id.startsWith(p)) && code.includes("import.meta.client")) {
51
+ const s = new MagicString(code);
52
+ s.replaceAll("import.meta.client", "true");
53
+ if (s.hasChanged()) {
54
+ return {
55
+ code: s.toString(),
56
+ map: s.generateMap({ hires: true })
57
+ };
58
+ }
59
+ }
60
+ },
61
+ loadInclude: (id) => id === "virtual:bitrix24-ui-plugins",
62
+ load() {
63
+ return `
64
+ ${plugins.map((p) => `import ${genSafeVariableName(p)} from "${p}"`).join("\n")}
65
+ export default {
66
+ install (app) {
67
+ ${plugins.map((p) => ` app.use(${genSafeVariableName(p)})`).join("\n")}
68
+ }
69
+ }
70
+ `;
71
+ }
72
+ };
73
+ }
74
+
75
+ function AppConfigPlugin(options, appConfig) {
76
+ return {
77
+ name: "bitrix24:b24ui:app-config",
78
+ enforce: "pre",
79
+ resolveId(id) {
80
+ if (id === "#build/app.config") {
81
+ return "virtual:bitrix24-ui-app-config";
82
+ }
83
+ },
84
+ loadInclude: (id) => id === "virtual:bitrix24-ui-app-config",
85
+ load() {
86
+ return `
87
+ export default ${JSON.stringify(appConfig)}
88
+ `;
89
+ }
90
+ };
91
+ }
92
+
93
+ function ComponentImportPlugin(framework, options) {
94
+ const components = globSync("**/*.vue", { cwd: join(runtimeDir, "components") });
95
+ const componentNames = new Set(components.map((c) => `B24${c.replace(/\.vue$/, "")}`));
96
+ const componentsContent = globSync("**/*.vue", { cwd: join(runtimeDir, "components/content") });
97
+ const componentContentNames = new Set(componentsContent.map((c) => `B24${c.replace(/\.vue$/, "")}`));
98
+ const componentsProse = globSync("**/*.vue", { cwd: join(runtimeDir, "components/prose") });
99
+ const componentProseNames = new Set(componentsProse.map((c) => `B24${c.replace(/\.vue$/, "")}`));
100
+ const overrides = globSync("**/*.vue", { cwd: join(runtimeDir, "vue/components") });
101
+ const overrideNames = new Set(overrides.map((c) => `B24${c.replace(/\.vue$/, "")}`));
102
+ return [
103
+ /**
104
+ * This plugin aims to ensure we override certain components with Vue-compatible versions:
105
+ * <B24Icon> and <B24Link> currently.
106
+ */
107
+ {
108
+ name: "bitrix24:b24ui:components",
109
+ enforce: "pre",
110
+ resolveId(id, importer) {
111
+ if (!importer || !normalize(importer).includes(runtimeDir)) {
112
+ return;
113
+ }
114
+ if (!RELATIVE_IMPORT_RE.test(id)) {
115
+ return;
116
+ }
117
+ const filename = id.match(/([^/]+)\.vue$/)?.[1];
118
+ if (filename && overrideNames.has(`B24${filename}`)) {
119
+ return join(runtimeDir, "vue/components", `${filename}.vue`);
120
+ }
121
+ }
122
+ },
123
+ AutoImportComponents[framework]({
124
+ dts: options.dts ?? true,
125
+ exclude: [/[\\/]node_modules[\\/](?!\.pnpm|@bitrix24\/b24ui)/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
126
+ resolvers: [
127
+ (componentName) => {
128
+ if (overrideNames.has(componentName)) {
129
+ return {
130
+ name: "default",
131
+ from: join(runtimeDir, "vue/components", `${componentName.slice("B24".length)}.vue`)
132
+ };
133
+ }
134
+ if (componentContentNames.has(componentName)) {
135
+ return {
136
+ name: "default",
137
+ from: join(runtimeDir, "components/content", `${componentName.slice("B24".length)}.vue`)
138
+ };
139
+ }
140
+ if (componentProseNames.has(componentName)) {
141
+ return {
142
+ name: "default",
143
+ from: join(runtimeDir, "components/prose", `${componentName.slice("B24".length)}.vue`)
144
+ };
145
+ }
146
+ if (componentNames.has(componentName)) {
147
+ return {
148
+ name: "default",
149
+ from: join(runtimeDir, "components", `${componentName.slice("B24".length)}.vue`)
150
+ };
151
+ }
152
+ }
153
+ ]
154
+ })
155
+ ];
156
+ }
157
+ const RELATIVE_IMPORT_RE = /^\.{1,2}\//;
158
+
159
+ function Bitrix24EnvironmentPlugin() {
160
+ const stubPath = resolvePathSync("../runtime/vue/stubs", { extensions: [".ts", ".mjs", ".js"], url: import.meta.url });
161
+ return {
162
+ name: "bitrix24:b24ui",
163
+ enforce: "pre",
164
+ resolveId(id) {
165
+ if (id === "#imports") {
166
+ return stubPath;
167
+ }
168
+ },
169
+ transformInclude(id) {
170
+ return normalize(id).includes(runtimeDir);
171
+ },
172
+ transform(code) {
173
+ if (code.includes("import.meta.client")) {
174
+ const s = new MagicString(code);
175
+ s.replaceAll("import.meta.client", "true");
176
+ if (s.hasChanged()) {
177
+ return {
178
+ code: s.toString(),
179
+ map: s.generateMap({ hires: true })
180
+ };
181
+ }
182
+ }
183
+ }
184
+ };
185
+ }
186
+
187
+ const runtimeDir = normalize(fileURLToPath(new URL("./runtime", import.meta.url)));
188
+ const Bitrix24UIPlugin = createUnplugin((_options = {}, meta) => {
189
+ const options = defu(_options, { fonts: false, devtools: { enabled: false } }, defaultOptions);
190
+ const appConfig = defu({ b24ui: options.b24ui }, { b24ui: getDefaultUiConfig() });
191
+ return [
192
+ Bitrix24EnvironmentPlugin(),
193
+ ...ComponentImportPlugin(meta.framework, options),
194
+ AutoImport[meta.framework]({ dts: options.dts ?? true, dirs: [join(runtimeDir, "composables")] }),
195
+ tailwind(),
196
+ PluginsPlugin(options),
197
+ TemplatePlugin(options),
198
+ AppConfigPlugin(options, appConfig)
199
+ ];
200
+ });
201
+
202
+ export { Bitrix24UIPlugin, runtimeDir };
package/dist/vite.cjs ADDED
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ const unplugin = require('./unplugin.cjs');
4
+ require('node:url');
5
+ require('pathe');
6
+ require('unplugin');
7
+ require('unplugin-auto-import');
8
+ require('defu');
9
+ require('@tailwindcss/vite');
10
+ require('./shared/b24ui-nuxt.D22QQtm8.cjs');
11
+ require('scule');
12
+ require('@nuxt/kit');
13
+ require('tinyglobby');
14
+ require('knitwork');
15
+ require('magic-string');
16
+ require('mlly');
17
+ require('unplugin-vue-components');
18
+
19
+ const vite = unplugin.Bitrix24UIPlugin.vite;
20
+
21
+ module.exports = vite;
@@ -0,0 +1,12 @@
1
+ import * as vite from 'vite';
2
+ import { Bitrix24UIOptions } from './unplugin.cjs';
3
+ import 'unplugin';
4
+ import '#build/b24ui';
5
+ import './module.cjs';
6
+ import '@nuxt/schema';
7
+ import '../dist/runtime/types/index.js';
8
+ import '../dist/runtime/types/utils.js';
9
+
10
+ declare const _default: (options?: Bitrix24UIOptions | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
11
+
12
+ export { Bitrix24UIOptions, _default as default };
@@ -0,0 +1,12 @@
1
+ import * as vite from 'vite';
2
+ import { Bitrix24UIOptions } from './unplugin.mjs';
3
+ import 'unplugin';
4
+ import '#build/b24ui';
5
+ import './module.mjs';
6
+ import '@nuxt/schema';
7
+ import '../dist/runtime/types/index.js';
8
+ import '../dist/runtime/types/utils.js';
9
+
10
+ declare const _default: (options?: Bitrix24UIOptions | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
11
+
12
+ export { Bitrix24UIOptions, _default as default };
package/dist/vite.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import * as vite from 'vite';
2
+ import { Bitrix24UIOptions } from './unplugin.js';
3
+ import 'unplugin';
4
+ import '#build/b24ui';
5
+ import './module.js';
6
+ import '@nuxt/schema';
7
+ import '../dist/runtime/types/index.js';
8
+ import '../dist/runtime/types/utils.js';
9
+
10
+ declare const _default: (options?: Bitrix24UIOptions | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
11
+
12
+ export { Bitrix24UIOptions, _default as default };
package/dist/vite.mjs ADDED
@@ -0,0 +1,19 @@
1
+ import { Bitrix24UIPlugin } from './unplugin.mjs';
2
+ import 'node:url';
3
+ import 'pathe';
4
+ import 'unplugin';
5
+ import 'unplugin-auto-import';
6
+ import 'defu';
7
+ import '@tailwindcss/vite';
8
+ import './shared/b24ui-nuxt.CNGvMe2S.mjs';
9
+ import 'scule';
10
+ import '@nuxt/kit';
11
+ import 'tinyglobby';
12
+ import 'knitwork';
13
+ import 'magic-string';
14
+ import 'mlly';
15
+ import 'unplugin-vue-components';
16
+
17
+ const vite = Bitrix24UIPlugin.vite;
18
+
19
+ export { vite as default };