@bitrix24/b24ui-nuxt 2.1.10 → 2.1.12
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.
- package/README-AI.md +1 -1
- package/dist/meta.d.mts +98220 -780
- package/dist/meta.mjs +98220 -780
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/ContextMenu.d.vue.ts +6 -2
- package/dist/runtime/components/ContextMenu.vue.d.ts +6 -2
- package/dist/runtime/components/ContextMenuContent.vue +2 -2
- package/dist/runtime/components/DropdownMenu.d.vue.ts +6 -2
- package/dist/runtime/components/DropdownMenu.vue.d.ts +6 -2
- package/dist/runtime/components/DropdownMenuContent.vue +2 -2
- package/dist/runtime/components/Editor.d.vue.ts +87 -0
- package/dist/runtime/components/Editor.vue +185 -0
- package/dist/runtime/components/Editor.vue.d.ts +87 -0
- package/dist/runtime/components/EditorDragHandle.d.vue.ts +60 -0
- package/dist/runtime/components/EditorDragHandle.vue +128 -0
- package/dist/runtime/components/EditorDragHandle.vue.d.ts +60 -0
- package/dist/runtime/components/EditorEmojiMenu.d.vue.ts +35 -0
- package/dist/runtime/components/EditorEmojiMenu.vue +70 -0
- package/dist/runtime/components/EditorEmojiMenu.vue.d.ts +35 -0
- package/dist/runtime/components/EditorMentionMenu.d.vue.ts +39 -0
- package/dist/runtime/components/EditorMentionMenu.vue +74 -0
- package/dist/runtime/components/EditorMentionMenu.vue.d.ts +39 -0
- package/dist/runtime/components/EditorSuggestionMenu.d.vue.ts +52 -0
- package/dist/runtime/components/EditorSuggestionMenu.vue +79 -0
- package/dist/runtime/components/EditorSuggestionMenu.vue.d.ts +52 -0
- package/dist/runtime/components/EditorToolbar.d.vue.ts +80 -0
- package/dist/runtime/components/EditorToolbar.vue +239 -0
- package/dist/runtime/components/EditorToolbar.vue.d.ts +80 -0
- package/dist/runtime/components/FormField.vue +2 -2
- package/dist/runtime/components/InputMenu.d.vue.ts +2 -0
- package/dist/runtime/components/InputMenu.vue +14 -1
- package/dist/runtime/components/InputMenu.vue.d.ts +2 -0
- package/dist/runtime/components/Pagination.d.vue.ts +0 -1
- package/dist/runtime/components/Pagination.vue.d.ts +0 -1
- package/dist/runtime/components/Select.d.vue.ts +2 -0
- package/dist/runtime/components/Select.vue +14 -1
- package/dist/runtime/components/Select.vue.d.ts +2 -0
- package/dist/runtime/components/SelectMenu.d.vue.ts +2 -0
- package/dist/runtime/components/SelectMenu.vue +14 -1
- package/dist/runtime/components/SelectMenu.vue.d.ts +2 -0
- package/dist/runtime/components/color-mode/ColorModeSelect.vue +1 -0
- package/dist/runtime/components/locale/LocaleSelect.vue +1 -0
- package/dist/runtime/components/prose/Accordion.vue +1 -1
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -0
- package/dist/runtime/composables/defineShortcuts.js +60 -13
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/useEditorMenu.d.ts +64 -0
- package/dist/runtime/composables/useEditorMenu.js +448 -0
- package/dist/runtime/composables/useSpeechRecognition.d.ts +122 -0
- package/dist/runtime/composables/useSpeechRecognition.js +166 -0
- package/dist/runtime/dictionary/icons.d.ts +1 -0
- package/dist/runtime/dictionary/icons.js +5 -3
- package/dist/runtime/types/editor.d.ts +69 -0
- package/dist/runtime/types/editor.js +0 -0
- package/dist/runtime/types/index.d.ts +7 -0
- package/dist/runtime/types/index.js +7 -0
- package/dist/runtime/utils/editor.d.ts +69 -0
- package/dist/runtime/utils/editor.js +364 -0
- package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +1 -0
- package/dist/shared/{b24ui-nuxt.BCphUjPy.mjs → b24ui-nuxt.C8MyFqPm.mjs} +185 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +16 -3
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { flip, shift, offset, size, autoPlacement, hide, inline } from "@floating-ui/dom";
|
|
2
|
+
import { isArrayOfArray } from "./index.js";
|
|
3
|
+
export function isMarkInSchema(mark, editor) {
|
|
4
|
+
if (!editor?.schema) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
const markName = typeof mark === "string" ? mark : mark.name;
|
|
8
|
+
return editor.schema.spec.marks.get(markName) !== void 0;
|
|
9
|
+
}
|
|
10
|
+
export function isNodeTypeSelected(editor, nodeTypes) {
|
|
11
|
+
if (!editor) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const { selection } = editor.state;
|
|
15
|
+
const { $from, to } = selection;
|
|
16
|
+
return nodeTypes.some((nodeType) => {
|
|
17
|
+
return editor.state.doc.nodesBetween($from.pos, to, (node) => {
|
|
18
|
+
return node.type.name === nodeType;
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function isExtensionAvailable(editor, extensionName) {
|
|
23
|
+
if (!editor) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return editor.extensionManager.extensions.some((ext) => ext.name === extensionName);
|
|
27
|
+
}
|
|
28
|
+
export function createToggleHandler(name) {
|
|
29
|
+
const fnName = `toggle${name.charAt(0).toUpperCase()}${name.slice(1)}`;
|
|
30
|
+
return {
|
|
31
|
+
canExecute: (editor) => editor.can()[fnName](),
|
|
32
|
+
execute: (editor) => editor.chain().focus()[fnName](),
|
|
33
|
+
isActive: (editor) => editor.isActive(name),
|
|
34
|
+
isDisabled: (editor) => isNodeTypeSelected(editor, ["image"]) || editor.isActive("code")
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function createSetHandler(name) {
|
|
38
|
+
const fnName = `set${name.charAt(0).toUpperCase()}${name.slice(1)}`;
|
|
39
|
+
return {
|
|
40
|
+
canExecute: (editor) => editor.can()[fnName](),
|
|
41
|
+
execute: (editor) => editor.chain().focus()[fnName](),
|
|
42
|
+
isActive: (editor) => editor.isActive(name),
|
|
43
|
+
isDisabled: (editor) => isNodeTypeSelected(editor, ["image"]) || editor.isActive("code")
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function createSimpleHandler(name) {
|
|
47
|
+
return {
|
|
48
|
+
canExecute: (editor) => editor.can()[name](),
|
|
49
|
+
execute: (editor) => editor.chain()[name](),
|
|
50
|
+
isActive: () => false,
|
|
51
|
+
isDisabled: void 0
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function createMarkHandler() {
|
|
55
|
+
return {
|
|
56
|
+
canExecute: (editor, cmd) => editor.can().toggleMark(cmd.mark),
|
|
57
|
+
execute: (editor, cmd) => editor.chain().focus().toggleMark(cmd.mark),
|
|
58
|
+
isActive: (editor, cmd) => editor.isActive(cmd.mark),
|
|
59
|
+
isDisabled: (editor, cmd) => !isMarkInSchema(cmd.mark, editor) || isNodeTypeSelected(editor, ["image"])
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function createTextAlignHandler() {
|
|
63
|
+
return {
|
|
64
|
+
canExecute: (editor, cmd) => editor.can().setTextAlign(cmd.align),
|
|
65
|
+
execute: (editor, cmd) => editor.chain().focus().setTextAlign(cmd.align),
|
|
66
|
+
isActive: (editor, cmd) => editor.isActive({ textAlign: cmd.align }),
|
|
67
|
+
isDisabled: (editor) => !isExtensionAvailable(editor, "textAlign") || isNodeTypeSelected(editor, ["image", "horizontalRule"])
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function createHeadingHandler() {
|
|
71
|
+
return {
|
|
72
|
+
canExecute: (editor, cmd) => editor.can().toggleHeading({ level: cmd.level }),
|
|
73
|
+
execute: (editor, cmd) => editor.chain().focus().toggleHeading({ level: cmd.level }),
|
|
74
|
+
isActive: (editor, cmd) => editor.isActive("heading", { level: cmd.level }),
|
|
75
|
+
isDisabled: (editor) => isNodeTypeSelected(editor, ["image"]) || editor.isActive("code")
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export function createLinkHandler() {
|
|
79
|
+
return {
|
|
80
|
+
canExecute: (editor) => {
|
|
81
|
+
return editor.can().setLink({ href: "" }) || editor.can().unsetLink();
|
|
82
|
+
},
|
|
83
|
+
execute: (editor, cmd) => {
|
|
84
|
+
const chain = editor.chain();
|
|
85
|
+
const previousUrl = editor.getAttributes("link").href;
|
|
86
|
+
if (previousUrl) {
|
|
87
|
+
return chain.focus().unsetLink();
|
|
88
|
+
}
|
|
89
|
+
if (cmd?.href) {
|
|
90
|
+
return chain.focus().setLink({ href: cmd.href });
|
|
91
|
+
}
|
|
92
|
+
const href = prompt("Enter the URL:");
|
|
93
|
+
if (href) {
|
|
94
|
+
return chain.focus().setLink({ href });
|
|
95
|
+
}
|
|
96
|
+
return chain;
|
|
97
|
+
},
|
|
98
|
+
isActive: (editor) => editor.isActive("link"),
|
|
99
|
+
isDisabled: (editor) => {
|
|
100
|
+
if (!isExtensionAvailable(editor, "link") || isNodeTypeSelected(editor, ["image"])) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
const { selection } = editor.state;
|
|
104
|
+
return selection.empty && !editor.isActive("link");
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export function createImageHandler() {
|
|
109
|
+
return {
|
|
110
|
+
canExecute: (editor) => {
|
|
111
|
+
return editor.can().setImage({ src: "" });
|
|
112
|
+
},
|
|
113
|
+
execute: (editor, cmd) => {
|
|
114
|
+
const chain = editor.chain().focus();
|
|
115
|
+
if (cmd?.src) {
|
|
116
|
+
return chain.setImage({ src: cmd.src });
|
|
117
|
+
}
|
|
118
|
+
const src = prompt("Enter the image URL:");
|
|
119
|
+
if (src) {
|
|
120
|
+
return chain.setImage({ src });
|
|
121
|
+
}
|
|
122
|
+
return chain;
|
|
123
|
+
},
|
|
124
|
+
isActive: (editor) => editor.isActive("image"),
|
|
125
|
+
isDisabled: (editor) => {
|
|
126
|
+
return !isExtensionAvailable(editor, "image");
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export function createListHandler(listType) {
|
|
131
|
+
const fnName = listType === "bulletList" ? "toggleBulletList" : "toggleOrderedList";
|
|
132
|
+
return {
|
|
133
|
+
canExecute: (editor) => {
|
|
134
|
+
return editor.can()[fnName]() || editor.isActive("bulletList") || editor.isActive("orderedList");
|
|
135
|
+
},
|
|
136
|
+
execute: (editor) => {
|
|
137
|
+
const { state } = editor;
|
|
138
|
+
const { selection } = state;
|
|
139
|
+
let chain = editor.chain().focus();
|
|
140
|
+
if (selection.node) {
|
|
141
|
+
const node = selection.node;
|
|
142
|
+
const firstChild = node.firstChild?.firstChild;
|
|
143
|
+
const lastChild = node.lastChild?.lastChild;
|
|
144
|
+
const from = firstChild ? selection.from + firstChild.nodeSize : selection.from + 1;
|
|
145
|
+
const to = lastChild ? selection.to - lastChild.nodeSize : selection.to - 1;
|
|
146
|
+
chain = chain.setTextSelection({ from, to }).clearNodes();
|
|
147
|
+
}
|
|
148
|
+
if (editor.isActive(listType)) {
|
|
149
|
+
return chain.liftListItem("listItem").lift("bulletList").lift("orderedList").selectTextblockEnd();
|
|
150
|
+
}
|
|
151
|
+
return chain[fnName]().selectTextblockEnd();
|
|
152
|
+
},
|
|
153
|
+
isActive: (editor) => editor.isActive(listType),
|
|
154
|
+
isDisabled: (editor) => isNodeTypeSelected(editor, ["image"]) || editor.isActive("code")
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export function createMoveHandler(direction) {
|
|
158
|
+
return {
|
|
159
|
+
canExecute: (editor, cmd) => {
|
|
160
|
+
if (cmd?.pos == null) return false;
|
|
161
|
+
const node = editor.state.doc.nodeAt(cmd.pos);
|
|
162
|
+
if (!node) return false;
|
|
163
|
+
const $pos = editor.state.doc.resolve(cmd.pos);
|
|
164
|
+
const parent = $pos.parent;
|
|
165
|
+
const index = $pos.index();
|
|
166
|
+
return direction === "up" ? index > 0 : index < parent.childCount - 1;
|
|
167
|
+
},
|
|
168
|
+
execute: (editor, cmd) => {
|
|
169
|
+
if (cmd?.pos == null) return editor.chain();
|
|
170
|
+
const node = editor.state.doc.nodeAt(cmd.pos);
|
|
171
|
+
if (!node) return editor.chain();
|
|
172
|
+
const $pos = editor.state.doc.resolve(cmd.pos);
|
|
173
|
+
const parent = $pos.parent;
|
|
174
|
+
const index = $pos.index();
|
|
175
|
+
if (direction === "up" && index > 0) {
|
|
176
|
+
const prevNode = parent.child(index - 1);
|
|
177
|
+
const targetPos = cmd.pos - prevNode.nodeSize;
|
|
178
|
+
return editor.chain().focus().deleteRange({ from: cmd.pos, to: cmd.pos + node.nodeSize }).insertContentAt(targetPos, node.toJSON());
|
|
179
|
+
}
|
|
180
|
+
if (direction === "down" && index < parent.childCount - 1) {
|
|
181
|
+
const nextNode = parent.child(index + 1);
|
|
182
|
+
const targetPos = cmd.pos + nextNode.nodeSize;
|
|
183
|
+
return editor.chain().focus().deleteRange({ from: cmd.pos, to: cmd.pos + node.nodeSize }).insertContentAt(targetPos, node.toJSON());
|
|
184
|
+
}
|
|
185
|
+
return editor.chain();
|
|
186
|
+
},
|
|
187
|
+
isActive: () => false,
|
|
188
|
+
isDisabled: void 0
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
export function createHandlers() {
|
|
192
|
+
return {
|
|
193
|
+
mark: createMarkHandler(),
|
|
194
|
+
textAlign: createTextAlignHandler(),
|
|
195
|
+
heading: createHeadingHandler(),
|
|
196
|
+
link: createLinkHandler(),
|
|
197
|
+
image: createImageHandler(),
|
|
198
|
+
blockquote: createToggleHandler("blockquote"),
|
|
199
|
+
bulletList: createListHandler("bulletList"),
|
|
200
|
+
orderedList: createListHandler("orderedList"),
|
|
201
|
+
codeBlock: createToggleHandler("codeBlock"),
|
|
202
|
+
horizontalRule: createSetHandler("horizontalRule"),
|
|
203
|
+
paragraph: createSetHandler("paragraph"),
|
|
204
|
+
undo: createSimpleHandler("undo"),
|
|
205
|
+
redo: createSimpleHandler("redo"),
|
|
206
|
+
clearFormatting: {
|
|
207
|
+
canExecute: (editor, cmd) => {
|
|
208
|
+
if (cmd?.pos != null) {
|
|
209
|
+
const node = editor.state.doc.nodeAt(cmd.pos);
|
|
210
|
+
return !!node;
|
|
211
|
+
}
|
|
212
|
+
return editor.can().clearNodes() || editor.can().unsetAllMarks();
|
|
213
|
+
},
|
|
214
|
+
execute: (editor, cmd) => {
|
|
215
|
+
if (cmd?.pos != null) {
|
|
216
|
+
const node = editor.state.doc.nodeAt(cmd.pos);
|
|
217
|
+
if (!node) return editor.chain();
|
|
218
|
+
const from = cmd.pos + 1;
|
|
219
|
+
const to = cmd.pos + node.nodeSize - 1;
|
|
220
|
+
return editor.chain().focus().setTextSelection({ from, to }).clearNodes().unsetAllMarks();
|
|
221
|
+
}
|
|
222
|
+
return editor.chain().focus().clearNodes().unsetAllMarks();
|
|
223
|
+
},
|
|
224
|
+
isActive: () => false,
|
|
225
|
+
isDisabled: void 0
|
|
226
|
+
},
|
|
227
|
+
duplicate: {
|
|
228
|
+
canExecute: (editor, cmd) => {
|
|
229
|
+
if (cmd?.pos == null) return false;
|
|
230
|
+
const node = editor.state.doc.nodeAt(cmd.pos);
|
|
231
|
+
return !!node;
|
|
232
|
+
},
|
|
233
|
+
execute: (editor, cmd) => {
|
|
234
|
+
if (cmd?.pos == null) return editor.chain();
|
|
235
|
+
const node = editor.state.doc.nodeAt(cmd.pos);
|
|
236
|
+
if (!node) return editor.chain();
|
|
237
|
+
return editor.chain().focus().insertContentAt(cmd.pos + node.nodeSize, node.toJSON());
|
|
238
|
+
},
|
|
239
|
+
isActive: () => false,
|
|
240
|
+
isDisabled: void 0
|
|
241
|
+
},
|
|
242
|
+
delete: {
|
|
243
|
+
canExecute: (editor, cmd) => {
|
|
244
|
+
if (cmd?.pos == null) return false;
|
|
245
|
+
const node = editor.state.doc.nodeAt(cmd.pos);
|
|
246
|
+
return !!node;
|
|
247
|
+
},
|
|
248
|
+
execute: (editor, cmd) => {
|
|
249
|
+
if (cmd?.pos == null) return editor.chain();
|
|
250
|
+
const node = editor.state.doc.nodeAt(cmd.pos);
|
|
251
|
+
if (!node) return editor.chain();
|
|
252
|
+
return editor.chain().focus().deleteRange({ from: cmd.pos, to: cmd.pos + node.nodeSize });
|
|
253
|
+
},
|
|
254
|
+
isActive: () => false,
|
|
255
|
+
isDisabled: void 0
|
|
256
|
+
},
|
|
257
|
+
moveUp: createMoveHandler("up"),
|
|
258
|
+
moveDown: createMoveHandler("down"),
|
|
259
|
+
suggestion: {
|
|
260
|
+
canExecute: () => true,
|
|
261
|
+
execute: (editor, cmd) => {
|
|
262
|
+
const { state } = editor;
|
|
263
|
+
const { selection } = state;
|
|
264
|
+
const { $from } = selection;
|
|
265
|
+
if (cmd?.pos !== void 0) {
|
|
266
|
+
const node = state.doc.nodeAt(cmd.pos);
|
|
267
|
+
if (node) {
|
|
268
|
+
const insertPos2 = cmd.pos + node.nodeSize;
|
|
269
|
+
return editor.chain().focus().insertContentAt(insertPos2, { type: "paragraph", content: [{ type: "text", text: "/" }] });
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const currentNode = $from.node($from.depth);
|
|
273
|
+
const currentNodePos = $from.before($from.depth);
|
|
274
|
+
const insertPos = currentNodePos + currentNode.nodeSize;
|
|
275
|
+
return editor.chain().focus().insertContentAt(insertPos, { type: "paragraph", content: [{ type: "text", text: "/" }] });
|
|
276
|
+
},
|
|
277
|
+
isActive: () => false,
|
|
278
|
+
isDisabled: void 0
|
|
279
|
+
},
|
|
280
|
+
mention: {
|
|
281
|
+
canExecute: () => true,
|
|
282
|
+
execute: (editor) => {
|
|
283
|
+
const { state } = editor;
|
|
284
|
+
const { selection } = state;
|
|
285
|
+
const { $from } = selection;
|
|
286
|
+
const textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - 1), $from.parentOffset, void 0, " ");
|
|
287
|
+
const needsSpace = textBefore && textBefore !== " ";
|
|
288
|
+
return editor.chain().focus().insertContent(needsSpace ? " @" : "@");
|
|
289
|
+
},
|
|
290
|
+
isActive: () => false,
|
|
291
|
+
isDisabled: void 0
|
|
292
|
+
},
|
|
293
|
+
emoji: {
|
|
294
|
+
canExecute: () => true,
|
|
295
|
+
execute: (editor) => {
|
|
296
|
+
const { state } = editor;
|
|
297
|
+
const { selection } = state;
|
|
298
|
+
const { $from } = selection;
|
|
299
|
+
const textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - 1), $from.parentOffset, void 0, " ");
|
|
300
|
+
const needsSpace = textBefore && textBefore !== " ";
|
|
301
|
+
return editor.chain().focus().insertContent(needsSpace ? " :" : ":");
|
|
302
|
+
},
|
|
303
|
+
isActive: () => false,
|
|
304
|
+
isDisabled: void 0
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
export function mapEditorItems(editor, items, customHandlers) {
|
|
309
|
+
const handlers = { ...createHandlers(), ...customHandlers };
|
|
310
|
+
if (isArrayOfArray(items)) {
|
|
311
|
+
return items.map(
|
|
312
|
+
(group) => mapEditorItems(editor, group, customHandlers)
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
return items.filter(Boolean).map((item) => {
|
|
316
|
+
if ("type" in item) {
|
|
317
|
+
return item;
|
|
318
|
+
}
|
|
319
|
+
const { kind, children, ...rest } = item;
|
|
320
|
+
const processedChildren = children?.length ? mapEditorItems(editor, children, customHandlers) : void 0;
|
|
321
|
+
if (kind) {
|
|
322
|
+
const handler = handlers[kind];
|
|
323
|
+
if (!handler) {
|
|
324
|
+
return {
|
|
325
|
+
...rest,
|
|
326
|
+
children: processedChildren
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
...rest,
|
|
331
|
+
children: processedChildren,
|
|
332
|
+
disabled: handler.isDisabled?.(editor, item) || !handler.canExecute(editor, item),
|
|
333
|
+
active: handler.isActive(editor, item),
|
|
334
|
+
onSelect: () => handler.execute(editor, item).run()
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
return { ...rest, children: processedChildren };
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
export function buildFloatingUIMiddleware(options) {
|
|
341
|
+
const middleware = [];
|
|
342
|
+
if (options.offset) {
|
|
343
|
+
middleware.push(offset(typeof options.offset !== "boolean" ? options.offset : void 0));
|
|
344
|
+
}
|
|
345
|
+
if (options.flip) {
|
|
346
|
+
middleware.push(flip(typeof options.flip !== "boolean" ? options.flip : void 0));
|
|
347
|
+
}
|
|
348
|
+
if (options.shift) {
|
|
349
|
+
middleware.push(shift(typeof options.shift !== "boolean" ? options.shift : void 0));
|
|
350
|
+
}
|
|
351
|
+
if (options.size) {
|
|
352
|
+
middleware.push(size(typeof options.size !== "boolean" ? options.size : void 0));
|
|
353
|
+
}
|
|
354
|
+
if (options.autoPlacement) {
|
|
355
|
+
middleware.push(autoPlacement(typeof options.autoPlacement !== "boolean" ? options.autoPlacement : void 0));
|
|
356
|
+
}
|
|
357
|
+
if (options.hide) {
|
|
358
|
+
middleware.push(hide(typeof options.hide !== "boolean" ? options.hide : void 0));
|
|
359
|
+
}
|
|
360
|
+
if (options.inline) {
|
|
361
|
+
middleware.push(inline(typeof options.inline !== "boolean" ? options.inline : void 0));
|
|
362
|
+
}
|
|
363
|
+
return middleware;
|
|
364
|
+
}
|
|
@@ -33,6 +33,7 @@ const props = defineProps({
|
|
|
33
33
|
labelKey: { type: null, required: false },
|
|
34
34
|
descriptionKey: { type: null, required: false },
|
|
35
35
|
defaultValue: { type: null, required: false },
|
|
36
|
+
modelModifiers: { type: Object, required: false },
|
|
36
37
|
multiple: { type: Boolean, required: false },
|
|
37
38
|
highlight: { type: Boolean, required: false },
|
|
38
39
|
createItem: { type: [Boolean, String, Object], required: false },
|
|
@@ -8,7 +8,7 @@ import { globSync } from 'tinyglobby';
|
|
|
8
8
|
import { defuFn } from 'defu';
|
|
9
9
|
|
|
10
10
|
const name = "@bitrix24/b24ui-nuxt";
|
|
11
|
-
const version = "2.1.
|
|
11
|
+
const version = "2.1.12";
|
|
12
12
|
|
|
13
13
|
function getDefaultConfig(theme) {
|
|
14
14
|
return {
|
|
@@ -3035,6 +3035,182 @@ const dropdownMenu = {
|
|
|
3035
3035
|
defaultVariants: {}
|
|
3036
3036
|
};
|
|
3037
3037
|
|
|
3038
|
+
const editor = {
|
|
3039
|
+
slots: {
|
|
3040
|
+
root: "light",
|
|
3041
|
+
content: "relative size-full flex-1",
|
|
3042
|
+
base: [
|
|
3043
|
+
"w-full outline-none *:my-5 *:first:mt-0 *:last:mb-0 sm:px-8 selection:bg-(--ui-color-design-selection-bg)",
|
|
3044
|
+
// Placeholder
|
|
3045
|
+
"[&_:is(p,h1,h2,h3,h4).is-empty]:before:content-[attr(data-placeholder)] [&_:is(p,h1,h2,h3,h4).is-empty]:before:text-(--b24ui-typography-label-color) [&_:is(p,h1,h2,h3,h4).is-empty]:before:float-left [&_:is(p,h1,h2,h3,h4).is-empty]:before:h-0 [&_:is(p,h1,h2,h3,h4).is-empty]:before:pointer-events-none",
|
|
3046
|
+
"[&_li_.is-empty]:before:content-none",
|
|
3047
|
+
// Paragraph
|
|
3048
|
+
"[&_p]:leading-7",
|
|
3049
|
+
// Links
|
|
3050
|
+
"[&_a]:text-(--ui-color-accent-main-primary) [&_a]:border-b [&_a]:border-transparent [&_a]:hover:border-(--ui-color-accent-main-primary) [&_a]:font-(--ui-font-weight-medium)",
|
|
3051
|
+
"[&_a]:transition-colors",
|
|
3052
|
+
// Mentions
|
|
3053
|
+
"[&_.mention]:text-(--ui-color-accent-main-primary) [&_.mention]:font-(--ui-font-weight-medium)",
|
|
3054
|
+
// Headings - shared styles
|
|
3055
|
+
"[&_:is(h1,h2,h3,h4)]:text-(--b24ui-typography-label-color) [&_:is(h1,h2,h3,h4)]:font-(--ui-font-weight-bold)",
|
|
3056
|
+
// Headings - unique styles
|
|
3057
|
+
"[&_h1]:text-3xl",
|
|
3058
|
+
"[&_h2]:text-2xl",
|
|
3059
|
+
"[&_h3]:text-xl",
|
|
3060
|
+
"[&_h4]:text-lg",
|
|
3061
|
+
// Code inside headings
|
|
3062
|
+
"[&_:is(h1,h2,h3,h4)>code]:border-dashed [&_:is(h1,h2,h3,h4)>code]:font-(--ui-font-weight-bold)",
|
|
3063
|
+
"[&_h2>code]:text-xl/6",
|
|
3064
|
+
"[&_h3>code]:text-lg/5",
|
|
3065
|
+
// Blockquote & HR
|
|
3066
|
+
"[&_blockquote]:border-s-4 [&_blockquote]:border-(--ui-color-accent-soft-element-blue) [&_blockquote]:ps-4 [&_blockquote]:italic",
|
|
3067
|
+
"[&_[data-type=horizontalRule]]:my-8 [&_[data-type=horizontalRule]]:py-2",
|
|
3068
|
+
"[&_hr]:border-t [&_hr]:border-(--ui-color-divider-default)",
|
|
3069
|
+
// Code blocks
|
|
3070
|
+
"[&_pre]:text-sm/6 [&_pre]:border [&_pre]:border-(--ui-color-design-tinted-na-stroke) [&_pre]:bg-(--ui-color-design-tinted-na-bg) [&_pre]:rounded-md [&_pre]:px-4 [&_pre]:py-3 [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:overflow-x-auto",
|
|
3071
|
+
"[&_pre_code]:p-0 [&_pre_code]:text-inherit [&_pre_code]:font-inherit [&_pre_code]:rounded-none [&_pre_code]:inline [&_pre_code]:border-0 [&_pre_code]:bg-transparent",
|
|
3072
|
+
// Inline code
|
|
3073
|
+
"[&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-sm [&_code]:font-[family-name:var(--ui-font-family-system-mono)] [&_code]:font-(--ui-font-weight-medium) [&_code]:rounded-md [&_code]:inline-block [&_code]:border [&_code]:border-(--ui-color-design-tinted-na-stroke) [&_code]:text-(--b24ui-typography-label-color) [&_code]:bg-(--ui-color-design-tinted-na-bg)",
|
|
3074
|
+
// Lists
|
|
3075
|
+
"[&_:is(ul,ol)]:ps-6",
|
|
3076
|
+
"[&_ul]:list-disc [&_ul]:marker:text-(--ui-color-accent-soft-element-blue)",
|
|
3077
|
+
"[&_ol]:list-decimal [&_ol]:marker:text-(--b24ui-typography-label-color)",
|
|
3078
|
+
"[&_li]:my-1.5 [&_li]:ps-1.5",
|
|
3079
|
+
// Images
|
|
3080
|
+
"[&_img]:rounded-md [&_img]:block [&_img]:max-w-full [&_img.ProseMirror-selectednode]:outline-2 [&_img.ProseMirror-selectednode]:outline-(--ui-color-accent-main-primary)",
|
|
3081
|
+
// Selected nodes
|
|
3082
|
+
"[&_.ProseMirror-selectednode:not(img):not(pre):not([data-node-view-wrapper])]:bg-(--ui-color-design-selection-bg)"
|
|
3083
|
+
].join(" ")
|
|
3084
|
+
}
|
|
3085
|
+
};
|
|
3086
|
+
|
|
3087
|
+
const editorDragHandle = {
|
|
3088
|
+
slots: {
|
|
3089
|
+
root: "hidden sm:flex items-center justify-center transition-all duration-200 ease-out",
|
|
3090
|
+
handle: "cursor-grab px-1"
|
|
3091
|
+
}
|
|
3092
|
+
};
|
|
3093
|
+
|
|
3094
|
+
const editorSuggestionMenu = {
|
|
3095
|
+
slots: {
|
|
3096
|
+
content: [
|
|
3097
|
+
"light",
|
|
3098
|
+
"bg-(--popup-window-background-color)",
|
|
3099
|
+
"shadow-(--popup-window-box-shadow)",
|
|
3100
|
+
"rounded-(--popup-window-border-radius) will-change-[opacity]",
|
|
3101
|
+
"motion-safe:data-[state=open]:animate-[scale-in_100ms_ease-out] motion-safe:data-[state=closed]:animate-[scale-out_100ms_ease-in]",
|
|
3102
|
+
"origin-(--reka-dropdown-menu-content-transform-origin)",
|
|
3103
|
+
"font-[family-name:var(--ui-font-family-primary)]",
|
|
3104
|
+
"relative",
|
|
3105
|
+
"isolate",
|
|
3106
|
+
"px-0 py-(--menu-popup-padding)",
|
|
3107
|
+
"pointer-events-auto"
|
|
3108
|
+
].join(" "),
|
|
3109
|
+
viewport: [
|
|
3110
|
+
"relative",
|
|
3111
|
+
"w-full max-h-[40vh] min-w-[120px] max-w-[192px]",
|
|
3112
|
+
"overflow-x-hidden overflow-y-auto scrollbar-thin"
|
|
3113
|
+
// scrollbar-transparent
|
|
3114
|
+
].join(" "),
|
|
3115
|
+
group: "grid",
|
|
3116
|
+
// p-1 isolate
|
|
3117
|
+
label: [
|
|
3118
|
+
"w-full h-(--popup-window-delimiter-section-height)",
|
|
3119
|
+
// min-w-[195px]
|
|
3120
|
+
"px-[18px] mt-(--menu-item-block-stack-space)",
|
|
3121
|
+
"flex flex-row rtl:flex-row-reverse items-center",
|
|
3122
|
+
"select-none outline-none whitespace-nowrap",
|
|
3123
|
+
"text-start",
|
|
3124
|
+
"text-(length:--popup-window-delimiter-font-size)",
|
|
3125
|
+
"text-(--popup-window-delimiter-text-color)",
|
|
3126
|
+
"font-(--popup-window-delimiter-font-weight)",
|
|
3127
|
+
"after:ms-[10px] after:block after:flex-1 after:min-w-[15px] after:h-px after:bg-(--popup-window-delimiter-bg-color)"
|
|
3128
|
+
].join(" "),
|
|
3129
|
+
item: [
|
|
3130
|
+
"group",
|
|
3131
|
+
"w-full h-[36px]",
|
|
3132
|
+
// min-w-[195px]
|
|
3133
|
+
"px-[18px] mt-(--menu-item-block-stack-space)",
|
|
3134
|
+
"relative",
|
|
3135
|
+
"flex flex-row rtl:flex-row-reverse items-center",
|
|
3136
|
+
"select-none outline-none whitespace-nowrap",
|
|
3137
|
+
"cursor-pointer",
|
|
3138
|
+
"data-disabled:cursor-not-allowed data-disabled:opacity-30",
|
|
3139
|
+
"text-start",
|
|
3140
|
+
"text-(length:--menu-popup-item-font-size)",
|
|
3141
|
+
"text-(--menu-popup-item-color) hover:text-(--menu-popup-item-color-hover)",
|
|
3142
|
+
"data-highlighted:text-(--menu-popup-item-color-hover)",
|
|
3143
|
+
"data-[state=open]:text-(--menu-popup-item-color-hover)",
|
|
3144
|
+
"hover:bg-(--menu-popup-item-bg-color-hover)",
|
|
3145
|
+
"data-highlighted:bg-(--menu-popup-item-bg-color-hover)",
|
|
3146
|
+
"data-[state=open]:bg-(--menu-popup-item-bg-color-hover)",
|
|
3147
|
+
"transition-colors"
|
|
3148
|
+
].join(" "),
|
|
3149
|
+
itemLeadingIcon: [
|
|
3150
|
+
"shrink-0",
|
|
3151
|
+
"size-[18px]",
|
|
3152
|
+
"text-(--ui-color-design-plain-content-icon-secondary)",
|
|
3153
|
+
"group-data-highlighted:text-(--ui-color-accent-main-primary)",
|
|
3154
|
+
"group-data-[state=open]:text-(--ui-color-accent-main-primary)",
|
|
3155
|
+
"group-data-[state=checked]:text-(--ui-color-accent-main-primary)",
|
|
3156
|
+
"transition-colors"
|
|
3157
|
+
].join(" "),
|
|
3158
|
+
itemLeadingAvatar: "shrink-0 size-[16px] me-[8px]",
|
|
3159
|
+
// @memo 18-2px
|
|
3160
|
+
itemLeadingAvatarSize: "2xs",
|
|
3161
|
+
// @memo this wrong
|
|
3162
|
+
itemWrapper: "ms-[4px] flex-1 flex flex-col text-start min-w-0",
|
|
3163
|
+
itemLabel: [
|
|
3164
|
+
"max-w-[240px] truncate -mt-px",
|
|
3165
|
+
"group-data-[state=checked]:text-(--ui-color-accent-main-primary)"
|
|
3166
|
+
].join(" "),
|
|
3167
|
+
itemDescription: "max-w-[240px] truncate -mt-[6px] text-(--b24ui-typography-description-color) text-(length:--ui-font-size-sm)",
|
|
3168
|
+
itemLabelExternalIcon: "inline-block size-[16px] text-(--ui-color-design-plain-content-icon-secondary)"
|
|
3169
|
+
},
|
|
3170
|
+
variants: {
|
|
3171
|
+
active: {
|
|
3172
|
+
true: {
|
|
3173
|
+
item: [
|
|
3174
|
+
"text-(--ui-color-accent-main-primary)",
|
|
3175
|
+
"hover:text-(--ui-color-accent-main-primary)"
|
|
3176
|
+
].join(" "),
|
|
3177
|
+
itemLeadingIcon: [
|
|
3178
|
+
"text-(--ui-color-accent-main-primary)",
|
|
3179
|
+
"hover:text-(--ui-color-accent-main-primary)",
|
|
3180
|
+
"group-data-[state=open]:text-(--ui-color-accent-main-primary)"
|
|
3181
|
+
].join(" ")
|
|
3182
|
+
},
|
|
3183
|
+
false: {}
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
};
|
|
3187
|
+
|
|
3188
|
+
const editorEmojiMenu = () => editorSuggestionMenu;
|
|
3189
|
+
|
|
3190
|
+
const editorMentionMenu = () => editorSuggestionMenu;
|
|
3191
|
+
|
|
3192
|
+
const editorToolbar = {
|
|
3193
|
+
slots: {
|
|
3194
|
+
root: "focus:outline-none",
|
|
3195
|
+
base: "flex items-stretch gap-1.5",
|
|
3196
|
+
group: "flex items-center gap-0.5",
|
|
3197
|
+
separator: "w-px self-stretch bg-(--ui-color-design-tinted-na-stroke)"
|
|
3198
|
+
},
|
|
3199
|
+
variants: {
|
|
3200
|
+
layout: {
|
|
3201
|
+
bubble: {
|
|
3202
|
+
base: "bg-(--popup-window-background-color) border border-(--ui-color-divider-default) rounded-md p-1"
|
|
3203
|
+
},
|
|
3204
|
+
floating: {
|
|
3205
|
+
base: "bg-(--popup-window-background-color) border border-(--ui-color-divider-default) rounded-md p-1"
|
|
3206
|
+
},
|
|
3207
|
+
fixed: {
|
|
3208
|
+
base: ""
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
};
|
|
3213
|
+
|
|
3038
3214
|
const empty = {
|
|
3039
3215
|
slots: {
|
|
3040
3216
|
root: [
|
|
@@ -3836,6 +4012,7 @@ const inputDate = () => {
|
|
|
3836
4012
|
separatorIcon: "shrink-0 size-4 text-(--ui-color-base-6)"
|
|
3837
4013
|
},
|
|
3838
4014
|
variants: {
|
|
4015
|
+
...fieldGroupVariant,
|
|
3839
4016
|
size: {
|
|
3840
4017
|
xss: {
|
|
3841
4018
|
base: (prev) => [prev, "gap-0.20", "px-1"].join(" "),
|
|
@@ -4890,6 +5067,7 @@ const inputTime = () => {
|
|
|
4890
5067
|
].join(" ")
|
|
4891
5068
|
},
|
|
4892
5069
|
variants: {
|
|
5070
|
+
...fieldGroupVariant,
|
|
4893
5071
|
size: {
|
|
4894
5072
|
xss: {
|
|
4895
5073
|
base: (prev) => [prev, "gap-0.20", "px-1"].join(" "),
|
|
@@ -9175,6 +9353,12 @@ const theme = {
|
|
|
9175
9353
|
dashboardSearchButton: dashboardSearchButton,
|
|
9176
9354
|
descriptionList: descriptionList,
|
|
9177
9355
|
dropdownMenu: dropdownMenu,
|
|
9356
|
+
editor: editor,
|
|
9357
|
+
editorDragHandle: editorDragHandle,
|
|
9358
|
+
editorEmojiMenu: editorEmojiMenu,
|
|
9359
|
+
editorMentionMenu: editorMentionMenu,
|
|
9360
|
+
editorSuggestionMenu: editorSuggestionMenu,
|
|
9361
|
+
editorToolbar: editorToolbar,
|
|
9178
9362
|
empty: empty,
|
|
9179
9363
|
error: error,
|
|
9180
9364
|
fieldGroup: fieldGroup$1,
|
package/dist/unplugin.mjs
CHANGED
|
@@ -3,7 +3,7 @@ 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 getDefaultConfig } from './shared/b24ui-nuxt.
|
|
6
|
+
import { g as getTemplates, d as defaultOptions, a as getDefaultConfig } from './shared/b24ui-nuxt.C8MyFqPm.mjs';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import MagicString from 'magic-string';
|
package/dist/vite.mjs
CHANGED
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.1.
|
|
4
|
+
"version": "2.1.12",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/bitrix24/b24ui.git"
|
|
@@ -118,6 +118,19 @@
|
|
|
118
118
|
"@tailwindcss/vite": "^4.1.17",
|
|
119
119
|
"@tanstack/vue-table": "^8.21.3",
|
|
120
120
|
"@tanstack/vue-virtual": "^3.13.12",
|
|
121
|
+
"@tiptap/core": "3.13.0",
|
|
122
|
+
"@tiptap/extension-bubble-menu": "3.13.0",
|
|
123
|
+
"@tiptap/extension-drag-handle-vue-3": "3.13.0",
|
|
124
|
+
"@tiptap/extension-floating-menu": "3.13.0",
|
|
125
|
+
"@tiptap/extension-horizontal-rule": "3.13.0",
|
|
126
|
+
"@tiptap/extension-image": "3.13.0",
|
|
127
|
+
"@tiptap/extension-mention": "3.13.0",
|
|
128
|
+
"@tiptap/extension-placeholder": "3.13.0",
|
|
129
|
+
"@tiptap/markdown": "3.13.0",
|
|
130
|
+
"@tiptap/pm": "3.13.0",
|
|
131
|
+
"@tiptap/starter-kit": "3.13.0",
|
|
132
|
+
"@tiptap/suggestion": "3.13.0",
|
|
133
|
+
"@tiptap/vue-3": "3.13.0",
|
|
121
134
|
"@unhead/vue": "^2.0.19",
|
|
122
135
|
"@vueuse/core": "^14.1.0",
|
|
123
136
|
"@vueuse/integrations": "^14.1.0",
|
|
@@ -155,14 +168,14 @@
|
|
|
155
168
|
"devDependencies": {
|
|
156
169
|
"@nuxt/eslint-config": "^1.11.0",
|
|
157
170
|
"@nuxt/module-builder": "^1.0.2",
|
|
158
|
-
"@nuxt/test-utils": "^3.
|
|
171
|
+
"@nuxt/test-utils": "^3.21.0",
|
|
159
172
|
"@types/canvas-confetti": "^1.9.0",
|
|
160
173
|
"@types/node": "^24.7.0",
|
|
161
174
|
"esno": "^4.8.0",
|
|
162
175
|
"nuxt-component-meta": "^0.14.2",
|
|
163
176
|
"sharp": "^0.34.3",
|
|
164
177
|
"@vue/test-utils": "^2.4.6",
|
|
165
|
-
"ai": "^5.0.
|
|
178
|
+
"ai": "^5.0.108",
|
|
166
179
|
"embla-carousel": "^8.6.0",
|
|
167
180
|
"eslint": "^9.39.1",
|
|
168
181
|
"happy-dom": "^20.0.11",
|