@sequent-org/moodboard 1.0.4 → 1.0.5
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/utils/topbarIconLoader.js +73 -10
package/package.json
CHANGED
|
@@ -9,24 +9,87 @@ export class TopbarIconLoader {
|
|
|
9
9
|
|
|
10
10
|
async init() {
|
|
11
11
|
try {
|
|
12
|
-
// Загружаем иконки через import
|
|
13
|
-
const iconModules =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
// Загружаем иконки через статические import (более надежно)
|
|
13
|
+
const iconModules = await Promise.all([
|
|
14
|
+
import('../assets/icons/topbar/grid-line.svg?raw'),
|
|
15
|
+
import('../assets/icons/topbar/grid-dot.svg?raw'),
|
|
16
|
+
import('../assets/icons/topbar/grid-cross.svg?raw'),
|
|
17
|
+
import('../assets/icons/topbar/grid-off.svg?raw'),
|
|
18
|
+
import('../assets/icons/topbar/paint.svg?raw')
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
// Сохраняем иконки в Map
|
|
22
|
+
const iconNames = ['grid-line', 'grid-dot', 'grid-cross', 'grid-off', 'paint'];
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
iconNames.forEach((name, index) => {
|
|
25
|
+
if (iconModules[index] && iconModules[index].default) {
|
|
26
|
+
this.icons.set(name, iconModules[index].default);
|
|
27
|
+
} else {
|
|
28
|
+
console.warn(`⚠️ Иконка ${name} не загружена, используем встроенную`);
|
|
29
|
+
// Используем встроенную иконку как fallback
|
|
30
|
+
const builtInIcon = this.getBuiltInIcon(name);
|
|
31
|
+
if (builtInIcon) {
|
|
32
|
+
this.icons.set(name, builtInIcon);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
22
36
|
|
|
23
37
|
} catch (error) {
|
|
24
|
-
console.warn('Не удалось загрузить SVG иконки через import
|
|
38
|
+
console.warn('Не удалось загрузить SVG иконки через import, используем встроенные:', error);
|
|
25
39
|
this.loadBuiltInIcons();
|
|
26
40
|
}
|
|
27
41
|
}
|
|
28
42
|
|
|
43
|
+
getBuiltInIcon(name) {
|
|
44
|
+
const builtInIcons = {
|
|
45
|
+
'grid-line': `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
46
|
+
<path d="M2 2H16V4H2V2Z" fill="currentColor"/>
|
|
47
|
+
<path d="M2 7H16V9H2V7Z" fill="currentColor"/>
|
|
48
|
+
<path d="M2 12H16V14H2V12Z" fill="currentColor"/>
|
|
49
|
+
<path d="M2 2V16H4V2H2Z" fill="currentColor"/>
|
|
50
|
+
<path d="M7 2V16H9V2H7Z" fill="currentColor"/>
|
|
51
|
+
<path d="M12 2V16H14V2H12Z" fill="currentColor"/>
|
|
52
|
+
</svg>`,
|
|
53
|
+
'grid-dot': `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
54
|
+
<circle cx="4" cy="4" r="1.5" fill="currentColor"/>
|
|
55
|
+
<circle cx="9" cy="4" r="1.5" fill="currentColor"/>
|
|
56
|
+
<circle cx="14" cy="4" r="1.5" fill="currentColor"/>
|
|
57
|
+
<circle cx="4" cy="9" r="1.5" fill="currentColor"/>
|
|
58
|
+
<circle cx="9" cy="9" r="1.5" fill="currentColor"/>
|
|
59
|
+
<circle cx="14" cy="9" r="1.5" fill="currentColor"/>
|
|
60
|
+
<circle cx="4" cy="14" r="1.5" fill="currentColor"/>
|
|
61
|
+
<circle cx="9" cy="14" r="1.5" fill="currentColor"/>
|
|
62
|
+
<circle cx="14" cy="14" r="1.5" fill="currentColor"/>
|
|
63
|
+
</svg>`,
|
|
64
|
+
'grid-cross': `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
65
|
+
<path d="M3 3L6 6M6 3L3 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
66
|
+
<path d="M9 3L12 6M12 3L9 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
67
|
+
<path d="M3 9L6 12M6 9L3 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
68
|
+
<path d="M9 9L12 12M12 9L9 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
69
|
+
<path d="M15 3L18 6M18 3L15 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
70
|
+
<path d="M15 9L18 12M18 9L15 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
71
|
+
<path d="M3 15L6 18M6 15L3 18" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
72
|
+
<path d="M9 15L12 18M12 15L9 18" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
73
|
+
<path d="M15 15L18 18M18 15L15 18" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
74
|
+
</svg>`,
|
|
75
|
+
'grid-off': `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
76
|
+
<path d="M2 2H16V4H2V2Z" fill="currentColor" opacity="0.3"/>
|
|
77
|
+
<path d="M2 7H16V9H2V7Z" fill="currentColor" opacity="0.3"/>
|
|
78
|
+
<path d="M2 12H16V14H2V12Z" fill="currentColor" opacity="0.3"/>
|
|
79
|
+
<path d="M2 2V16H4V2H2Z" fill="currentColor" opacity="0.3"/>
|
|
80
|
+
<path d="M7 2V16H9V2H7Z" fill="currentColor" opacity="0.3"/>
|
|
81
|
+
<path d="M12 2V16H14V2H12Z" fill="currentColor" opacity="0.3"/>
|
|
82
|
+
<path d="M1 17L17 1" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
83
|
+
</svg>`,
|
|
84
|
+
'paint': `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
85
|
+
<path d="M4 3H10L13 6V13A2 2 0 0 1 11 15H6A2 2 0 0 1 4 13V3Z" stroke="currentColor" stroke-width="1.5" fill="none"/>
|
|
86
|
+
<path d="M10 3V6H13" stroke="currentColor" stroke-width="1.5"/>
|
|
87
|
+
<path d="M14 10S15.5 11.5 15.5 13A1.5 1.5 0 0 1 13 13C13 11.5 14 10 14 10Z" fill="currentColor" stroke="currentColor" stroke-width="0.5"/>
|
|
88
|
+
</svg>`
|
|
89
|
+
};
|
|
29
90
|
|
|
91
|
+
return builtInIcons[name];
|
|
92
|
+
}
|
|
30
93
|
|
|
31
94
|
loadBuiltInIcons() {
|
|
32
95
|
// Встроенные иконки как fallback
|