@dxtmisha/scripts 0.6.3 → 0.7.2
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/bin/ai-doc.ts +1 -3
- package/bin/build-functional.ts +5 -0
- package/bin/design-flags.ts +5 -0
- package/package.json +10 -6
- package/src/classes/Build/buildFunctional.ts +39 -0
- package/src/classes/Design/DesignCommand.ts +52 -2
- package/src/classes/Design/DesignComponent.ts +73 -16
- package/src/classes/Design/DesignConstructor.ts +40 -15
- package/src/classes/Design/DesignConstructors.ts +57 -2
- package/src/classes/Design/DesignFlags.ts +199 -0
- package/src/classes/Design/DesignReplace.ts +1 -1
- package/src/classes/Design/DesignUi.ts +41 -2
- package/src/classes/Library/LibraryAiWiki.ts +126 -0
- package/src/classes/Library/LibraryAiWikiItem.ts +79 -0
- package/src/classes/Library/LibraryExport.ts +0 -2
- package/src/classes/Library/LibraryItems.ts +13 -4
- package/src/classes/Library/LibraryList.ts +184 -0
- package/src/classes/Library/LibraryMedia.ts +1 -2
- package/src/classes/Library/LibraryPlugin.ts +70 -0
- package/src/classes/Library/LibraryTypes.ts +106 -0
- package/src/classes/Package/PackageItem.ts +3 -1
- package/src/classes/Properties/PropertiesConfig.ts +9 -0
- package/src/classes/Properties/PropertiesFile.ts +5 -3
- package/src/classes/Styles/Styles.ts +1 -0
- package/src/config.ts +7 -0
- package/src/library.ts +4 -0
- package/src/media/templates/component/{DesignComponentWikiAi.vue → DesignComponentAiWiki.vue} +2 -2
- package/src/media/templates/component/props.ts +2 -3
- package/src/media/templates/component/styleToken.scss +1 -1
- package/src/media/templates/constructors/props.ts +3 -4
- package/src/media/templates/packages/library/src/main.ts +1 -1
- package/src/media/templates/packages/project/design.config.json +3 -0
- package/src/media/templates/packages/project/index.html +1 -2
- package/src/media/templates/packages/project/src/main.ts +2 -1
- package/src/media/templates/packages/project/src/vite-env.d.ts +1 -0
- package/src/types/configTypes.ts +3 -0
- package/src/types/designTypes.ts +12 -0
- package/src/types/libraryTypes.ts +1 -1
- /package/src/media/templates/packages/{library → project}/public/_.gitignore.txt +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// export:none
|
|
2
|
+
|
|
3
|
+
import { Canvas, createCanvas, loadImage, type SKRSContext2D } from '@napi-rs/canvas'
|
|
4
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
5
|
+
|
|
6
|
+
import type { DesignFlagsItem, DesignFlagsList } from '../../types/designTypes'
|
|
7
|
+
|
|
8
|
+
import { UI_DIR_IN } from '../../config'
|
|
9
|
+
|
|
10
|
+
const DESIGN_FLAGS_FACTOR = 2
|
|
11
|
+
const DESIGN_FLAGS_MIME = 'image/webp'
|
|
12
|
+
const DESIGN_FLAGS_FILE_NAME_ITEM = 'flags.webp'
|
|
13
|
+
const DESIGN_FLAGS_FILE_NAME = [UI_DIR_IN, 'assets', DESIGN_FLAGS_FILE_NAME_ITEM]
|
|
14
|
+
const DESIGN_FLAGS_FILE_PATH = ['.', '..', 'assets', DESIGN_FLAGS_FILE_NAME_ITEM]
|
|
15
|
+
const DESIGN_FLAGS_FILE_STYLE_NAME = [UI_DIR_IN, 'styles', 'flags.css']
|
|
16
|
+
const DESIGN_FLAGS_CLASS_NAME = '.ui-sys-flags'
|
|
17
|
+
|
|
18
|
+
export class DesignFlags {
|
|
19
|
+
protected list: string[]
|
|
20
|
+
protected data: DesignFlagsList = []
|
|
21
|
+
|
|
22
|
+
protected x: number = 0
|
|
23
|
+
protected y: number = 0
|
|
24
|
+
|
|
25
|
+
protected square: number
|
|
26
|
+
protected top: number
|
|
27
|
+
protected left: number
|
|
28
|
+
|
|
29
|
+
protected readonly canvas: Canvas
|
|
30
|
+
protected readonly context: SKRSContext2D
|
|
31
|
+
|
|
32
|
+
constructor(
|
|
33
|
+
protected readonly dir: string = 'src/assets/flags',
|
|
34
|
+
protected readonly width: number = 96,
|
|
35
|
+
protected readonly height: number = 72,
|
|
36
|
+
protected readonly columns: number = 12
|
|
37
|
+
) {
|
|
38
|
+
this.list = this.initList()
|
|
39
|
+
this.square = this.initSquare()
|
|
40
|
+
this.top = this.initTop()
|
|
41
|
+
this.left = this.initLeft()
|
|
42
|
+
|
|
43
|
+
this.canvas = this.initCanvas()
|
|
44
|
+
this.context = this.initContext()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async make() {
|
|
48
|
+
for (const file of this.list) {
|
|
49
|
+
await this.addImage(file)
|
|
50
|
+
|
|
51
|
+
this.data.push(this.addData(file))
|
|
52
|
+
this.next()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
this.save()
|
|
56
|
+
this.saveStyle()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getLines(): number {
|
|
60
|
+
return Math.ceil(this.list.length / this.columns)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Returns the maximum width of the canvas.
|
|
65
|
+
*
|
|
66
|
+
* Возвращает максимальную ширину холста.
|
|
67
|
+
*/
|
|
68
|
+
protected getCanvasWidth(): number {
|
|
69
|
+
return this.columns * this.square
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Returns the maximum height of the canvas.
|
|
74
|
+
*
|
|
75
|
+
* Возвращает максимальную высоту холста.
|
|
76
|
+
*/
|
|
77
|
+
protected getCanvasHeight(): number {
|
|
78
|
+
return this.getLines() * this.square
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
protected getDx() {
|
|
82
|
+
return (this.x * this.square) + this.left
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
protected getDy() {
|
|
86
|
+
return (this.y * this.square) + this.top
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
protected getStyle(): string {
|
|
90
|
+
const backgroundSizeColumns = this.columns * (this.square / this.width)
|
|
91
|
+
const backgroundSizeLines = this.getLines() * (this.square / this.height)
|
|
92
|
+
|
|
93
|
+
let style: string = `
|
|
94
|
+
${DESIGN_FLAGS_CLASS_NAME} {
|
|
95
|
+
--sys-flags-width: ${this.width}px;
|
|
96
|
+
--sys-flags-height: ${this.height}px;
|
|
97
|
+
--sys-flags-top: ${this.top}px;
|
|
98
|
+
--sys-flags-left: ${this.left}px;
|
|
99
|
+
--sys-flags-lines: ${this.getLines()};
|
|
100
|
+
|
|
101
|
+
background-image: url("${DESIGN_FLAGS_FILE_PATH.join('/')}");
|
|
102
|
+
background-size: calc(100% * ${backgroundSizeColumns}) calc(100% * ${backgroundSizeLines});
|
|
103
|
+
}
|
|
104
|
+
`.trim()
|
|
105
|
+
|
|
106
|
+
const x = 100 / (this.getCanvasWidth() - this.width)
|
|
107
|
+
const y = 100 / (this.getCanvasHeight() - this.height)
|
|
108
|
+
|
|
109
|
+
this.data.forEach((item) => {
|
|
110
|
+
style += `
|
|
111
|
+
${DESIGN_FLAGS_CLASS_NAME}--${item.name} {
|
|
112
|
+
background-position: ${item.x * x}% ${item.y * y}%;
|
|
113
|
+
}`
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
return style
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
protected async addImage(file: string): Promise<void> {
|
|
120
|
+
const path = PropertiesFile.joinPath([this.dir, file])
|
|
121
|
+
const image = await loadImage(path)
|
|
122
|
+
|
|
123
|
+
this.context.drawImage(
|
|
124
|
+
image,
|
|
125
|
+
this.getDx(),
|
|
126
|
+
this.getDy(),
|
|
127
|
+
this.width,
|
|
128
|
+
this.height
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
protected addData(file: string): DesignFlagsItem {
|
|
133
|
+
return {
|
|
134
|
+
name: file.replace(/\.[^.]+$/, ''),
|
|
135
|
+
x: this.getDx(),
|
|
136
|
+
y: this.getDy()
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
protected next(): void {
|
|
141
|
+
this.x++
|
|
142
|
+
|
|
143
|
+
if (this.x >= this.columns) {
|
|
144
|
+
this.x = 0
|
|
145
|
+
this.y++
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
protected save(): void {
|
|
150
|
+
const buffer = this.canvas.toBuffer(DESIGN_FLAGS_MIME, 64)
|
|
151
|
+
|
|
152
|
+
if (buffer) {
|
|
153
|
+
PropertiesFile.writeByPath(
|
|
154
|
+
DESIGN_FLAGS_FILE_NAME,
|
|
155
|
+
buffer,
|
|
156
|
+
false
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
protected saveStyle(): void {
|
|
162
|
+
PropertiesFile.writeByPath(
|
|
163
|
+
DESIGN_FLAGS_FILE_STYLE_NAME,
|
|
164
|
+
this.getStyle()
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
protected initCanvas(): Canvas {
|
|
169
|
+
return createCanvas(
|
|
170
|
+
this.getCanvasWidth(),
|
|
171
|
+
this.getCanvasHeight()
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
protected initContext(): SKRSContext2D {
|
|
176
|
+
return this.canvas.getContext('2d', { alpha: true })
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
protected initLeft(): number {
|
|
180
|
+
return (this.square / 2) - (this.width / 2)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
protected initList(): string[] {
|
|
184
|
+
return PropertiesFile.readDir(this.dir)
|
|
185
|
+
.filter(dir => dir.endsWith('.svg'))
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
protected initSquare(): number {
|
|
189
|
+
if (this.width >= this.height) {
|
|
190
|
+
return this.width * DESIGN_FLAGS_FACTOR
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return this.height * DESIGN_FLAGS_FACTOR
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
protected initTop(): number {
|
|
197
|
+
return (this.square / 2) - (this.height / 2)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
// export:none
|
|
2
2
|
|
|
3
|
-
import { toKebabCase } from '@dxtmisha/functional-basic'
|
|
3
|
+
import { toCamelCaseFirst, toKebabCase } from '@dxtmisha/functional-basic'
|
|
4
|
+
import { getPackageJson } from '../../functions/getPackageJson'
|
|
4
5
|
|
|
6
|
+
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
7
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
8
|
+
import { PropertiesCache } from '../Properties/PropertiesCache'
|
|
5
9
|
import { DesignComponent } from './DesignComponent'
|
|
6
10
|
import { LibraryItems } from '../Library/LibraryItems'
|
|
7
|
-
import { PropertiesCache } from '../Properties/PropertiesCache'
|
|
8
11
|
import { Styles } from '../Styles/Styles'
|
|
9
12
|
|
|
10
13
|
import { DesignWiki } from './DesignWiki'
|
|
11
14
|
|
|
15
|
+
import { LibraryAiWiki } from '../Library/LibraryAiWiki'
|
|
12
16
|
import { LibraryMedia } from '../Library/LibraryMedia'
|
|
17
|
+
import { LibraryList } from '../Library/LibraryList'
|
|
18
|
+
import { LibraryPlugin } from '../Library/LibraryPlugin'
|
|
19
|
+
import { LibraryTypes } from '../Library/LibraryTypes'
|
|
20
|
+
|
|
21
|
+
import { UI_FILE_PACKAGE } from '../../config'
|
|
13
22
|
|
|
14
23
|
export class DesignUi {
|
|
15
24
|
protected readonly components: LibraryItems
|
|
@@ -45,8 +54,13 @@ export class DesignUi {
|
|
|
45
54
|
new DesignWiki().make()
|
|
46
55
|
|
|
47
56
|
this.makeConstructorComponent()
|
|
57
|
+
this.makePackage()
|
|
48
58
|
|
|
49
59
|
new LibraryMedia(this.components).make()
|
|
60
|
+
new LibraryList(this.components).make()
|
|
61
|
+
new LibraryPlugin(this.components).make()
|
|
62
|
+
new LibraryAiWiki(this.components).make()
|
|
63
|
+
new LibraryTypes(this.components).make()
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
/**
|
|
@@ -70,4 +84,29 @@ export class DesignUi {
|
|
|
70
84
|
|
|
71
85
|
return this
|
|
72
86
|
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Updates the package.json file by adding export paths for UI styles and saves the changes.
|
|
90
|
+
*
|
|
91
|
+
* Обновляет файл package.json, добавляя пути экспорта для стилей UI, и сохраняет изменения.
|
|
92
|
+
*/
|
|
93
|
+
protected makePackage(): void {
|
|
94
|
+
const packageJson = getPackageJson()
|
|
95
|
+
const projectName = toCamelCaseFirst(PropertiesConfig.getProjectName())
|
|
96
|
+
|
|
97
|
+
if (packageJson?.exports) {
|
|
98
|
+
packageJson.exports['./plugin'] = {
|
|
99
|
+
import: './dist/plugin.js',
|
|
100
|
+
types: './dist/library/plugin.d.ts'
|
|
101
|
+
}
|
|
102
|
+
packageJson.exports['./style.css'] = './dist/style.css'
|
|
103
|
+
packageJson.exports['./style/ui.scss'] = `./src/styles/${projectName}/main.scss`
|
|
104
|
+
packageJson.exports['./style/ui-properties.scss'] = `./src/styles/${projectName}/style.scss`
|
|
105
|
+
packageJson.exports['./types.d.ts'] = {
|
|
106
|
+
types: './dist/library/types.d.ts'
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
PropertiesFile.writeByPath(UI_FILE_PACKAGE, packageJson)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
73
112
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
2
|
+
import { LibraryItems } from './LibraryItems'
|
|
3
|
+
import { LibraryAiWikiItem } from './LibraryAiWikiItem'
|
|
4
|
+
|
|
5
|
+
import { UI_DIRS_COMPONENTS } from '../../config'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Class for creating a list of components for AI Wiki.
|
|
9
|
+
*
|
|
10
|
+
* Класс для создания списка компонентов для AI Wiki.
|
|
11
|
+
*/
|
|
12
|
+
export class LibraryAiWiki {
|
|
13
|
+
/**
|
|
14
|
+
* Constructor
|
|
15
|
+
* @param items object for working with the list of components / объект для работы со списком компонентов
|
|
16
|
+
*/
|
|
17
|
+
constructor(
|
|
18
|
+
protected readonly items: LibraryItems
|
|
19
|
+
) {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates files for AI Wiki.
|
|
24
|
+
*
|
|
25
|
+
* Создает файлы для AI Wiki.
|
|
26
|
+
*/
|
|
27
|
+
make(): void {
|
|
28
|
+
this.makeList()
|
|
29
|
+
this.makeComponent()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns the file name for the list.
|
|
34
|
+
*
|
|
35
|
+
* Возвращает имя файла для списка.
|
|
36
|
+
*/
|
|
37
|
+
protected getFileList(): string {
|
|
38
|
+
return 'ai-list'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns a list of components for AI Wiki.
|
|
43
|
+
*
|
|
44
|
+
* Возвращает список компонентов для AI Wiki.
|
|
45
|
+
*/
|
|
46
|
+
protected getList(): LibraryAiWikiItem[] {
|
|
47
|
+
const data: LibraryAiWikiItem[] = []
|
|
48
|
+
|
|
49
|
+
this.items.getComponentList()
|
|
50
|
+
.forEach((component) => {
|
|
51
|
+
const aiWiki = new LibraryAiWikiItem(component)
|
|
52
|
+
|
|
53
|
+
if (aiWiki.isAiWiki()) {
|
|
54
|
+
data.push(aiWiki)
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
return data
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Creates a file with a list of components.
|
|
63
|
+
*
|
|
64
|
+
* Создает файл со списком компонентов.
|
|
65
|
+
*/
|
|
66
|
+
protected makeList(): void {
|
|
67
|
+
const data = this.getList()
|
|
68
|
+
const imports: string[] = []
|
|
69
|
+
const list: string[] = []
|
|
70
|
+
|
|
71
|
+
console.log('Ai wiki:', data.length, 'components')
|
|
72
|
+
|
|
73
|
+
data.forEach((item) => {
|
|
74
|
+
imports.push(item.getImport())
|
|
75
|
+
list.push(` ${item.getCode()}`)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
this.items.write(
|
|
79
|
+
this.getFileList(),
|
|
80
|
+
[
|
|
81
|
+
...imports,
|
|
82
|
+
'',
|
|
83
|
+
'export const aiList: any[] = [',
|
|
84
|
+
list.join(',\r\n'),
|
|
85
|
+
']'
|
|
86
|
+
],
|
|
87
|
+
'wiki.ts'
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Creates a component for displaying the list.
|
|
93
|
+
*
|
|
94
|
+
* Создает компонент для отображения списка.
|
|
95
|
+
*/
|
|
96
|
+
protected makeComponent() {
|
|
97
|
+
PropertiesFile.writeByPath(
|
|
98
|
+
[...UI_DIRS_COMPONENTS, 'AiWiki.vue'],
|
|
99
|
+
`<script setup lang="ts">
|
|
100
|
+
// This file is generated by a script, do not edit.
|
|
101
|
+
|
|
102
|
+
import { DxtTestPage, DxtTestWikiAnchor } from '@dxtmisha/test'
|
|
103
|
+
import { aiList } from '../library/${this.getFileList()}.wiki'
|
|
104
|
+
|
|
105
|
+
defineOptions({
|
|
106
|
+
name: 'AiWiki'
|
|
107
|
+
})
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<template>
|
|
111
|
+
<DxtTestPage
|
|
112
|
+
title="List of available UI components"
|
|
113
|
+
description="Below is a list of Vue 3 components available in the UI. These components are available immediately and do not need to be imported."
|
|
114
|
+
>
|
|
115
|
+
<DxtTestWikiAnchor :list="aiList"/>
|
|
116
|
+
<component
|
|
117
|
+
v-for="(item, key) in aiList"
|
|
118
|
+
:key="key"
|
|
119
|
+
:is="item"
|
|
120
|
+
/>
|
|
121
|
+
</DxtTestPage>
|
|
122
|
+
</template>
|
|
123
|
+
`
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { LibraryData } from '../../types/libraryTypes'
|
|
2
|
+
|
|
3
|
+
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
4
|
+
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
5
|
+
|
|
6
|
+
import { UI_DIRS_COMPONENTS } from '../../config'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Class for working with the AI Wiki component.
|
|
10
|
+
*
|
|
11
|
+
* Класс для работы с компонентом AI Wiki.
|
|
12
|
+
*/
|
|
13
|
+
export class LibraryAiWikiItem {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor
|
|
16
|
+
* @param item component data / данные компонента
|
|
17
|
+
*/
|
|
18
|
+
constructor(
|
|
19
|
+
protected readonly item: LibraryData
|
|
20
|
+
) {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Checks if the AI Wiki file exists.
|
|
25
|
+
*
|
|
26
|
+
* Проверяет, существует ли файл AI Wiki.
|
|
27
|
+
*/
|
|
28
|
+
isAiWiki(): boolean {
|
|
29
|
+
return PropertiesFile.is(this.getPath())
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns the component code.
|
|
34
|
+
*
|
|
35
|
+
* Возвращает код компонента.
|
|
36
|
+
*/
|
|
37
|
+
getCode(): string {
|
|
38
|
+
return this.item.codeFull
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns the file name for the AI Wiki component.
|
|
43
|
+
*
|
|
44
|
+
* Возвращает имя файла для компонента AI Wiki.
|
|
45
|
+
*/
|
|
46
|
+
getComponentFileNameAiWiki(): string {
|
|
47
|
+
return `${this.item.codeFull}AiWiki.vue`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns the import string for the component.
|
|
52
|
+
*
|
|
53
|
+
* Возвращает строку импорта для компонента.
|
|
54
|
+
*/
|
|
55
|
+
getImport(): string {
|
|
56
|
+
const code = this.item.codeFull
|
|
57
|
+
const path: string[] = [
|
|
58
|
+
'..',
|
|
59
|
+
'..',
|
|
60
|
+
...this.getPath()
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
return `import ${code} from '${path.join('/')}'`
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns the path to the file.
|
|
68
|
+
*
|
|
69
|
+
* Возвращает путь к файлу.
|
|
70
|
+
*/
|
|
71
|
+
protected getPath(): string[] {
|
|
72
|
+
return [
|
|
73
|
+
...UI_DIRS_COMPONENTS,
|
|
74
|
+
PropertiesConfig.getProjectName(),
|
|
75
|
+
this.item.dir,
|
|
76
|
+
this.getComponentFileNameAiWiki()
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -5,7 +5,7 @@ import { toCamelCaseFirst, toKebabCase } from '@dxtmisha/functional-basic'
|
|
|
5
5
|
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
6
6
|
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
7
7
|
|
|
8
|
-
import type { LibraryData,
|
|
8
|
+
import type { LibraryData, LibraryAll } from '../../types/libraryTypes'
|
|
9
9
|
|
|
10
10
|
import { UI_DIRS_LIBRARY, UI_DIRS_COMPONENTS } from '../../config'
|
|
11
11
|
|
|
@@ -15,7 +15,7 @@ import { UI_DIRS_LIBRARY, UI_DIRS_COMPONENTS } from '../../config'
|
|
|
15
15
|
* Класс для работы со списком компонентов.
|
|
16
16
|
*/
|
|
17
17
|
export class LibraryItems {
|
|
18
|
-
protected readonly items:
|
|
18
|
+
protected readonly items: LibraryAll
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Constructor
|
|
@@ -29,7 +29,7 @@ export class LibraryItems {
|
|
|
29
29
|
*
|
|
30
30
|
* Возвращает список компонентов, разделенных по группам дизайна.
|
|
31
31
|
*/
|
|
32
|
-
get():
|
|
32
|
+
get(): LibraryAll {
|
|
33
33
|
return this.items
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -46,6 +46,15 @@ export class LibraryItems {
|
|
|
46
46
|
return list
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Returns the number of components.
|
|
51
|
+
*
|
|
52
|
+
* Возвращает количество компонентов.
|
|
53
|
+
*/
|
|
54
|
+
getCount(): number {
|
|
55
|
+
return this.getComponentList().length
|
|
56
|
+
}
|
|
57
|
+
|
|
49
58
|
/**
|
|
50
59
|
* Writes data in the file.
|
|
51
60
|
*
|
|
@@ -118,7 +127,7 @@ export class LibraryItems {
|
|
|
118
127
|
*
|
|
119
128
|
* Инициализирует данные о компоненте.
|
|
120
129
|
*/
|
|
121
|
-
protected initItems():
|
|
130
|
+
protected initItems(): LibraryAll {
|
|
122
131
|
return [
|
|
123
132
|
{
|
|
124
133
|
name: PropertiesConfig.getDesignName(),
|