@sequent-org/moodboard 1.2.6 → 1.2.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequent-org/moodboard",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -2,6 +2,6 @@
2
2
  export { MoodBoard } from './moodboard/MoodBoard.js';
3
3
 
4
4
  // Дополнительные экспорты для работы без bundler
5
- export { initMoodBoardNoBundler, quickInitMoodBoard, injectCriticalStyles } from './initNoBundler.js';
5
+ export { initMoodBoardNoBundler, quickInitMoodBoard, injectCriticalStyles, forceInjectPanelStyles } from './initNoBundler.js';
6
6
  export { StyleLoader } from './utils/styleLoader.js';
7
7
  export { EmojiLoaderNoBundler } from './utils/emojiLoaderNoBundler.js';
@@ -45,6 +45,13 @@ export async function initMoodBoardNoBundler(container, options = {}, basePath =
45
45
  * Инжектирует критичные стили inline для мгновенного отображения
46
46
  */
47
47
  export function injectCriticalStyles() {
48
+ // Проверяем, не добавлены ли уже критичные стили
49
+ if (document.getElementById('moodboard-critical-styles')) {
50
+ console.log('⚠️ Критичные стили уже добавлены');
51
+ return;
52
+ }
53
+
54
+ console.log('🎨 Добавляем критичные стили MoodBoard...');
48
55
  const criticalCSS = `
49
56
  /* Критичные стили для мгновенного отображения */
50
57
  .moodboard-workspace {
@@ -225,6 +232,153 @@ export function injectCriticalStyles() {
225
232
  style.id = 'moodboard-critical-styles';
226
233
  style.textContent = criticalCSS;
227
234
  document.head.appendChild(style);
235
+
236
+ console.log('✅ Критичные стили добавлены в DOM');
237
+
238
+ // Проверяем, применились ли стили панелей
239
+ setTimeout(() => {
240
+ const testPanel = document.querySelector('.text-properties-panel');
241
+ if (testPanel) {
242
+ const computedStyle = getComputedStyle(testPanel);
243
+ console.log('📋 Стили панели применены:', {
244
+ minWidth: computedStyle.minWidth,
245
+ height: computedStyle.height,
246
+ display: computedStyle.display,
247
+ padding: computedStyle.padding
248
+ });
249
+ } else {
250
+ console.log('📋 Панели пока не созданы, стили ожидают применения');
251
+ }
252
+ }, 100);
253
+ }
254
+
255
+ /**
256
+ * Принудительно инжектирует стили панелей с !important
257
+ * Используйте если панели отображаются узкими
258
+ */
259
+ export function forceInjectPanelStyles() {
260
+ console.log('🔧 Принудительно добавляем стили панелей...');
261
+
262
+ const forcedPanelCSS = `
263
+ /* ПРИНУДИТЕЛЬНЫЕ стили панелей - с !important */
264
+ .text-properties-panel {
265
+ position: absolute !important;
266
+ pointer-events: auto !important;
267
+ display: flex !important;
268
+ flex-direction: row !important;
269
+ align-items: center !important;
270
+ gap: 8px !important;
271
+ padding: 12px 22px !important;
272
+ background-color: #ffffff !important;
273
+ border: 1px solid #e0e0e0 !important;
274
+ border-radius: 9999px !important;
275
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
276
+ font-size: 13px !important;
277
+ font-family: 'Roboto', Arial, sans-serif !important;
278
+ min-width: 320px !important;
279
+ width: auto !important;
280
+ height: 36px !important;
281
+ z-index: 1001 !important;
282
+ }
283
+
284
+ .frame-properties-panel {
285
+ position: absolute !important;
286
+ pointer-events: auto !important;
287
+ display: inline-flex !important;
288
+ align-items: center !important;
289
+ gap: 8px !important;
290
+ padding: 12px 32px !important;
291
+ background-color: #ffffff !important;
292
+ border: 1px solid #e0e0e0 !important;
293
+ border-radius: 9999px !important;
294
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
295
+ font-size: 13px !important;
296
+ font-family: 'Roboto', Arial, sans-serif !important;
297
+ min-width: 320px !important;
298
+ width: auto !important;
299
+ height: 36px !important;
300
+ z-index: 1001 !important;
301
+ }
302
+
303
+ .note-properties-panel {
304
+ position: absolute !important;
305
+ pointer-events: auto !important;
306
+ display: inline-flex !important;
307
+ align-items: center !important;
308
+ gap: 8px !important;
309
+ padding: 12px 22px !important;
310
+ background-color: #ffffff !important;
311
+ border: 1px solid #e0e0e0 !important;
312
+ border-radius: 9999px !important;
313
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
314
+ font-size: 13px !important;
315
+ font-family: 'Roboto', Arial, sans-serif !important;
316
+ min-width: 280px !important;
317
+ width: auto !important;
318
+ height: 36px !important;
319
+ z-index: 1001 !important;
320
+ }
321
+
322
+ .file-properties-panel {
323
+ position: absolute !important;
324
+ pointer-events: auto !important;
325
+ display: inline-flex !important;
326
+ align-items: center !important;
327
+ gap: 8px !important;
328
+ padding: 12px 22px !important;
329
+ background-color: #ffffff !important;
330
+ border: 1px solid #e0e0e0 !important;
331
+ border-radius: 9999px !important;
332
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
333
+ font-size: 13px !important;
334
+ font-family: 'Roboto', Arial, sans-serif !important;
335
+ min-width: 250px !important;
336
+ width: auto !important;
337
+ height: 36px !important;
338
+ z-index: 1001 !important;
339
+ }
340
+
341
+ /* Элементы панелей */
342
+ .tpp-label, .fpp-label, .npp-label, .file-panel-label {
343
+ font-family: 'Roboto', Arial, sans-serif !important;
344
+ font-size: 12px !important;
345
+ color: #666 !important;
346
+ font-weight: 500 !important;
347
+ white-space: nowrap !important;
348
+ }
349
+
350
+ .font-select, .font-size-select, .fpp-select, .fpp-input {
351
+ border: 1px solid #ddd !important;
352
+ border-radius: 4px !important;
353
+ padding: 4px 8px !important;
354
+ font-size: 13px !important;
355
+ background-color: #fff !important;
356
+ cursor: pointer !important;
357
+ min-height: 20px !important;
358
+ }
359
+
360
+ .font-select { min-width: 110px !important; }
361
+ .font-size-select { min-width: 56px !important; }
362
+
363
+ .current-color-button, .current-bgcolor-button, .fpp-color-button {
364
+ width: 28px !important;
365
+ height: 28px !important;
366
+ border: 1px solid #ddd !important;
367
+ border-radius: 50% !important;
368
+ cursor: pointer !important;
369
+ margin: 0 !important;
370
+ padding: 0 !important;
371
+ display: block !important;
372
+ box-sizing: border-box !important;
373
+ }
374
+ `;
375
+
376
+ const style = document.createElement('style');
377
+ style.id = 'moodboard-forced-panel-styles';
378
+ style.textContent = forcedPanelCSS;
379
+ document.head.appendChild(style);
380
+
381
+ console.log('🔧 Принудительные стили панелей добавлены');
228
382
  }
229
383
 
230
384
  /**
@@ -245,6 +399,8 @@ export function quickInitMoodBoard(container, options = {}, basePath = '') {
245
399
  if (container) {
246
400
  container.classList.add('moodboard-styles-loaded');
247
401
  }
402
+ }).catch(error => {
403
+ console.warn('⚠️ Не удалось загрузить полные стили, используем критичные:', error);
248
404
  });
249
405
 
250
406
  // Создаем MoodBoard с fallback эмоджи
@@ -255,5 +411,19 @@ export function quickInitMoodBoard(container, options = {}, basePath = '') {
255
411
  emojiBasePath: basePath ? `${basePath}src/assets/emodji/` : null
256
412
  });
257
413
 
414
+ // Автоматическая проверка и исправление стилей панелей через 3 секунды
415
+ setTimeout(() => {
416
+ const panel = document.querySelector('.text-properties-panel, .frame-properties-panel, .note-properties-panel, .file-properties-panel');
417
+ if (panel) {
418
+ const computedStyle = getComputedStyle(panel);
419
+ const width = parseInt(computedStyle.minWidth);
420
+
421
+ if (width < 200) { // Если панель очень узкая
422
+ console.log('🔧 Обнаружена узкая панель, автоматически исправляем стили...');
423
+ forceInjectPanelStyles();
424
+ }
425
+ }
426
+ }, 3000);
427
+
258
428
  return moodboard;
259
429
  }