iwgt 2.3.0
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/LICENSE +22 -0
- package/README.md +27 -0
- package/dist/data/references/block-templates-full.json +2420 -0
- package/dist/data/references/category-block-templates.json +328 -0
- package/dist/data/references/category-settings.json +12530 -0
- package/dist/data/references/collections-menu-patterns.json +306 -0
- package/dist/data/references/commonjs-reference.json +1403 -0
- package/dist/data/references/icons-registry.json +724 -0
- package/dist/data/references/libraries-registry.json +632 -0
- package/dist/data/references/liquid-filters.json +497 -0
- package/dist/data/references/liquid-variables.json +3196 -0
- package/dist/data/references/messages-templates.json +3116 -0
- package/dist/data/references/my-layout-reference.json +95 -0
- package/dist/generators/index.d.ts +87 -0
- package/dist/generators/index.js +1052 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/server-http.d.ts +7 -0
- package/dist/server-http.js +165 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.js +579 -0
- package/dist/tools/index.d.ts +38 -0
- package/dist/tools/index.js +430 -0
- package/dist/types/index.d.ts +181 -0
- package/dist/types/index.js +3 -0
- package/dist/utils/index.d.ts +29 -0
- package/dist/utils/index.js +157 -0
- package/package.json +28 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"description": "CSS фреймворк InSales для виджетов",
|
|
4
|
+
"components": [
|
|
5
|
+
{
|
|
6
|
+
"name": "layout",
|
|
7
|
+
"class": ".layout",
|
|
8
|
+
"description": "Основной контейнер виджета",
|
|
9
|
+
"cssVariables": [
|
|
10
|
+
"--layout-pt",
|
|
11
|
+
"--layout-pb",
|
|
12
|
+
"--layout-wide-bg",
|
|
13
|
+
"--layout-wide-content",
|
|
14
|
+
"--layout-edge"
|
|
15
|
+
],
|
|
16
|
+
"usage": "Всегда оборачивать виджет в .layout"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "grid-list",
|
|
20
|
+
"class": ".grid-list",
|
|
21
|
+
"description": "Сетка для элементов",
|
|
22
|
+
"modifiers": [
|
|
23
|
+
".grid-list--cols-2",
|
|
24
|
+
".grid-list--cols-3",
|
|
25
|
+
".grid-list--cols-4",
|
|
26
|
+
".grid-list--cols-5",
|
|
27
|
+
".grid-list--cols-6"
|
|
28
|
+
],
|
|
29
|
+
"usage": "Для списков товаров, преимуществ, и т.д."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "img-ratio",
|
|
33
|
+
"class": ".img-ratio",
|
|
34
|
+
"description": "Соотношение сторон изображения",
|
|
35
|
+
"cssVariables": [
|
|
36
|
+
"--img-ratio"
|
|
37
|
+
],
|
|
38
|
+
"usage": "Для адаптивных изображений"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "font-size-factor",
|
|
42
|
+
"description": "Адаптивный размер шрифта",
|
|
43
|
+
"cssVariables": [
|
|
44
|
+
"--font-size-factor"
|
|
45
|
+
],
|
|
46
|
+
"usage": "Для масштабирования текста"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "btn",
|
|
50
|
+
"class": ".btn",
|
|
51
|
+
"description": "Кнопка",
|
|
52
|
+
"modifiers": [
|
|
53
|
+
".btn--primary",
|
|
54
|
+
".btn--secondary"
|
|
55
|
+
],
|
|
56
|
+
"usage": "Стандартная кнопка"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"cssVariables": {
|
|
60
|
+
"colors": [
|
|
61
|
+
"--color-text",
|
|
62
|
+
"--color-text-light",
|
|
63
|
+
"--color-text-dark",
|
|
64
|
+
"--color-btn-bg",
|
|
65
|
+
"--color-btn-text"
|
|
66
|
+
],
|
|
67
|
+
"layout": [
|
|
68
|
+
"--layout-pt",
|
|
69
|
+
"--layout-pb",
|
|
70
|
+
"--layout-wide-bg",
|
|
71
|
+
"--layout-wide-content",
|
|
72
|
+
"--layout-edge"
|
|
73
|
+
],
|
|
74
|
+
"images": [
|
|
75
|
+
"--img-ratio",
|
|
76
|
+
"--img-border-radius",
|
|
77
|
+
"--img-fit"
|
|
78
|
+
],
|
|
79
|
+
"typography": [
|
|
80
|
+
"--font-size-factor",
|
|
81
|
+
"--line-height",
|
|
82
|
+
"--letter-spacing"
|
|
83
|
+
],
|
|
84
|
+
"spacing": [
|
|
85
|
+
"--gap",
|
|
86
|
+
"--gutter"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"examples": {
|
|
90
|
+
"basicWidget": "<div class=\"layout\">\n <!-- Контент виджета -->\n</div>",
|
|
91
|
+
"gridLayout": "<div class=\"grid-list grid-list--cols-3\">\n <div class=\"grid-list__item\">...</div>\n <div class=\"grid-list__item\">...</div>\n <div class=\"grid-list__item\">...</div>\n</div>",
|
|
92
|
+
"imageRatio": "<div class=\"img-ratio\" style=\"--img-ratio: 1.5\">\n <img src=\"...\" alt=\"...\">\n</div>",
|
|
93
|
+
"button": "<button class=\"btn btn--primary\">Нажмите</button>"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Генераторы файлов виджетов
|
|
3
|
+
* Модуль содержит функции для генерации содержимого файлов виджета
|
|
4
|
+
*/
|
|
5
|
+
import type { BlockTemplate } from '../types/index.js';
|
|
6
|
+
export interface WidgetConfig {
|
|
7
|
+
handle: string;
|
|
8
|
+
category: string;
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
blockTemplate?: BlockTemplate;
|
|
12
|
+
libraries: string[];
|
|
13
|
+
commonSettings: any[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Генерирует имя виджета из описания
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateWidgetName(description: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Генерирует info.json
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateInfoJson(config: WidgetConfig): Record<string, any>;
|
|
23
|
+
/**
|
|
24
|
+
* Генерирует messages.json
|
|
25
|
+
* Использует только те ключи, которых нет в глобальных messages
|
|
26
|
+
* Глобальные ключи: background, indentation, content, adaptive, widget_background_color,
|
|
27
|
+
* wide_background, wide_content, padding_top, padding_bottom, content_max_width,
|
|
28
|
+
* remove_padding_at_edges, hide_desktop, hide_mobile и другие
|
|
29
|
+
*/
|
|
30
|
+
export declare function generateMessages(description: string): Record<string, any>;
|
|
31
|
+
/**
|
|
32
|
+
* Генерирует settings_data.json
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateSettingsData(commonSettings: any[]): Record<string, any>;
|
|
35
|
+
/**
|
|
36
|
+
* Генерирует settings_form.json
|
|
37
|
+
* Структура согласно документации:
|
|
38
|
+
* - content: специфичные настройки виджета
|
|
39
|
+
* - design: типовые настройки (фон, отступы, адаптивность)
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateSettingsForm(commonSettings: any[]): {
|
|
42
|
+
form: Record<string, any[]>;
|
|
43
|
+
count: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Генерирует snippet.liquid
|
|
47
|
+
* ВАЖНО: Код автоматически оборачивается системой в div.layout с CSS-переменными
|
|
48
|
+
* НЕ добавляйте обёртку layout вручную!
|
|
49
|
+
*/
|
|
50
|
+
export declare function generateSnippetLiquid(config: WidgetConfig): string;
|
|
51
|
+
/**
|
|
52
|
+
* Генерирует snippet.scss
|
|
53
|
+
* ВАЖНО: Весь код оборачивается в класс виджета
|
|
54
|
+
* Используйте & для обращения к родительскому элементу (layout + класс виджета)
|
|
55
|
+
*/
|
|
56
|
+
export declare function generateSnippetScss(config: WidgetConfig): string;
|
|
57
|
+
/**
|
|
58
|
+
* Генерирует snippet.js
|
|
59
|
+
* ВАЖНО:
|
|
60
|
+
* - Код автоматически оборачивается в try/catch
|
|
61
|
+
* - Доступны переменные: widget (селектор) и $widget (jQuery объект)
|
|
62
|
+
* - НЕ используйте Vue.js или другие фреймворки!
|
|
63
|
+
* - На странице может быть несколько экземпляров виджета - используйте $widget.each()
|
|
64
|
+
*/
|
|
65
|
+
export declare function generateSnippetJs(config: WidgetConfig): string;
|
|
66
|
+
/**
|
|
67
|
+
* Генерирует setup.json для block_list_widget_type
|
|
68
|
+
*/
|
|
69
|
+
export declare function generateSetupJson(blockTemplate: BlockTemplate): Record<string, any>;
|
|
70
|
+
/**
|
|
71
|
+
* Генерирует код меню категорий на основе выбранного паттерна
|
|
72
|
+
*/
|
|
73
|
+
export declare function generateCollectionsMenu(args: {
|
|
74
|
+
patternId: string;
|
|
75
|
+
customSettings?: any;
|
|
76
|
+
cssPrefix?: string;
|
|
77
|
+
}): {
|
|
78
|
+
liquidCode: string;
|
|
79
|
+
requiredSettings: any[];
|
|
80
|
+
cssPrefix: string;
|
|
81
|
+
dataAttributes: any[];
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Генерирует все файлы виджета
|
|
85
|
+
*/
|
|
86
|
+
export declare function generateWidgetFiles(config: WidgetConfig): Record<string, any>;
|
|
87
|
+
//# sourceMappingURL=index.d.ts.map
|