@topvisor/ui 0.0.35 → 0.0.36
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/{src/components/forms/inputDate/datepicker.css → .chunks/datepicker-1e725859.amd.js} +3 -2
- package/.chunks/datepicker-1e725859.amd.js.map +1 -0
- package/.chunks/datepicker-ad465c48.es.js +275 -0
- package/.chunks/datepicker-ad465c48.es.js.map +1 -0
- package/.chunks/forms-2891e074.amd.js +3 -0
- package/.chunks/forms-2891e074.amd.js.map +1 -0
- package/.chunks/forms-db4cb24d.es.js +946 -0
- package/.chunks/forms-db4cb24d.es.js.map +1 -0
- package/.chunks/popup-0f540839.es.js +700 -0
- package/.chunks/popup-0f540839.es.js.map +1 -0
- package/.chunks/popup-e49a9bab.amd.js +341 -0
- package/.chunks/popup-e49a9bab.amd.js.map +1 -0
- package/README.md +63 -30
- package/common/common.amd.js +2 -0
- package/common/common.amd.js.map +1 -0
- package/common/common.js +2 -0
- package/common/common.js.map +1 -0
- package/core/core.amd.js +2 -0
- package/core/core.amd.js.map +1 -0
- package/core/core.js +6 -0
- package/core/core.js.map +1 -0
- package/core.css +1 -0
- package/dark.css +1 -0
- package/forms/forms.amd.js +2 -0
- package/forms/forms.amd.js.map +1 -0
- package/forms/forms.js +15 -0
- package/forms/forms.js.map +1 -0
- package/forms/helpers.amd.js +2 -0
- package/forms/helpers.amd.js.map +1 -0
- package/forms/helpers.js +9 -0
- package/forms/helpers.js.map +1 -0
- package/forms.css +1 -0
- package/formsExt/formsExt.amd.js +3 -0
- package/formsExt/formsExt.amd.js.map +1 -0
- package/formsExt/formsExt.js +207 -0
- package/formsExt/formsExt.js.map +1 -0
- package/formsExt.css +1 -0
- package/light.css +1 -0
- package/package.json +1 -50
- package/popup/popup.amd.js +3 -0
- package/popup/popup.amd.js.map +1 -0
- package/popup/popup.js +144 -0
- package/popup/popup.js.map +1 -0
- package/popup/worker.amd.js +2 -0
- package/popup/worker.amd.js.map +1 -0
- package/popup/worker.js +154 -0
- package/popup/worker.js.map +1 -0
- package/popup.css +1 -0
- package/tabs/tabs.amd.js +3 -0
- package/tabs/tabs.amd.js.map +1 -0
- package/tabs/tabs.js +97 -0
- package/tabs/tabs.js.map +1 -0
- package/tabs.css +1 -0
- package/utils/date.amd.js +2 -0
- package/utils/date.amd.js.map +1 -0
- package/utils/date.js +6 -0
- package/utils/date.js.map +1 -0
- package/utils/device.amd.js +2 -0
- package/utils/device.amd.js.map +1 -0
- package/utils/device.js +6 -0
- package/utils/device.js.map +1 -0
- package/utils/dom.amd.js +2 -0
- package/utils/dom.amd.js.map +1 -0
- package/utils/dom.js +64 -0
- package/utils/dom.js.map +1 -0
- package/.storybook/TopTheme.js +0 -82
- package/.storybook/TopThemeManager.js +0 -44
- package/.storybook/main.ts +0 -43
- package/.storybook/manager.ts +0 -28
- package/.storybook/preview-head.html +0 -16
- package/.storybook/preview.ts +0 -48
- package/.storybook/vue/coreDecorator.ts +0 -19
- package/.storybook/vue/vModelDecorator.ts +0 -27
- package/.vscode/extensions.json +0 -11
- package/.vscode/keybindings.example.json +0 -121
- package/.vscode/settings.json +0 -46
- package/Dockerfile +0 -3
- package/NPM.md +0 -25
- package/PUBLISH.md +0 -18
- package/STORYBOOK.md +0 -27
- package/USE_IN_PROJECT.md +0 -29
- package/build/afterBuild.sh +0 -12
- package/build/cssModules.ts +0 -39
- package/build/plugin/amdFix.ts +0 -46
- package/build/rollup.config.ts +0 -18
- package/nbproject/project.properties +0 -11
- package/nbproject/project.xml +0 -9
- package/public/README.md +0 -63
- package/src/components/common/common.ts +0 -1
- package/src/components/common/icon/icon.ts +0 -4
- package/src/components/common/icon/icon.vue +0 -15
- package/src/components/component.ts +0 -133
- package/src/components/forms/button/button.stories.ts +0 -112
- package/src/components/forms/button/button.ts +0 -51
- package/src/components/forms/button/button.vue +0 -75
- package/src/components/forms/button/stories/README.md +0 -35
- package/src/components/forms/button/stories/overview.vue +0 -33
- package/src/components/forms/button/style/button.css +0 -124
- package/src/components/forms/button/style/style-outline.css +0 -42
- package/src/components/forms/button/style/style-soft.css +0 -31
- package/src/components/forms/button/style/style-transparent.css +0 -35
- package/src/components/forms/checkbox/checkbox.stories.ts +0 -33
- package/src/components/forms/checkbox/checkbox.ts +0 -23
- package/src/components/forms/checkbox/checkbox.vue +0 -135
- package/src/components/forms/checkbox/stories/overview.vue +0 -171
- package/src/components/forms/controlLabel/controlLabel.stories.ts +0 -38
- package/src/components/forms/controlLabel/controlLabel.ts +0 -4
- package/src/components/forms/controlLabel/controlLabel.vue +0 -48
- package/src/components/forms/forms.ts +0 -10
- package/src/components/forms/helpers.ts +0 -10
- package/src/components/forms/hint/hint.stories.ts +0 -46
- package/src/components/forms/hint/hint.ts +0 -8
- package/src/components/forms/hint/hint.vue +0 -32
- package/src/components/forms/input/input.stories.ts +0 -31
- package/src/components/forms/input/input.ts +0 -34
- package/src/components/forms/input/input.vue +0 -170
- package/src/components/forms/input/stories/overview.vue +0 -61
- package/src/components/forms/inputDate/datepicker.ts +0 -101
- package/src/components/forms/inputDate/inputDate.stories.ts +0 -41
- package/src/components/forms/inputDate/inputDate.ts +0 -4
- package/src/components/forms/inputDate/inputDate.vue +0 -127
- package/src/components/forms/inputDate/stories/overview.vue +0 -35
- package/src/components/forms/radio/radio.stories.ts +0 -34
- package/src/components/forms/radio/radio.ts +0 -15
- package/src/components/forms/radio/radio.vue +0 -107
- package/src/components/forms/radio/stories/overview.vue +0 -79
- package/src/components/forms/select/select.stories.ts +0 -34
- package/src/components/forms/select/select.ts +0 -36
- package/src/components/forms/select/select.vue +0 -253
- package/src/components/forms/select/stories/exampleOptions.ts +0 -71
- package/src/components/forms/select/stories/overview.vue +0 -60
- package/src/components/forms/switcher/stories/overview.vue +0 -139
- package/src/components/forms/switcher/switcher.stories.ts +0 -33
- package/src/components/forms/switcher/switcher.ts +0 -22
- package/src/components/forms/switcher/switcher.vue +0 -113
- package/src/components/forms/textarea/stories/overview.vue +0 -62
- package/src/components/forms/textarea/textarea.stories.ts +0 -33
- package/src/components/forms/textarea/textarea.ts +0 -38
- package/src/components/forms/textarea/textarea.vue +0 -119
- package/src/components/formsExt/editArea/editArea.stories.ts +0 -72
- package/src/components/formsExt/editArea/editArea.ts +0 -25
- package/src/components/formsExt/editArea/editArea.vue +0 -172
- package/src/components/formsExt/editArea/stories/README.md +0 -17
- package/src/components/formsExt/editArea/stories/overview.vue +0 -66
- package/src/components/formsExt/editInput/editInput.stories.ts +0 -36
- package/src/components/formsExt/editInput/editInput.ts +0 -20
- package/src/components/formsExt/editInput/editInput.vue +0 -57
- package/src/components/formsExt/editInput/stories/overview.vue +0 -54
- package/src/components/formsExt/formsExt.ts +0 -3
- package/src/components/formsExt/radioGroup/radioGroup.stories.ts +0 -51
- package/src/components/formsExt/radioGroup/radioGroup.ts +0 -28
- package/src/components/formsExt/radioGroup/radioGroup.vue +0 -143
- package/src/components/formsExt/radioGroup/stories/overview.vue +0 -78
- package/src/components/formsExt/radioGroup/styles/top-scrollBar.css +0 -52
- package/src/components/helper.js +0 -10
- package/src/components/helpersStories.ts +0 -151
- package/src/components/popup/lib/popup.globalEvents.js +0 -205
- package/src/components/popup/lib/popup.js +0 -702
- package/src/components/popup/lib/worker.globalEvents.js +0 -78
- package/src/components/popup/lib/worker.js +0 -232
- package/src/components/popup/popup/listItem.vue +0 -42
- package/src/components/popup/popup/opener.vue +0 -74
- package/src/components/popup/popup/popup.stories.ts +0 -68
- package/src/components/popup/popup/popup.ts +0 -93
- package/src/components/popup/popup/popup.vue +0 -95
- package/src/components/popup/popup/stories/README.md +0 -34
- package/src/components/popup/popup/stories/listItems.vue +0 -44
- package/src/components/popup/popup/stories/listSubItems.vue +0 -52
- package/src/components/popup/popup/stories/overview.vue +0 -208
- package/src/components/popup/popup/style/popup.css +0 -243
- package/src/components/popup/popup/style/popup.m.css +0 -71
- package/src/components/popup/popup/style/popup.pc.css +0 -28
- package/src/components/popup/popup.ts +0 -3
- package/src/components/popup/worker.ts +0 -1
- package/src/components/tabs/tabs/content.vue +0 -24
- package/src/components/tabs/tabs/stories/README.md +0 -10
- package/src/components/tabs/tabs/tab.vue +0 -52
- package/src/components/tabs/tabs/tabs.stories.ts +0 -171
- package/src/components/tabs/tabs/tabs.ts +0 -22
- package/src/components/tabs/tabs/tabs.vue +0 -64
- package/src/components/tabs/tabs.ts +0 -3
- package/src/core/base/Colors.stories.ts +0 -15
- package/src/core/base/Layout.stories.ts +0 -15
- package/src/core/base/Properties.stories.ts +0 -15
- package/src/core/base/base.mdx +0 -21
- package/src/core/core/core.ts +0 -144
- package/src/core/core/events.ts +0 -54
- package/src/core/core/options.ts +0 -15
- package/src/core/core/state.ts +0 -44
- package/src/core/directives/tooltip.ts +0 -55
- package/src/core/theme/Colors.stories.ts +0 -15
- package/src/core/theme/Properties.stories.ts +0 -15
- package/src/core/theme/theme.mdx +0 -15
- package/src/core/utils/date.ts +0 -164
- package/src/core/utils/device.ts +0 -48
- package/src/core/utils/dom.ts +0 -185
- package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272/gallery.vue" +0 -72
- package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272.mdx" +0 -31
- package/src/core//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272//320/235/320/260/320/261/320/276/321/200 /320/270/320/272/320/276/320/275/320/276/320/272.stories.ts" +0 -14
- package/src/docs/CSS/FAQ.mdx +0 -43
- package/src/docs/CSS//320/236/320/261/321/211/320/270/320/265 /320/274/320/276/320/264/320/270/321/204/320/270/320/272/320/260/321/202/320/276/321/200/321/213.mdx" +0 -156
- package/src/docs/CSS//320/237/320/265/321/200/320/265/320/274/320/265/320/275/320/275/321/213/320/265.mdx +0 -47
- package/src/docs/CSS//320/237/321/200/320/265/320/264/320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/321/200/321/213.mdx +0 -15
- package/src/docs/CSS//320/240/320/265/320/272/320/276/320/274/320/265/320/275/320/264/320/260/321/206/320/270/320/270 /320/221/320/255/320/234.mdx" +0 -49
- package/src/docs/CSS//320/241/321/202/320/270/320/273/320/270.md +0 -53
- package/src/docs/CSS//320/241/321/202/320/270/320/273/320/270.mdx +0 -4
- package/src/docs/CSS//320/247/321/202/320/276 /321/202/320/260/320/272/320/276/320/265 css /320/274/320/276/320/264/321/203/320/273/321/214.mdx" +0 -53
- package/src/docs/ROADMAP.md +0 -17
- package/src/docs/Roadmap.mdx +0 -4
- package/src/docs//320/222/320/262/320/265/320/264/320/265/320/275/320/270/320/265 /320/262 Storybook.mdx" +0 -323
- package/src/docs//320/232/320/276/320/274/320/277/320/276/320/275/320/265/320/275/321/202/321/213.mdx +0 -20
- package/src/docs//320/237/320/276/320/273/320/265/320/267/320/275/320/260/321/217 /320/270/320/275/321/204/320/276/321/200/320/274/320/260/321/206/320/270/321/217.mdx" +0 -8
- package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260/IDE.mdx" +0 -42
- package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260//320/233/320/270/320/275/321/202/320/265/321/200.mdx" +0 -72
- package/src/docs//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260//320/241/321/202/320/260/320/275/320/264/320/260/321/200/321/202/321/213 /320/272/320/276/320/264/320/260.mdx" +0 -29
- package/src/globals.d.ts +0 -1
- package/src/resources/styles/core/colors.css +0 -204
- package/src/resources/styles/core/components.css +0 -70
- package/src/resources/styles/core/core.ts +0 -10
- package/src/resources/styles/core/forms/clear.css +0 -19
- package/src/resources/styles/core/forms/controls.css +0 -20
- package/src/resources/styles/core/forms/focusable.css +0 -26
- package/src/resources/styles/core/forms/forms.css +0 -100
- package/src/resources/styles/core/icon.css +0 -58
- package/src/resources/styles/core/layout.css +0 -40
- package/src/resources/styles/core/modifiers/as.css +0 -9
- package/src/resources/styles/core/modifiers/ellipsis.css +0 -18
- package/src/resources/styles/core/modifiers/modifiers.css +0 -81
- package/src/resources/styles/core/modifiers/only.css +0 -19
- package/src/resources/styles/core/select.css +0 -16
- package/src/resources/styles/jquery-ui.min.css +0 -6
- package/src/resources/styles/storybook.css +0 -11
- package/src/resources/styles/themes/dark/theme.css +0 -139
- package/src/resources/styles/themes/dark.ts +0 -1
- package/src/resources/styles/themes/light/theme.css +0 -139
- package/src/resources/styles/themes/light.ts +0 -1
- package/src/storybook/components/color.vue +0 -45
- package/src/storybook/components/colors.vue +0 -34
- package/src/storybook/components/icomoon.ts +0 -38
- package/src/storybook/components/properties.vue +0 -82
- package/src/storybook/resources/accessibility.png +0 -0
- package/src/storybook/resources/accessibility.svg +0 -5
- package/src/storybook/resources/addon-library.png +0 -0
- package/src/storybook/resources/assets.png +0 -0
- package/src/storybook/resources/context.png +0 -0
- package/src/storybook/resources/discord.svg +0 -15
- package/src/storybook/resources/docs.png +0 -0
- package/src/storybook/resources/figma-plugin.png +0 -0
- package/src/storybook/resources/github.svg +0 -3
- package/src/storybook/resources/share.png +0 -0
- package/src/storybook/resources/styling.png +0 -0
- package/src/storybook/resources/testing.png +0 -0
- package/src/storybook/resources/theming.png +0 -0
- package/src/storybook/resources/tutorials.svg +0 -12
- package/src/storybook/resources/youtube.svg +0 -4
- package/src//320/224/320/276/320/261/321/200/320/276 /320/277/320/276/320/266/320/260/320/273/320/276/320/262/320/260/321/202/321/214.mdx" +0 -3
- package/tsconfig.json +0 -62
- package/vite.config.ts +0 -91
- /package/{src/resources/icomoon → icomoon}/demo-files/demo.css +0 -0
- /package/{src/resources/icomoon → icomoon}/demo-files/demo.js +0 -0
- /package/{src/resources/icomoon → icomoon}/demo.html +0 -0
- /package/{src/resources/icomoon → icomoon}/fonts/Topvisor-2.svg +0 -0
- /package/{src/resources/icomoon → icomoon}/fonts/Topvisor-2.ttf +0 -0
- /package/{src/resources/icomoon → icomoon}/fonts/Topvisor-2.woff +0 -0
- /package/{src/resources/icomoon → icomoon}/selection.json +0 -0
- /package/{src/resources/icomoon → icomoon}/style.css +0 -0
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/vue3';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Генерация объекта ArgsTypes для Storybook
|
|
5
|
-
*/
|
|
6
|
-
export function genArgsTypes(component: any, ComponentsConsts: any[string], defaultSlotAsString: boolean = false) {
|
|
7
|
-
const argTypes = {} as any;
|
|
8
|
-
|
|
9
|
-
// slot по умолчанию в виде строки
|
|
10
|
-
if (defaultSlotAsString) {
|
|
11
|
-
argTypes.default = {
|
|
12
|
-
control: 'text',
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const propsNames = Object.keys(component.props ?? []);
|
|
17
|
-
propsNames.forEach(name => {
|
|
18
|
-
// union типы, определенные через константы
|
|
19
|
-
const typeName = name[0].toLowerCase() + name.substring(1);
|
|
20
|
-
const typeNamePlural = name[0].toLowerCase() + name.substring(1) + 's';
|
|
21
|
-
|
|
22
|
-
const type = ComponentsConsts[typeName] || ComponentsConsts[typeNamePlural];
|
|
23
|
-
if (type) {
|
|
24
|
-
const size = Object.keys(type).length;
|
|
25
|
-
const controlType = (size > 3) ? 'select' : 'inline-radio';
|
|
26
|
-
|
|
27
|
-
argTypes[name] = {
|
|
28
|
-
control: controlType,
|
|
29
|
-
options: type,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// для cotrols необходимо указывать конкретный тип, выбрать первый
|
|
34
|
-
if (Array.isArray(component.props[name].type)) {
|
|
35
|
-
const type = component.props[name].type[0];
|
|
36
|
-
let control = '';
|
|
37
|
-
|
|
38
|
-
switch (type) {
|
|
39
|
-
case Boolean:
|
|
40
|
-
control = 'boolean';
|
|
41
|
-
|
|
42
|
-
break;
|
|
43
|
-
|
|
44
|
-
case String:
|
|
45
|
-
control = 'string';
|
|
46
|
-
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (control) {
|
|
51
|
-
argTypes.modelValue = {
|
|
52
|
-
control,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
return argTypes;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Сгенерировать историю обзора компонента
|
|
63
|
-
*
|
|
64
|
-
* Располагайте компонент OverviewComponent в папке stories, чтобы он не мешал основному компоненту
|
|
65
|
-
* @param options - парамтеры историии
|
|
66
|
-
* @param options.args - следует указавать только необходимые для демонстрации props, которых нет в шаблоне OverviewComponent
|
|
67
|
-
* @param OverviewComponent - компонент для вывода другого компонента в разных состояниях
|
|
68
|
-
* @returns возвращает историю обзора компонента
|
|
69
|
-
*/
|
|
70
|
-
export function genOverviewStory<Story>(options: Story & StoryObj, OverviewComponent: any): Story {
|
|
71
|
-
if (!options.args) {
|
|
72
|
-
options.args = {};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (!options.parameters) {
|
|
76
|
-
options.parameters = {};
|
|
77
|
-
}
|
|
78
|
-
if (!options.parameters.controls) {
|
|
79
|
-
options.parameters.controls = {};
|
|
80
|
-
}
|
|
81
|
-
if (!options.parameters.controls.include) {
|
|
82
|
-
options.parameters.controls.include = Object.keys(options.args);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (!options.render) {
|
|
86
|
-
options.render = (args) => ({
|
|
87
|
-
components: { OverviewComponent },
|
|
88
|
-
setup() {
|
|
89
|
-
return { args };
|
|
90
|
-
},
|
|
91
|
-
template: '<OverviewComponent :="args"/>',
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return options satisfies StoryObj;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Получить объект с css переменными из css стилей
|
|
100
|
-
* @param css - стили css
|
|
101
|
-
* @return - словарь с css переменными
|
|
102
|
-
*/
|
|
103
|
-
export function parseCSSVariables(css: string): Map<string, string> {
|
|
104
|
-
const matches = css.matchAll(/--([^:]+):([^;]+)/g);
|
|
105
|
-
|
|
106
|
-
const cssVariables = new Map();
|
|
107
|
-
|
|
108
|
-
for (const match of matches) {
|
|
109
|
-
const name = match[1].trim();
|
|
110
|
-
const value = match[2].trim();
|
|
111
|
-
|
|
112
|
-
cssVariables.set(name, value);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return cssVariables;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Сгенерировать словарь css переменных с двойной вложенностью, определяемую разделителем '-' в имени переменной
|
|
120
|
-
* @param cssVariables - словарь css переменных
|
|
121
|
-
* @param searchStrings - вернуть только подходящие по имени переменные, по условию AND
|
|
122
|
-
* @return - словарь с группами css переменных
|
|
123
|
-
*/
|
|
124
|
-
export function genCSSVariablesGroups(
|
|
125
|
-
cssVariables: Map<string, string>,
|
|
126
|
-
searchStrings: string[] = [],
|
|
127
|
-
): Map<string, Map<string, Map<string, string>>> {
|
|
128
|
-
const cssVariablesGroups2 = new Map();
|
|
129
|
-
|
|
130
|
-
cssVariables.forEach((value, name) => {
|
|
131
|
-
const parts = name.split('-');
|
|
132
|
-
const groupName = parts[0] ?? '';
|
|
133
|
-
const subgroupName = parts[1] ?? '';
|
|
134
|
-
|
|
135
|
-
for (const searchString of searchStrings) {
|
|
136
|
-
if (searchString && name.indexOf(searchString) === -1) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const group: Map<string, Map<string, string>> = cssVariablesGroups2.get(groupName) || new Map();
|
|
142
|
-
const subgroup: Map<string, string> = group.get(subgroupName) || new Map();
|
|
143
|
-
|
|
144
|
-
subgroup.set(name, value);
|
|
145
|
-
group.set(subgroupName, subgroup);
|
|
146
|
-
|
|
147
|
-
cssVariablesGroups2.set(groupName, group);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
return cssVariablesGroups2;
|
|
151
|
-
}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import Worker from '@/components/popup/lib/worker';
|
|
2
|
-
import DOM from '@/core/utils/dom';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Глобальные события, для реализации Popup
|
|
6
|
-
* Автоматически инициируется при первой загрузке, не является выгружаемым модулем
|
|
7
|
-
*
|
|
8
|
-
* Если в меню встречает класс .preloader, то событие нажатия на кнопку через enter будет остановлено
|
|
9
|
-
*/
|
|
10
|
-
class GlobalEvents {
|
|
11
|
-
static init () {
|
|
12
|
-
document.addEventListener('click', this.onclick);
|
|
13
|
-
document.addEventListener('keydown', this.onkeydown);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Глобальный обработчик кликов
|
|
18
|
-
* обрабатывает клики внутри Popup
|
|
19
|
-
* @param {Event} e
|
|
20
|
-
*/
|
|
21
|
-
static onclick (e) {
|
|
22
|
-
// элементы меню, клик по которым должен его закрыть
|
|
23
|
-
const elCloser = e.target.closest('.closer, a, .a, .top-button');
|
|
24
|
-
if (elCloser) {
|
|
25
|
-
// меню
|
|
26
|
-
const elPopup = e.target.closest('.top-popup-wrapper');
|
|
27
|
-
|
|
28
|
-
// клик вне меню
|
|
29
|
-
if (!elPopup) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// элемент имеет модификатор, запрещаюущий закрытие меню по клику на него
|
|
34
|
-
if (elCloser.matches('.top-popup-noCloser')) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// deprecated, ссылки с href="." запрещены, они должны быть заменены на .top-popup_item
|
|
39
|
-
if (elCloser.getAttribute('href') === '.') {
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// клик по кнопке открытия другого меню
|
|
44
|
-
if (e.target.matches('[data-top-popup]')) {
|
|
45
|
-
// список меню, в котором был сделан клик
|
|
46
|
-
const elUl = e.target.closest('ul');
|
|
47
|
-
|
|
48
|
-
// элемент меню, по которому был сделан клик
|
|
49
|
-
const elItem = e.target.closest('a, .a');
|
|
50
|
-
|
|
51
|
-
// сделать элемент меню, по которому сделан клик активным
|
|
52
|
-
if (elUl) {
|
|
53
|
-
elUl.querySelector('a.top-active, .a.top-active')?.classList.remove('top-active');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (elItem) {
|
|
57
|
-
elItem.classList.add('top-active');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// закрыть меню
|
|
64
|
-
Worker.close(elPopup);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// клик по фону меню
|
|
68
|
-
if (e.target.matches('.top-popup-wrapper')) {
|
|
69
|
-
const elPopup = e.target;
|
|
70
|
-
|
|
71
|
-
Worker.close(elPopup);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Глобальный обработчик нажатия кнопки на клавиатуре
|
|
77
|
-
* @param {Event} e
|
|
78
|
-
*/
|
|
79
|
-
static onkeydown (e) {
|
|
80
|
-
const elPopup = e.target.closest('.top-popup-wrapper');
|
|
81
|
-
|
|
82
|
-
// нажатие не в меню
|
|
83
|
-
if (!elPopup) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const elUl = elPopup.querySelector('ul.top-popup_content');
|
|
88
|
-
|
|
89
|
-
switch (e.key) {
|
|
90
|
-
case 'Escape':
|
|
91
|
-
// PopupWorker.close(elPopup);
|
|
92
|
-
|
|
93
|
-
break;
|
|
94
|
-
|
|
95
|
-
case 'Enter':
|
|
96
|
-
// атоматическое нажатие кнопок при нажатии Enter
|
|
97
|
-
if (!elUl) {
|
|
98
|
-
if (DOM.querySelectorVisible(elPopup, '.preloader')) {
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const elBtn = elPopup.querySelector('.top-popup_footer .go, .top-popup_footer [data-action]');
|
|
103
|
-
if (elBtn) {
|
|
104
|
-
elBtn.click();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// перейти по ссылке по нажатию на Enter
|
|
111
|
-
// данный функуционал игнорирует SPA
|
|
112
|
-
const elLink = DOM.querySelectorVisible(elPopup, 'li > a.top-active');
|
|
113
|
-
if (elLink) {
|
|
114
|
-
// фокус может находиться на другой ссылке
|
|
115
|
-
e.preventDefault();
|
|
116
|
-
|
|
117
|
-
location.href = elLink.getAttribute('href');
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// кликнуть по элементу меню по нажатию на Enter
|
|
121
|
-
const elItem = elPopup.querySelector('li > .top-active');
|
|
122
|
-
if (elItem) {
|
|
123
|
-
elItem.click();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
break;
|
|
127
|
-
|
|
128
|
-
// управление стрелками
|
|
129
|
-
case 'ArrowUp':
|
|
130
|
-
case 'ArrowRight':
|
|
131
|
-
case 'ArrowDown':
|
|
132
|
-
case 'ArrowLeft':
|
|
133
|
-
if (!elUl) {
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
138
|
-
const elMoreVisible = DOM.querySelectorVisible(elPopup, 'ul.top-popup_content > li:not(.top-popup_listTitle):not(.top-popup_listDelimiter) > .top-active > .top-popup_listMore');
|
|
139
|
-
if (elMoreVisible) {
|
|
140
|
-
e.preventDefault();
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
e.preventDefault();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const elItemActive = elPopup.querySelector('ul.top-popup_content > li:not(.top-popup_listTitle):not(.top-popup_listDelimiter) > .top-active')?.parentElement;
|
|
147
|
-
|
|
148
|
-
// есть подменю
|
|
149
|
-
if (e.key === 'ArrowRight' && elItemActive) {
|
|
150
|
-
// const elItemMoreActive = elItemActive.querySelector('[data-top-popup].top-active');
|
|
151
|
-
// if (elItemMoreActive) {
|
|
152
|
-
// return elItemMoreActive.click();
|
|
153
|
-
// }
|
|
154
|
-
|
|
155
|
-
const elMore = elItemActive.querySelector('.top-active > .top-popup_listMore');
|
|
156
|
-
if (elMore) {
|
|
157
|
-
return elMore.click();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const elsLiVisible = DOM.querySelectorAllVisible(elPopup, 'ul.top-popup_content > li:not(.top-popup_listTitle):not(.top-popup_listDelimiter)');
|
|
162
|
-
const countLi = elsLiVisible.length;
|
|
163
|
-
|
|
164
|
-
let index = elsLiVisible.indexOf(elItemActive);
|
|
165
|
-
|
|
166
|
-
if (e.key === 'ArrowUp' || e.key === 'ArrowLeft') {
|
|
167
|
-
index--;
|
|
168
|
-
} else {
|
|
169
|
-
index++;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// это первый элемен, "Назад" должен закрывать окно
|
|
173
|
-
if (e.key === 'ArrowLeft' && index === -1) {
|
|
174
|
-
if (e.target.matches('input')) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return Worker.close(elPopup);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// это последний элемен, "Вперед" не должен ни чего делать
|
|
182
|
-
if (e.key === 'ArrowRight' && index === countLi) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (index < 0) {
|
|
187
|
-
index = countLi - 1;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (index > countLi - 1) {
|
|
191
|
-
index = 0;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
elPopup.querySelectorAll('ul.top-popup_content > li > .top-active').forEach(el => el.classList.remove('top-active'));
|
|
195
|
-
elsLiVisible[index].querySelector(':scope > a, :scope > .a').classList.add('top-active');
|
|
196
|
-
|
|
197
|
-
Worker.scrollToActive(elPopup);
|
|
198
|
-
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export default GlobalEvents;
|