@blockslides/extension-bubble-menu-preset 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,701 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ BubbleMenuPreset: () => BubbleMenuPreset,
24
+ default: () => BubbleMenuPreset
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
28
+ // src/bubble-menu-preset.ts
29
+ var import_core = require("@blockslides/core");
30
+ var import_extension_bubble_menu = require("@blockslides/extension-bubble-menu");
31
+ var STYLE_ID = "blockslides-bubble-menu-preset-styles";
32
+ var DEFAULT_ITEMS = [
33
+ "undo",
34
+ "redo",
35
+ "fontFamily",
36
+ "fontSize",
37
+ "bold",
38
+ "italic",
39
+ "underline",
40
+ "textColor",
41
+ "highlightColor",
42
+ "link",
43
+ "align"
44
+ ];
45
+ var DEFAULT_FONTS = [
46
+ "Inter",
47
+ "Arial",
48
+ "Helvetica",
49
+ "Times New Roman",
50
+ "Georgia",
51
+ "Courier New",
52
+ "Monaco"
53
+ ];
54
+ var DEFAULT_FONT_SIZES = ["12px", "14px", "16px", "18px", "20px", "24px", "32px", "40px"];
55
+ var DEFAULT_ALIGNMENTS = ["left", "center", "right", "justify"];
56
+ var DEFAULT_COLOR_PALETTE = [
57
+ "#000000",
58
+ "#434343",
59
+ "#666666",
60
+ "#999999",
61
+ "#b7b7b7",
62
+ "#cccccc",
63
+ "#d9d9d9",
64
+ "#efefef",
65
+ "#f3f3f3",
66
+ "#ffffff",
67
+ "#e60000",
68
+ "#ff0000",
69
+ "#ff9900",
70
+ "#ffff00",
71
+ "#00ff00",
72
+ "#00ffff",
73
+ "#4a86e8",
74
+ "#0000ff",
75
+ "#9900ff",
76
+ "#ff00ff",
77
+ "#f4cccc",
78
+ "#fce5cd",
79
+ "#fff2cc",
80
+ "#d9ead3",
81
+ "#d0e0e3",
82
+ "#cfe2f3",
83
+ "#d9d2e9",
84
+ "#ead1dc",
85
+ "#f9cb9c",
86
+ "#ffe599",
87
+ "#b6d7a8",
88
+ "#a2c4c9",
89
+ "#9fc5e8",
90
+ "#b4a7d6",
91
+ "#d5a6bd",
92
+ "#e06666",
93
+ "#f6b26b",
94
+ "#ffd966",
95
+ "#93c47d",
96
+ "#76a5af",
97
+ "#6fa8dc",
98
+ "#8e7cc3",
99
+ "#c27ba0",
100
+ "#cc0000",
101
+ "#e69138",
102
+ "#f1c232",
103
+ "#6aa84f",
104
+ "#45818e",
105
+ "#3d85c6",
106
+ "#674ea7",
107
+ "#a64d79",
108
+ "#990000",
109
+ "#b45f06",
110
+ "#bf9000",
111
+ "#38761d",
112
+ "#134f5c",
113
+ "#0b5394",
114
+ "#351c75",
115
+ "#741b47",
116
+ "#660000",
117
+ "#783f04",
118
+ "#7f6000",
119
+ "#274e13",
120
+ "#0c343d",
121
+ "#073763",
122
+ "#20124d",
123
+ "#4c1130"
124
+ ];
125
+ var DEFAULT_HIGHLIGHT_PALETTE = DEFAULT_COLOR_PALETTE;
126
+ var DEFAULT_LABELS = {
127
+ undo: "Undo",
128
+ redo: "Redo",
129
+ fontFamily: "Font",
130
+ fontSize: "Size",
131
+ bold: "B",
132
+ italic: "I",
133
+ underline: "U",
134
+ textColor: "A",
135
+ highlightColor: "Hi",
136
+ link: "Link",
137
+ align: "Align"
138
+ };
139
+ var BubbleMenuPreset = import_core.Extension.create({
140
+ name: "bubbleMenuPreset",
141
+ addOptions() {
142
+ return {
143
+ element: null,
144
+ items: DEFAULT_ITEMS,
145
+ className: "",
146
+ injectStyles: true,
147
+ textColors: DEFAULT_COLOR_PALETTE,
148
+ highlightColors: DEFAULT_HIGHLIGHT_PALETTE,
149
+ fonts: DEFAULT_FONTS,
150
+ fontSizes: DEFAULT_FONT_SIZES,
151
+ alignments: DEFAULT_ALIGNMENTS,
152
+ pluginKey: "bubbleMenuPreset",
153
+ updateDelay: 250,
154
+ resizeDelay: 60,
155
+ appendTo: void 0,
156
+ shouldShow: null,
157
+ options: {
158
+ placement: "top",
159
+ strategy: "absolute",
160
+ offset: 8,
161
+ flip: {},
162
+ shift: {}
163
+ }
164
+ };
165
+ },
166
+ addProseMirrorPlugins() {
167
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
168
+ const options = this.options;
169
+ const editor = this.editor;
170
+ const usingCustomElement = !!options.element;
171
+ const { element, cleanup } = options.element && typeof document !== "undefined" ? { element: options.element, cleanup: () => {
172
+ } } : buildMenuElement(editor, {
173
+ items: (_a = options.items) != null ? _a : DEFAULT_ITEMS,
174
+ className: (_b = options.className) != null ? _b : "",
175
+ injectStyles: options.injectStyles !== false,
176
+ textColors: (_c = options.textColors) != null ? _c : DEFAULT_COLOR_PALETTE,
177
+ highlightColors: (_d = options.highlightColors) != null ? _d : DEFAULT_HIGHLIGHT_PALETTE,
178
+ fonts: (_e = options.fonts) != null ? _e : DEFAULT_FONTS,
179
+ fontSizes: (_f = options.fontSizes) != null ? _f : DEFAULT_FONT_SIZES,
180
+ alignments: (_g = options.alignments) != null ? _g : DEFAULT_ALIGNMENTS
181
+ });
182
+ this.storage.element = element;
183
+ this.storage.cleanup = cleanup;
184
+ this.storage.usingCustomElement = usingCustomElement;
185
+ const pluginOptions = {
186
+ pluginKey: (_h = options.pluginKey) != null ? _h : "bubbleMenuPreset",
187
+ editor,
188
+ element,
189
+ updateDelay: options.updateDelay,
190
+ resizeDelay: options.resizeDelay,
191
+ appendTo: options.appendTo,
192
+ options: options.options,
193
+ getReferencedVirtualElement: options.getReferencedVirtualElement,
194
+ shouldShow: (_i = options.shouldShow) != null ? _i : void 0
195
+ };
196
+ return [(0, import_extension_bubble_menu.BubbleMenuPlugin)(pluginOptions)];
197
+ },
198
+ onDestroy() {
199
+ const el = this.storage.element;
200
+ const cleanup = this.storage.cleanup;
201
+ const usingCustomElement = this.storage.usingCustomElement;
202
+ if (cleanup) {
203
+ cleanup();
204
+ }
205
+ if (el && !usingCustomElement) {
206
+ el.remove();
207
+ }
208
+ }
209
+ });
210
+ function buildMenuElement(editor, opts) {
211
+ var _a;
212
+ if (opts.injectStyles) {
213
+ injectStyles();
214
+ }
215
+ const element = document.createElement("div");
216
+ element.className = `bs-bubble-menu-preset ${(_a = opts.className) != null ? _a : ""}`.trim();
217
+ element.setAttribute("data-bubble-menu-preset", "true");
218
+ element.tabIndex = 0;
219
+ const toolbar = document.createElement("div");
220
+ toolbar.className = "bs-bmp-toolbar";
221
+ const popovers = [];
222
+ const cleanupFns = [];
223
+ const getCommand = (name) => {
224
+ var _a2;
225
+ return (_a2 = editor.commands) == null ? void 0 : _a2[name];
226
+ };
227
+ const runChainCommand = (name, ...args) => {
228
+ var _a2, _b, _c, _d;
229
+ const chain = (_a2 = editor.chain) == null ? void 0 : _a2.call(editor);
230
+ if (!chain || typeof chain[name] !== "function") return false;
231
+ const runner = typeof chain.focus === "function" ? chain.focus() : chain;
232
+ if (typeof runner[name] !== "function") return false;
233
+ return (_d = (_c = (_b = runner[name](...args)).run) == null ? void 0 : _c.call(_b)) != null ? _d : false;
234
+ };
235
+ const closePopovers = () => {
236
+ popovers.forEach((p) => p.classList.add("bs-bmp-hidden"));
237
+ };
238
+ const runWithFocus = (fn) => {
239
+ if (!fn) return false;
240
+ return !!fn();
241
+ };
242
+ const addButton = (item, label, onClick, opts2 = {}) => {
243
+ const btn = document.createElement("button");
244
+ btn.type = "button";
245
+ btn.className = `bs-bmp-btn bs-bmp-btn-${item}`;
246
+ btn.textContent = label;
247
+ if (opts2.title) {
248
+ btn.title = opts2.title;
249
+ btn.setAttribute("aria-label", opts2.title);
250
+ }
251
+ if (opts2.disabled) {
252
+ btn.disabled = true;
253
+ btn.classList.add("bs-bmp-disabled");
254
+ } else {
255
+ btn.addEventListener("click", () => {
256
+ closePopovers();
257
+ onClick();
258
+ });
259
+ }
260
+ toolbar.appendChild(btn);
261
+ };
262
+ const addUndoRedo = () => {
263
+ const hasUndo = typeof getCommand("undo") === "function";
264
+ const hasRedo = typeof getCommand("redo") === "function";
265
+ addButton("undo", DEFAULT_LABELS.undo, () => runWithFocus(() => runChainCommand("undo")), {
266
+ disabled: !hasUndo,
267
+ title: "Undo"
268
+ });
269
+ addButton("redo", DEFAULT_LABELS.redo, () => runWithFocus(() => runChainCommand("redo")), {
270
+ disabled: !hasRedo,
271
+ title: "Redo"
272
+ });
273
+ };
274
+ const addFontFamily = () => {
275
+ const hasCommand = typeof getCommand("setFontFamily") === "function";
276
+ const wrapper = document.createElement("div");
277
+ wrapper.className = "bs-bmp-select";
278
+ const select = document.createElement("select");
279
+ select.className = "bs-bmp-select-input";
280
+ select.title = "Font family";
281
+ opts.fonts.forEach((font) => {
282
+ const option = document.createElement("option");
283
+ option.value = font;
284
+ option.textContent = font;
285
+ option.style.fontFamily = font;
286
+ select.appendChild(option);
287
+ });
288
+ select.disabled = !hasCommand;
289
+ select.addEventListener("change", () => {
290
+ var _a2, _b;
291
+ runWithFocus(() => runChainCommand("setFontFamily", select.value));
292
+ (_b = (_a2 = editor.commands).setMeta) == null ? void 0 : _b.call(_a2, "bubbleMenu", "updatePosition");
293
+ });
294
+ wrapper.appendChild(select);
295
+ toolbar.appendChild(wrapper);
296
+ };
297
+ const addFontSize = () => {
298
+ const hasCommand = typeof getCommand("setFontSize") === "function";
299
+ const wrapper = document.createElement("div");
300
+ wrapper.className = "bs-bmp-select";
301
+ const select = document.createElement("select");
302
+ select.className = "bs-bmp-select-input";
303
+ select.title = "Font size";
304
+ opts.fontSizes.forEach((size) => {
305
+ const option = document.createElement("option");
306
+ option.value = size;
307
+ option.textContent = size;
308
+ select.appendChild(option);
309
+ });
310
+ select.disabled = !hasCommand;
311
+ select.addEventListener("change", () => {
312
+ var _a2, _b;
313
+ runWithFocus(() => runChainCommand("setFontSize", select.value));
314
+ (_b = (_a2 = editor.commands).setMeta) == null ? void 0 : _b.call(_a2, "bubbleMenu", "updatePosition");
315
+ });
316
+ wrapper.appendChild(select);
317
+ toolbar.appendChild(wrapper);
318
+ };
319
+ const addToggleMark = (item, commandName, title) => {
320
+ const fn = getCommand(commandName);
321
+ const disabled = typeof fn !== "function";
322
+ addButton(
323
+ item,
324
+ DEFAULT_LABELS[item],
325
+ () => {
326
+ runWithFocus(() => runChainCommand(commandName));
327
+ },
328
+ { disabled, title }
329
+ );
330
+ };
331
+ const addTextColor = () => {
332
+ const hasSet = typeof getCommand("setColor") === "function";
333
+ const hasUnset = typeof getCommand("unsetColor") === "function";
334
+ const { popover, toggle, destroy } = createColorPopover({
335
+ label: DEFAULT_LABELS.textColor,
336
+ title: "Text color",
337
+ colors: opts.textColors,
338
+ onSelect: (color) => {
339
+ var _a2, _b;
340
+ if (!hasSet) return;
341
+ runWithFocus(() => runChainCommand("setColor", color));
342
+ (_b = (_a2 = editor.commands).setMeta) == null ? void 0 : _b.call(_a2, "bubbleMenu", "updatePosition");
343
+ },
344
+ onClear: () => {
345
+ var _a2, _b;
346
+ if (!hasUnset) return;
347
+ runWithFocus(() => runChainCommand("unsetColor"));
348
+ (_b = (_a2 = editor.commands).setMeta) == null ? void 0 : _b.call(_a2, "bubbleMenu", "updatePosition");
349
+ },
350
+ onToggle: () => {
351
+ var _a2, _b;
352
+ return (_b = (_a2 = editor.commands).setMeta) == null ? void 0 : _b.call(_a2, "bubbleMenu", "updatePosition");
353
+ }
354
+ });
355
+ popovers.push(popover);
356
+ cleanupFns.push(destroy);
357
+ toolbar.appendChild(toggle);
358
+ toolbar.appendChild(popover);
359
+ };
360
+ const addHighlightColor = () => {
361
+ const hasToggle = typeof getCommand("toggleHighlight") === "function";
362
+ const hasUnset = typeof getCommand("unsetHighlight") === "function";
363
+ const { popover, toggle, destroy } = createColorPopover({
364
+ label: DEFAULT_LABELS.highlightColor,
365
+ title: "Highlight color",
366
+ colors: opts.highlightColors,
367
+ onSelect: (color) => {
368
+ var _a2, _b;
369
+ if (!hasToggle) return;
370
+ runWithFocus(() => runChainCommand("toggleHighlight", { color }));
371
+ (_b = (_a2 = editor.commands).setMeta) == null ? void 0 : _b.call(_a2, "bubbleMenu", "updatePosition");
372
+ },
373
+ onClear: () => {
374
+ var _a2, _b;
375
+ if (!hasUnset) return;
376
+ runWithFocus(() => runChainCommand("unsetHighlight"));
377
+ (_b = (_a2 = editor.commands).setMeta) == null ? void 0 : _b.call(_a2, "bubbleMenu", "updatePosition");
378
+ },
379
+ onToggle: () => {
380
+ var _a2, _b;
381
+ return (_b = (_a2 = editor.commands).setMeta) == null ? void 0 : _b.call(_a2, "bubbleMenu", "updatePosition");
382
+ }
383
+ });
384
+ popovers.push(popover);
385
+ cleanupFns.push(destroy);
386
+ toolbar.appendChild(toggle);
387
+ toolbar.appendChild(popover);
388
+ };
389
+ const addLink = () => {
390
+ const hasToggle = typeof getCommand("toggleLink") === "function";
391
+ const hasUnset = typeof getCommand("unsetLink") === "function";
392
+ addButton(
393
+ "link",
394
+ DEFAULT_LABELS.link,
395
+ () => {
396
+ var _a2, _b;
397
+ const currentHref = (_b = (_a2 = editor.getAttributes("link")) == null ? void 0 : _a2.href) != null ? _b : "";
398
+ const href = window.prompt("Link URL", currentHref);
399
+ if (href === null) return;
400
+ if (!href) {
401
+ if (hasUnset) {
402
+ runWithFocus(() => runChainCommand("unsetLink"));
403
+ }
404
+ return;
405
+ }
406
+ if (hasToggle) {
407
+ runWithFocus(() => runChainCommand("toggleLink", { href }));
408
+ }
409
+ },
410
+ { disabled: !hasToggle && !hasUnset, title: "Insert link" }
411
+ );
412
+ };
413
+ const addAlign = () => {
414
+ const hasSet = typeof getCommand("setTextAlign") === "function";
415
+ const hasToggle = typeof getCommand("toggleTextAlign") === "function";
416
+ const wrapper = document.createElement("div");
417
+ wrapper.className = "bs-bmp-select";
418
+ const select = document.createElement("select");
419
+ select.className = "bs-bmp-select-input";
420
+ select.title = "Align";
421
+ opts.alignments.forEach((alignment) => {
422
+ const option = document.createElement("option");
423
+ option.value = alignment;
424
+ option.textContent = alignment.charAt(0).toUpperCase() + alignment.slice(1);
425
+ select.appendChild(option);
426
+ });
427
+ select.disabled = !hasSet && !hasToggle;
428
+ select.addEventListener("change", () => {
429
+ var _a2, _b;
430
+ if (hasToggle) {
431
+ runWithFocus(() => runChainCommand("toggleTextAlign", select.value));
432
+ } else if (hasSet) {
433
+ runWithFocus(() => runChainCommand("setTextAlign", select.value));
434
+ }
435
+ (_b = (_a2 = editor.commands).setMeta) == null ? void 0 : _b.call(_a2, "bubbleMenu", "updatePosition");
436
+ });
437
+ wrapper.appendChild(select);
438
+ toolbar.appendChild(wrapper);
439
+ };
440
+ opts.items.forEach((item) => {
441
+ switch (item) {
442
+ case "undo":
443
+ addUndoRedo();
444
+ break;
445
+ case "redo":
446
+ break;
447
+ case "fontFamily":
448
+ addFontFamily();
449
+ break;
450
+ case "fontSize":
451
+ addFontSize();
452
+ break;
453
+ case "bold":
454
+ addToggleMark("bold", "toggleBold", "Bold");
455
+ break;
456
+ case "italic":
457
+ addToggleMark("italic", "toggleItalic", "Italic");
458
+ break;
459
+ case "underline":
460
+ addToggleMark("underline", "toggleUnderline", "Underline");
461
+ break;
462
+ case "textColor":
463
+ addTextColor();
464
+ break;
465
+ case "highlightColor":
466
+ addHighlightColor();
467
+ break;
468
+ case "link":
469
+ addLink();
470
+ break;
471
+ case "align":
472
+ addAlign();
473
+ break;
474
+ default:
475
+ break;
476
+ }
477
+ });
478
+ element.appendChild(toolbar);
479
+ return {
480
+ element,
481
+ cleanup: () => {
482
+ popovers.forEach((p) => p.remove());
483
+ cleanupFns.forEach((fn) => fn());
484
+ element.replaceChildren();
485
+ }
486
+ };
487
+ }
488
+ function createColorPopover(args) {
489
+ const toggle = document.createElement("button");
490
+ toggle.type = "button";
491
+ toggle.className = "bs-bmp-btn bs-bmp-btn-color";
492
+ toggle.textContent = args.label;
493
+ toggle.title = args.title;
494
+ toggle.setAttribute("aria-expanded", "false");
495
+ const popover = document.createElement("div");
496
+ popover.className = "bs-bmp-popover bs-bmp-hidden";
497
+ popover.setAttribute("role", "menu");
498
+ const header = document.createElement("div");
499
+ header.className = "bs-bmp-popover-header";
500
+ const noneBtn = document.createElement("button");
501
+ noneBtn.type = "button";
502
+ noneBtn.className = "bs-bmp-btn bs-bmp-btn-ghost";
503
+ noneBtn.textContent = "None";
504
+ noneBtn.addEventListener("click", () => {
505
+ args.onClear();
506
+ hide();
507
+ });
508
+ header.appendChild(noneBtn);
509
+ popover.appendChild(header);
510
+ const grid = document.createElement("div");
511
+ grid.className = "bs-bmp-color-grid";
512
+ const columns = 10;
513
+ grid.style.setProperty("--bs-bmp-grid-columns", String(columns));
514
+ args.colors.forEach((color) => {
515
+ const swatch = document.createElement("button");
516
+ swatch.type = "button";
517
+ swatch.className = "bs-bmp-color-swatch";
518
+ swatch.style.backgroundColor = color;
519
+ swatch.setAttribute("aria-label", color);
520
+ swatch.addEventListener("click", (event) => {
521
+ event.stopPropagation();
522
+ args.onSelect(color);
523
+ hide();
524
+ });
525
+ grid.appendChild(swatch);
526
+ });
527
+ popover.appendChild(grid);
528
+ const customRow = document.createElement("div");
529
+ customRow.className = "bs-bmp-popover-footer";
530
+ const customLabel = document.createElement("span");
531
+ customLabel.textContent = "Custom";
532
+ const customInput = document.createElement("input");
533
+ customInput.type = "color";
534
+ customInput.className = "bs-bmp-color-input";
535
+ customInput.addEventListener("input", () => {
536
+ args.onSelect(customInput.value);
537
+ });
538
+ customRow.appendChild(customLabel);
539
+ customRow.appendChild(customInput);
540
+ popover.appendChild(customRow);
541
+ const hide = () => {
542
+ var _a;
543
+ popover.classList.add("bs-bmp-hidden");
544
+ toggle.setAttribute("aria-expanded", "false");
545
+ (_a = args.onToggle) == null ? void 0 : _a.call(args);
546
+ };
547
+ const show = () => {
548
+ var _a;
549
+ popover.classList.remove("bs-bmp-hidden");
550
+ toggle.setAttribute("aria-expanded", "true");
551
+ (_a = args.onToggle) == null ? void 0 : _a.call(args);
552
+ };
553
+ const toggleHandler = (event) => {
554
+ event.stopPropagation();
555
+ if (popover.classList.contains("bs-bmp-hidden")) {
556
+ show();
557
+ } else {
558
+ hide();
559
+ }
560
+ };
561
+ toggle.addEventListener("click", toggleHandler);
562
+ const outsideHandler = (event) => {
563
+ if (popover.contains(event.target) || toggle.contains(event.target)) {
564
+ return;
565
+ }
566
+ hide();
567
+ };
568
+ document.addEventListener(
569
+ "click",
570
+ outsideHandler,
571
+ { capture: true }
572
+ );
573
+ const destroy = () => {
574
+ document.removeEventListener("click", outsideHandler, { capture: true });
575
+ toggle.removeEventListener("click", toggleHandler);
576
+ };
577
+ return { toggle, popover, destroy };
578
+ }
579
+ function injectStyles() {
580
+ if (typeof document === "undefined") return;
581
+ if (document.getElementById(STYLE_ID)) return;
582
+ const style = document.createElement("style");
583
+ style.id = STYLE_ID;
584
+ style.textContent = `
585
+ .bs-bubble-menu-preset {
586
+ display: inline-flex;
587
+ align-items: center;
588
+ gap: 8px;
589
+ background: #ffffff;
590
+ border: 1px solid #e5e7eb;
591
+ padding: 8px 10px;
592
+ border-radius: 20%;
593
+ box-shadow: 0 10px 30px rgba(0,0,0,0.12);
594
+ color: #111827;
595
+ font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
596
+ }
597
+ .bs-bmp-toolbar {
598
+ display: inline-flex;
599
+ align-items: center;
600
+ gap: 6px;
601
+ }
602
+ .bs-bmp-btn {
603
+ border: none;
604
+ background: transparent;
605
+ color: inherit;
606
+ padding: 6px 8px;
607
+ border-radius: 12px;
608
+ cursor: pointer;
609
+ font-size: 13px;
610
+ line-height: 1;
611
+ transition: background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
612
+ }
613
+ .bs-bmp-btn:hover {
614
+ background: #f3f4f6;
615
+ }
616
+ .bs-bmp-btn:disabled {
617
+ opacity: 0.45;
618
+ cursor: not-allowed;
619
+ }
620
+ .bs-bmp-select {
621
+ display: inline-flex;
622
+ align-items: center;
623
+ }
624
+ .bs-bmp-select-input {
625
+ border: 1px solid #e5e7eb;
626
+ background: #ffffff;
627
+ color: inherit;
628
+ padding: 6px 8px;
629
+ border-radius: 12px;
630
+ font-size: 13px;
631
+ outline: none;
632
+ }
633
+ .bs-bmp-select-input:focus {
634
+ border-color: #4f46e5;
635
+ box-shadow: 0 0 0 2px rgba(79,70,229,0.15);
636
+ }
637
+ .bs-bmp-popover {
638
+ position: absolute;
639
+ margin-top: 6px;
640
+ padding: 10px;
641
+ background: #ffffff;
642
+ border: 1px solid #e5e7eb;
643
+ border-radius: 12px;
644
+ box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
645
+ z-index: 999;
646
+ }
647
+ .bs-bmp-hidden {
648
+ display: none;
649
+ }
650
+ .bs-bmp-popover-header,
651
+ .bs-bmp-popover-footer {
652
+ display: flex;
653
+ align-items: center;
654
+ justify-content: space-between;
655
+ margin-bottom: 6px;
656
+ }
657
+ .bs-bmp-btn-ghost {
658
+ background: transparent;
659
+ border: none;
660
+ color: inherit;
661
+ padding: 4px 6px;
662
+ border-radius: 8px;
663
+ cursor: pointer;
664
+ }
665
+ .bs-bmp-btn-ghost:hover {
666
+ background: #f3f4f6;
667
+ }
668
+ .bs-bmp-color-grid {
669
+ display: grid;
670
+ grid-template-columns: repeat(var(--bs-bmp-grid-columns, 10), 22px);
671
+ gap: 4px;
672
+ margin-bottom: 8px;
673
+ }
674
+ .bs-bmp-color-swatch {
675
+ width: 22px;
676
+ height: 22px;
677
+ border-radius: 50%;
678
+ border: 1px solid #e5e7eb;
679
+ cursor: pointer;
680
+ padding: 0;
681
+ }
682
+ .bs-bmp-color-swatch:hover {
683
+ outline: 2px solid #4f46e5;
684
+ outline-offset: 2px;
685
+ }
686
+ .bs-bmp-color-input {
687
+ width: 32px;
688
+ height: 28px;
689
+ padding: 0;
690
+ border: 1px solid #e5e7eb;
691
+ border-radius: 8px;
692
+ background: #ffffff;
693
+ }
694
+ `;
695
+ document.head.appendChild(style);
696
+ }
697
+ // Annotate the CommonJS export names for ESM import in node:
698
+ 0 && (module.exports = {
699
+ BubbleMenuPreset
700
+ });
701
+ //# sourceMappingURL=index.cjs.map