@sequent-org/moodboard 1.0.19 → 1.0.20

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.0.19",
3
+ "version": "1.0.20",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -524,16 +524,16 @@
524
524
  line-height: 1.4;
525
525
  }
526
526
 
527
- /* Topbar Styles */
527
+ /* Topbar */
528
528
  .moodboard-topbar {
529
529
  position: absolute;
530
- top: 16px;
531
- left: 50%;
532
- transform: translateX(-50%);
533
- display: flex;
530
+ top: 12px;
531
+ left: 16px;
532
+ height: 50px;
533
+ display: inline-flex;
534
534
  align-items: center;
535
535
  gap: 8px;
536
- padding: 8px 12px;
536
+ padding: 8px 6px;
537
537
  background: #fff;
538
538
  border: 1px solid #e0e0e0;
539
539
  border-radius: 10px;
@@ -542,35 +542,53 @@
542
542
  pointer-events: auto;
543
543
  }
544
544
 
545
- .moodboard-topbar--dark {
546
- background: #2a2a2a;
547
- border-color: #444;
548
- color: #fff;
549
- }
550
-
551
545
  .moodboard-topbar__button {
552
- width: 36px;
553
- height: 36px;
546
+ display: inline-flex;
547
+ align-items: center;
548
+ justify-content: center;
549
+ width: 38px;
550
+ height: 38px;
554
551
  border: none;
555
552
  border-radius: 8px;
556
- background: #f0f0f0;
557
- color: #333;
553
+ /* background: #f0f0f0; */
554
+ /* color: #333; */
555
+ font-size: 16px;
558
556
  cursor: pointer;
559
- display: flex;
560
- align-items: center;
561
- justify-content: center;
562
557
  transition: all 0.2s ease;
563
558
  }
564
559
 
560
+ /* Стили для SVG иконок в кнопках верхней панели */
561
+ .moodboard-topbar__button svg {
562
+ width: 16px;
563
+ height: 16px;
564
+ /* fill: currentColor;
565
+ stroke: currentColor; */
566
+ transition: all 0.2s ease;
567
+ }
568
+
569
+ .moodboard-topbar__button:hover svg {
570
+ /* transform: scale(1.1); */
571
+ }
572
+
565
573
  .moodboard-topbar__button:hover {
566
574
  background: #e6e6e6;
567
575
  }
568
576
 
577
+ /* Divider for topbar */
578
+ .moodboard-topbar__divider {
579
+ width: 1px;
580
+ height: 28px;
581
+ background: #e5e7eb;
582
+ margin: 0 6px 0 2px;
583
+ }
584
+
585
+ /* Active state for topbar buttons */
569
586
  .moodboard-topbar__button--active {
570
- background: #007ACC;
571
- color: #fff;
587
+ background: #dbeafe;
588
+ color: #1d4ed8;
572
589
  }
573
590
 
591
+ /* Paint button specific styles */
574
592
  .moodboard-topbar__button--paint {
575
593
  background: #f0f0f0;
576
594
  }
@@ -579,18 +597,6 @@
579
597
  background: #e6e6e6;
580
598
  }
581
599
 
582
- .moodboard-topbar__divider {
583
- width: 1px;
584
- height: 24px;
585
- background: #e0e0e0;
586
- margin: 0 4px;
587
- }
588
-
589
- .moodboard-topbar svg {
590
- width: 18px;
591
- height: 18px;
592
- }
593
-
594
600
  /* Paint popover */
