@sequent-org/moodboard 1.0.18 → 1.0.19
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 +1 -1
- package/src/ui/styles/workspace.css +37 -28
- package/src/utils/topbarIconLoader.js +67 -10
package/package.json
CHANGED
|
@@ -524,16 +524,16 @@
|
|
|
524
524
|
line-height: 1.4;
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
-
/* Topbar */
|
|
527
|
+
/* Topbar Styles */
|
|
528
528
|
.moodboard-topbar {
|
|
529
529
|
position: absolute;
|
|
530
|
-
top:
|
|
531
|
-
left:
|
|
532
|
-
|
|
533
|
-
display:
|
|
530
|
+
top: 16px;
|
|
531
|
+
left: 50%;
|
|
532
|
+
transform: translateX(-50%);
|
|
533
|
+
display: flex;
|
|
534
534
|
align-items: center;
|
|
535
535
|
gap: 8px;
|
|
536
|
-
padding: 8px
|
|
536
|
+
padding: 8px 12px;
|
|
537
537
|
background: #fff;
|
|
538
538
|
border: 1px solid #e0e0e0;
|
|
539
539
|
border-radius: 10px;
|
|
@@ -542,44 +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
|
+
|
|
545
551
|
.moodboard-topbar__button {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
justify-content: center;
|
|
549
|
-
width: 38px;
|
|
550
|
-
height: 38px;
|
|
552
|
+
width: 36px;
|
|
553
|
+
height: 36px;
|
|
551
554
|
border: none;
|
|
552
555
|
border-radius: 8px;
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
font-size: 16px;
|
|
556
|
+
background: #f0f0f0;
|
|
557
|
+
color: #333;
|
|
556
558
|
cursor: pointer;
|
|
559
|
+
display: flex;
|
|
560
|
+
align-items: center;
|
|
561
|
+
justify-content: center;
|
|
557
562
|
transition: all 0.2s ease;
|
|
558
563
|
}
|
|
559
564
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
width: 16px;
|
|
563
|
-
height: 16px;
|
|
564
|
-
/* fill: currentColor;
|
|
565
|
-
stroke: currentColor; */
|
|
566
|
-
transition: all 0.2s ease;
|
|
565
|
+
.moodboard-topbar__button:hover {
|
|
566
|
+
background: #e6e6e6;
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
.moodboard-topbar__button
|
|
570
|
-
|
|
569
|
+
.moodboard-topbar__button--active {
|
|
570
|
+
background: #007ACC;
|
|
571
|
+
color: #fff;
|
|
571
572
|
}
|
|
572
573
|
|
|
573
|
-
.moodboard-topbar__button
|
|
574
|
+
.moodboard-topbar__button--paint {
|
|
575
|
+
background: #f0f0f0;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.moodboard-topbar__button--paint:hover {
|
|
574
579
|
background: #e6e6e6;
|
|
575
580
|
}
|
|
576
581
|
|
|
577
|
-
/* Divider for topbar */
|
|
578
582
|
.moodboard-topbar__divider {
|
|
579
583
|
width: 1px;
|
|
580
|
-
height:
|
|
581
|
-
background: #
|
|
582
|
-
margin: 0
|
|
584
|
+
height: 24px;
|
|
585
|
+
background: #e0e0e0;
|
|
586
|
+
margin: 0 4px;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
.moodboard-topbar svg {
|
|
590
|
+
width: 18px;
|
|
591
|
+
height: 18px;
|
|
583
592
|
}
|
|
584
593
|
|
|
585
594
|
/* Paint popover */
|
|
@@ -9,21 +9,69 @@ export class TopbarIconLoader {
|
|
|
9
9
|
|
|
10
10
|
async init() {
|
|
11
11
|
try {
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
this.loadBuiltInIcons();
|
|
12
|
+
// Загружаем иконки из файлов в папке topbar
|
|
13
|
+
await this.loadTopbarIcons();
|
|
15
14
|
|
|
16
15
|
console.log('✅ Иконки верхней панели загружены успешно');
|
|
17
16
|
|
|
18
17
|
} catch (error) {
|
|
19
18
|
console.error('❌ Критическая ошибка загрузки иконок верхней панели:', error);
|
|
20
|
-
//
|
|
19
|
+
// В случае ошибки загружаем встроенные иконки как fallback
|
|
21
20
|
this.loadBuiltInIcons();
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
//
|
|
24
|
+
async loadTopbarIcons() {
|
|
25
|
+
// Список иконок, которые нужно загрузить
|
|
26
|
+
const iconNames = ['grid-line', 'grid-dot', 'grid-cross', 'grid-off', 'paint'];
|
|
27
|
+
|
|
28
|
+
for (const iconName of iconNames) {
|
|
29
|
+
try {
|
|
30
|
+
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}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
console.log(`📦 Загружено ${this.icons.size} иконок верхней панели`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async loadIconFromFile(iconName) {
|
|
48
|
+
// Пробуем несколько способов загрузки для разных окружений
|
|
49
|
+
const paths = [
|
|
50
|
+
`/src/assets/icons/topbar/${iconName}.svg`,
|
|
51
|
+
`./src/assets/icons/topbar/${iconName}.svg`,
|
|
52
|
+
`../assets/icons/topbar/${iconName}.svg`,
|
|
53
|
+
`assets/icons/topbar/${iconName}.svg`
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
for (const path of paths) {
|
|
57
|
+
try {
|
|
58
|
+
const response = await fetch(path);
|
|
59
|
+
if (response.ok) {
|
|
60
|
+
const svgContent = await response.text();
|
|
61
|
+
console.log(`✅ Иконка ${iconName} загружена с пути: ${path}`);
|
|
62
|
+
return svgContent;
|
|
63
|
+
}
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.warn(`⚠️ Не удалось загрузить ${iconName} с пути ${path}:`, error.message);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
throw new Error(`Не удалось загрузить иконку ${iconName} ни с одного из путей`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getBuiltInIcon(iconName) {
|
|
74
|
+
// Встроенные иконки как fallback
|
|
27
75
|
const builtInIcons = {
|
|
28
76
|
'grid-line': `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29
77
|
<path d="M2 2H16V4H2V2Z" fill="currentColor"/>
|
|
@@ -71,12 +119,21 @@ export class TopbarIconLoader {
|
|
|
71
119
|
</svg>`
|
|
72
120
|
};
|
|
73
121
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
122
|
+
return builtInIcons[iconName];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
loadBuiltInIcons() {
|
|
126
|
+
// Загружаем только встроенные иконки как fallback
|
|
127
|
+
const iconNames = ['grid-line', 'grid-dot', 'grid-cross', 'grid-off', 'paint'];
|
|
128
|
+
|
|
129
|
+
for (const iconName of iconNames) {
|
|
130
|
+
const builtInIcon = this.getBuiltInIcon(iconName);
|
|
131
|
+
if (builtInIcon) {
|
|
132
|
+
this.icons.set(iconName, builtInIcon);
|
|
133
|
+
}
|
|
77
134
|
}
|
|
78
135
|
|
|
79
|
-
console.log(`📦 Загружено ${this.icons.size} встроенных иконок верхней
|
|
136
|
+
console.log(`📦 Загружено ${this.icons.size} встроенных иконок верхней панели (fallback)`);
|
|
80
137
|
}
|
|
81
138
|
|
|
82
139
|
getIcon(name) {
|