595
601
  .moodboard-topbar__paint-popover {
596
602
  position: absolute;
@@ -9,15 +9,17 @@ export class TopbarIconLoader {
9
9
 
10
10
  async init() {
11
11
  try {
12
- // Загружаем иконки из файлов в папке topbar
12
+ // Сначала загружаем встроенные иконки как основной источник
13
+ this.loadBuiltInIcons();
14
+
15
+ // Затем пытаемся загрузить из файлов (если доступно)
13
16
  await this.loadTopbarIcons();
14
17
 
15
18
  console.log('✅ Иконки верхней панели загружены успешно');
16
19
 
17
20
  } catch (error) {
18
21
  console.error('❌ Критическая ошибка загрузки иконок верхней панели:', error);
19
- // В случае ошибки загружаем встроенные иконки как fallback
20
- this.loadBuiltInIcons();
22
+ // В случае ошибки у нас уже есть встроенные иконки
21
23
  }
22
24
  }
23
25
 
@@ -28,20 +30,17 @@ export class TopbarIconLoader {
28
30
  for (const iconName of iconNames) {
29
31
  try {
30
32
  const svgContent = await this.loadIconFromFile(iconName);
31
- this.icons.set(iconName, svgContent);
32
- console.log(`✅ Загружена иконка: ${iconName}`);
33
- } catch (error) {
34
- console.warn(`⚠️ Не удалось загрузить иконку ${iconName}:`, error);
35
- // Если не удалось загрузить из файла, используем встроенную версию
36
- const builtInIcon = this.getBuiltInIcon(iconName);
37
- if (builtInIcon) {
38
- this.icons.set(iconName, builtInIcon);
39
- console.log(`✅ Использована встроенная иконка для: ${iconName}`);
33
+ if (svgContent) {
34
+ this.icons.set(iconName, svgContent);
35
+ console.log(`✅ Загружена иконка из файла: ${iconName}`);
40
36
  }
37
+ } catch (error) {
38
+ console.warn(`⚠️ Не удалось загрузить иконку ${iconName} из файла:`, error.message);
39
+ // Оставляем встроенную версию
41
40
  }
42
41
  }
43
42
 
44
- console.log(`📦 Загружено ${this.icons.size} иконок верхней панели`);
43
+ console.log(`📦 Всего загружено ${this.icons.size} иконок верхней панели`);
45
44
  }
46
45
 
47
46
  async loadIconFromFile(iconName) {
@@ -50,7 +49,8 @@ export class TopbarIconLoader {
50
49
  `/src/assets/icons/topbar/${iconName}.svg`,
51
50
  `./src/assets/icons/topbar/${iconName}.svg`,
52
51
  `../assets/icons/topbar/${iconName}.svg`,
53
- `assets/icons/topbar/${iconName}.svg`
52
+ `assets/icons/topbar/${iconName}.svg`,
53
+ `/assets/icons/topbar/${iconName}.svg`
54
54
  ];
55
55
 
56
56
  for (const path of paths) {
@@ -67,11 +67,11 @@ export class TopbarIconLoader {
67
67
  }
68
68
  }
69
69
 
70
- throw new Error(`Не удалось загрузить иконку ${iconName} ни с одного из путей`);
70
+ return null; // Возвращаем null вместо ошибки
71
71
  }
72
72
 
73
73
  getBuiltInIcon(iconName) {
74
- // Встроенные иконки как fallback
74
+ // Встроенные иконки как основной источник
75
75
  const builtInIcons = {
76
76
  'grid-line': `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
77
77
  <path d="M2 2H16V4H2V2Z" fill="currentColor"/>
@@ -123,7 +123,7 @@ export class TopbarIconLoader {
123
123
  }
124
124
 
125
125
  loadBuiltInIcons() {
126
- // Загружаем только встроенные иконки как fallback
126
+ // Загружаем встроенные иконки как основной источник
127
127
  const iconNames = ['grid-line', 'grid-dot', 'grid-cross', 'grid-off', 'paint'];
128
128
 
129
129
  for (const iconName of iconNames) {
@@ -133,7 +133,7 @@ export class TopbarIconLoader {
133
133
  }
134
134
  }
135
135
 
136
- console.log(`📦 Загружено ${this.icons.size} встроенных иконок верхней панели (fallback)`);
136
+ console.log(`📦 Загружено ${this.icons.size} встроенных иконок верхней панели`);
137
137
  }
138
138
 
139
139
  getIcon(name) {