@dxtmisha/scripts 0.7.2 → 0.7.6
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/design-wiki-storm.ts +9 -0
- package/package.json +5 -3
- package/src/classes/Ai/AiAbstract.ts +14 -1
- package/src/classes/Ai/AiGoogleLite.ts +2 -1
- package/src/classes/Build/__tests__/buildFunctional.test.ts +43 -0
- package/src/classes/Build/buildFunctional.ts +15 -0
- package/src/classes/Component/ComponentCreator.ts +1 -0
- package/src/classes/Component/ComponentItem.ts +15 -0
- package/src/classes/Component/ComponentWiki.ts +8 -0
- package/src/classes/Component/ComponentWikiFile.ts +2 -0
- package/src/classes/Component/__tests__/ComponentCreator.test.ts +71 -0
- package/src/classes/Component/__tests__/ComponentItem.test.ts +71 -0
- package/src/classes/Design/DesignCommand.ts +13 -8
- package/src/classes/Design/DesignComponent.ts +235 -28
- package/src/classes/Design/DesignConstructor.ts +9 -5
- package/src/classes/Design/DesignConstructors.ts +8 -4
- package/src/classes/Design/DesignFlags.ts +16 -0
- package/src/classes/Design/DesignReplace.ts +10 -6
- package/src/classes/Design/DesignStructure.ts +8 -6
- package/src/classes/Design/DesignStructureClasses.ts +8 -4
- package/src/classes/Design/DesignStructureItemAbstract.ts +11 -2
- package/src/classes/Design/DesignStructureRead.ts +8 -4
- package/src/classes/Design/DesignStructureStyles.ts +8 -4
- package/src/classes/Design/DesignTypes.ts +53 -28
- package/src/classes/Design/DesignTypescript.ts +11 -2
- package/src/classes/Design/DesignUi.ts +42 -11
- package/src/classes/Design/DesignWiki.ts +4 -6
- package/src/classes/Design/DesignWikiStorm.ts +94 -0
- package/src/classes/Design/DesignWikiStormItem.ts +246 -0
- package/src/classes/Git/GitRead.ts +1 -0
- package/src/classes/Git/__tests__/GitRead.test.ts +70 -0
- package/src/classes/Library/LibraryAiWiki.ts +2 -1
- package/src/classes/Library/LibraryFlags.ts +9 -7
- package/src/classes/Library/LibraryItems.ts +9 -9
- package/src/classes/Library/LibraryList.ts +10 -5
- package/src/classes/Library/LibraryMedia.ts +21 -6
- package/src/classes/Library/LibraryPlugin.ts +8 -5
- package/src/classes/Library/LibraryTypes.ts +34 -10
- package/src/classes/Package/PackageInit.ts +12 -4
- package/src/classes/Package/PackageItem.ts +13 -4
- package/src/classes/Properties/Properties.ts +14 -3
- package/src/classes/Properties/PropertiesCache.ts +19 -20
- package/src/classes/Properties/PropertiesConfig.ts +39 -28
- package/src/classes/Properties/PropertiesConvector.ts +10 -6
- package/src/classes/Properties/PropertiesFile.ts +22 -28
- package/src/classes/Properties/PropertiesImport.ts +10 -7
- package/src/classes/Properties/PropertiesItems.ts +19 -12
- package/src/classes/Properties/PropertiesKeys.ts +15 -9
- package/src/classes/Properties/PropertiesMain.ts +13 -7
- package/src/classes/Properties/PropertiesPalette.ts +12 -6
- package/src/classes/Properties/PropertiesPath.ts +17 -11
- package/src/classes/Properties/PropertiesScss.ts +10 -8
- package/src/classes/Properties/PropertiesSeparator.ts +9 -11
- package/src/classes/Properties/PropertiesSettings.ts +8 -6
- package/src/classes/Properties/PropertiesStandard.ts +5 -6
- package/src/classes/Properties/PropertiesTool.ts +16 -9
- package/src/classes/Properties/PropertiesTypes.ts +12 -12
- package/src/classes/Properties/PropertiesValues.ts +14 -14
- package/src/classes/Properties/PropertiesWrap.ts +5 -6
- package/src/classes/Properties/convector/convectorColor.ts +5 -3
- package/src/classes/Properties/to/PropertiesToAbstract.ts +18 -4
- package/src/composables/__tests__/useAi.test.ts +75 -0
- package/src/config.ts +2 -0
- package/src/functions/__tests__/getComponentPaths.test.ts +19 -0
- package/src/functions/__tests__/getConfigAi.test.ts +26 -0
- package/src/functions/__tests__/getConstructorProperties.test.ts +51 -0
- package/src/functions/__tests__/getDirname.test.ts +31 -0
- package/src/functions/__tests__/getNameDirByPaths.test.ts +40 -0
- package/src/functions/__tests__/getPackageJson.test.ts +34 -0
- package/src/functions/__tests__/hasNativeDirname.test.ts +18 -0
- package/src/functions/__tests__/toPathStandardSep.test.ts +31 -0
- package/src/functions/getConfigAi.ts +3 -2
- package/src/functions/toPathStandardSep.ts +1 -1
- package/src/library-ai.ts +0 -1
- package/src/library.ts +6 -0
- package/src/media/properties/css.ts +3 -1
- package/src/media/templates/component/props.ts +1 -1
- package/src/media/templates/component/wiki.ts +6 -12
- package/src/media/templates/component/wikiData.ts +28 -0
- package/src/media/templates/packages/figma/README.md +1 -0
- package/src/media/templates/packages/figma/ai.sample.config.ts +2 -0
- package/src/media/templates/packages/figma/design.config.json +3 -0
- package/src/media/templates/packages/figma/index.html +12 -0
- package/src/media/templates/packages/figma/manifest.json +25 -0
- package/src/media/templates/packages/figma/package.json +37 -0
- package/src/media/templates/packages/figma/src/App.vue +9 -0
- package/src/media/templates/packages/figma/src/classes/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/code.ts +16 -0
- package/src/media/templates/packages/figma/src/components/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/composables/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/config.ts +0 -0
- package/src/media/templates/packages/figma/src/functions/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/library.ts +0 -0
- package/src/media/templates/packages/figma/src/main.ts +4 -0
- package/src/media/templates/packages/figma/src/media/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/storybook/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/types/_.gitignore.txt +1 -0
- package/src/media/templates/packages/figma/src/vite-env.d.ts +1 -0
- package/src/media/templates/packages/figma/tsconfig.app.json +12 -0
- package/src/media/templates/packages/figma/tsconfig.json +7 -0
- package/src/media/templates/packages/figma/tsconfig.node.json +8 -0
- package/src/media/templates/packages/figma/vite.config.ts +7 -0
- package/src/types/configTypes.ts +3 -0
- package/src/types/webTypes.ts +105 -0
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
forEach,
|
|
5
|
-
isObjectNotArray,
|
|
5
|
+
isObjectNotArray,
|
|
6
|
+
replaceComponentName,
|
|
6
7
|
toArray,
|
|
7
|
-
|
|
8
|
+
toCamelCase
|
|
8
9
|
} from '@dxtmisha/functional-basic'
|
|
9
10
|
import { wikiDescriptions } from '@dxtmisha/wiki/media'
|
|
10
11
|
import type { StorybookComponentsDescriptionItem } from '@dxtmisha/wiki'
|
|
@@ -19,6 +20,7 @@ import type { DesignReplace } from './DesignReplace'
|
|
|
19
20
|
import {
|
|
20
21
|
UI_DIR_COMPONENTS,
|
|
21
22
|
UI_DIR_CONSTRUCTOR,
|
|
23
|
+
UI_DIR_DIST,
|
|
22
24
|
UI_DIR_IN,
|
|
23
25
|
UI_DIRS_COMPONENTS,
|
|
24
26
|
UI_DIRS_LIBRARY,
|
|
@@ -33,24 +35,32 @@ const FILE_STYLE = 'styleToken.scss'
|
|
|
33
35
|
const FILE_CLASS = 'DesignComponent.vue'
|
|
34
36
|
const FILE_CLASS_AI = 'DesignComponentAiWiki.vue'
|
|
35
37
|
const FILE_INDEX = 'index.ts'
|
|
38
|
+
const FILE_INDEX_DTS = 'index.d.ts'
|
|
36
39
|
const FILE_WIKI = 'wiki.ts'
|
|
40
|
+
const FILE_WIKI_DATA = 'wikiData.ts'
|
|
37
41
|
const FILE_STORIES = 'DesignComponent.stories.ts'
|
|
38
42
|
const FILE_STORIES_DOCUMENTATION = 'DesignComponent.mdx'
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
|
-
* Class for
|
|
45
|
+
* Class for generating and updating all files and configurations associated with a design system component.
|
|
46
|
+
* It manages the lifecycle of properties, styles, Vue components, stories, and wiki documentation.
|
|
42
47
|
*
|
|
43
|
-
* Класс для
|
|
48
|
+
* Класс для генерации и обновления всех файлов и конфигураций, связанных с компонентом дизайн-системы.
|
|
49
|
+
* Управляет жизненным циклом свойств, стилей, компонентов Vue, историй и вики-документации.
|
|
44
50
|
*/
|
|
45
51
|
export class DesignComponent extends DesignCommand {
|
|
46
52
|
protected DIR_SAMPLE: string = 'component'
|
|
47
53
|
protected dir: string[]
|
|
48
54
|
protected propsType: DesignTypescriptProp[] | undefined
|
|
55
|
+
protected slotsType: DesignTypescriptProp[] | undefined
|
|
56
|
+
protected eventsType: DesignTypescriptProp[] | undefined
|
|
49
57
|
|
|
50
58
|
/**
|
|
51
|
-
* Constructor
|
|
52
|
-
*
|
|
53
|
-
*
|
|
59
|
+
* Constructor for DesignComponent.
|
|
60
|
+
*
|
|
61
|
+
* Конструктор для DesignComponent.
|
|
62
|
+
* @param command component name or command identifier / название компонента или идентификатор команды
|
|
63
|
+
* @param options additional key-value parameters / дополнительные параметры ключ-значение
|
|
54
64
|
*/
|
|
55
65
|
constructor(
|
|
56
66
|
command: string,
|
|
@@ -82,6 +92,7 @@ export class DesignComponent extends DesignCommand {
|
|
|
82
92
|
.makeMainAi()
|
|
83
93
|
.makeIndex()
|
|
84
94
|
.makeWiki()
|
|
95
|
+
.makeWikiData()
|
|
85
96
|
.makeStories()
|
|
86
97
|
.makeStoriesDocumentation()
|
|
87
98
|
.makeFilePackage()
|
|
@@ -232,11 +243,27 @@ export class DesignComponent extends DesignCommand {
|
|
|
232
243
|
*/
|
|
233
244
|
protected makeWiki(): this {
|
|
234
245
|
const file = FILE_WIKI
|
|
246
|
+
const sample = this.readDefinable(file)
|
|
247
|
+
|
|
248
|
+
this.write(file, sample.get())
|
|
249
|
+
return this
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* This code generates the wikiData.ts.
|
|
254
|
+
*
|
|
255
|
+
* Генерация файла wikiData.ts.
|
|
256
|
+
*/
|
|
257
|
+
protected makeWikiData(): this {
|
|
258
|
+
const file = FILE_WIKI_DATA
|
|
235
259
|
const typeInfo = this.getPropsList()
|
|
260
|
+
const slotsInfo = this.getSlotsList()
|
|
261
|
+
const eventsInfo = this.getEventsList()
|
|
236
262
|
const sample = this.readDefinable(file)
|
|
237
|
-
const props: string[] = []
|
|
238
263
|
|
|
239
264
|
if (typeInfo) {
|
|
265
|
+
const props: string[] = []
|
|
266
|
+
|
|
240
267
|
typeInfo
|
|
241
268
|
.sort((a, b) => a.name.localeCompare(b.name))
|
|
242
269
|
.forEach((prop) => {
|
|
@@ -259,6 +286,70 @@ export class DesignComponent extends DesignCommand {
|
|
|
259
286
|
sample.replaceMark('propsList', props, ',')
|
|
260
287
|
}
|
|
261
288
|
|
|
289
|
+
if (slotsInfo) {
|
|
290
|
+
const slots: string[] = []
|
|
291
|
+
|
|
292
|
+
slotsInfo
|
|
293
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
294
|
+
.forEach((slot) => {
|
|
295
|
+
const description = slot.description
|
|
296
|
+
const type = slot.type
|
|
297
|
+
.replace(/\(props: ([^)]+)\) => any/i, '$1')
|
|
298
|
+
.trim()
|
|
299
|
+
|
|
300
|
+
let item: string = ''
|
|
301
|
+
|
|
302
|
+
item += `{ name: '${slot.name}'`
|
|
303
|
+
|
|
304
|
+
if (description) {
|
|
305
|
+
item += `, description: \`${description}\``
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (
|
|
309
|
+
type
|
|
310
|
+
&& type !== 'any'
|
|
311
|
+
) {
|
|
312
|
+
item += `, properties: [{ name: 'props', type: '${type}' }]`
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
item += ` }`
|
|
316
|
+
slots.push(item)
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
sample.replaceMark('slotsList', slots, ',')
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (eventsInfo) {
|
|
323
|
+
const events: string[] = []
|
|
324
|
+
|
|
325
|
+
eventsInfo
|
|
326
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
327
|
+
.forEach((event) => {
|
|
328
|
+
const description = event.description
|
|
329
|
+
const type = event.type
|
|
330
|
+
|
|
331
|
+
let item: string = ''
|
|
332
|
+
|
|
333
|
+
item += `{ name: '${event.name}'`
|
|
334
|
+
|
|
335
|
+
if (description) {
|
|
336
|
+
item += `, description: \`${description}\``
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (
|
|
340
|
+
type
|
|
341
|
+
&& type !== '[]'
|
|
342
|
+
) {
|
|
343
|
+
item += `, properties: ${type}`
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
item += ` }`
|
|
347
|
+
events.push(item)
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
sample.replaceMark('eventsList', events, ',')
|
|
351
|
+
}
|
|
352
|
+
|
|
262
353
|
this.write(file, sample.get())
|
|
263
354
|
return this
|
|
264
355
|
}
|
|
@@ -319,6 +410,65 @@ export class DesignComponent extends DesignCommand {
|
|
|
319
410
|
return constructor ?? ''
|
|
320
411
|
}
|
|
321
412
|
|
|
413
|
+
/**
|
|
414
|
+
* Getting the paths for the typescript compiler.
|
|
415
|
+
*
|
|
416
|
+
* Получение путей для компилятора typescript.
|
|
417
|
+
* @returns paths for the typescript compiler/ пути для компилятора typescript
|
|
418
|
+
*/
|
|
419
|
+
private getTypescriptPaths(): string[] | undefined {
|
|
420
|
+
const root = PropertiesFile.getRootProject()
|
|
421
|
+
const componentName = this.getStructure().getComponentNameFirst()
|
|
422
|
+
|
|
423
|
+
if (root) {
|
|
424
|
+
return [
|
|
425
|
+
root,
|
|
426
|
+
UI_PROJECT_CONSTRUCTOR_NAME,
|
|
427
|
+
UI_DIR_DIST,
|
|
428
|
+
UI_DIR_CONSTRUCTOR,
|
|
429
|
+
componentName
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
return undefined
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Getting the path to the index file.
|
|
438
|
+
*
|
|
439
|
+
* Получение пути к файлу index.
|
|
440
|
+
*/
|
|
441
|
+
private getTypescriptPathsIndex(): string | undefined {
|
|
442
|
+
const paths = this.getTypescriptPaths()
|
|
443
|
+
|
|
444
|
+
if (paths) {
|
|
445
|
+
return PropertiesFile.joinPath([
|
|
446
|
+
...paths,
|
|
447
|
+
FILE_INDEX_DTS
|
|
448
|
+
])
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return undefined
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Getting the path to the type file.
|
|
456
|
+
*
|
|
457
|
+
* Получение пути к файлу type.
|
|
458
|
+
*/
|
|
459
|
+
private getTypescriptPathsType(): string | undefined {
|
|
460
|
+
const paths = this.getTypescriptPaths()
|
|
461
|
+
|
|
462
|
+
if (paths) {
|
|
463
|
+
return PropertiesFile.joinPath([
|
|
464
|
+
...paths,
|
|
465
|
+
'types.d.ts'
|
|
466
|
+
])
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return undefined
|
|
470
|
+
}
|
|
471
|
+
|
|
322
472
|
/**
|
|
323
473
|
* Getting a list of all properties of a component.
|
|
324
474
|
*
|
|
@@ -326,11 +476,11 @@ export class DesignComponent extends DesignCommand {
|
|
|
326
476
|
*/
|
|
327
477
|
private getPropsList(): DesignTypescriptProp[] | undefined {
|
|
328
478
|
if (!this.propsType) {
|
|
329
|
-
const
|
|
479
|
+
const paths = this.getTypescriptPathsIndex()
|
|
330
480
|
const componentName = this.getStructure().getComponentNameFirst()
|
|
331
481
|
|
|
332
|
-
if (
|
|
333
|
-
const
|
|
482
|
+
if (paths) {
|
|
483
|
+
const tsRead = new DesignTypescript(
|
|
334
484
|
PropertiesFile.joinPath([
|
|
335
485
|
PropertiesFile.getRoot(),
|
|
336
486
|
UI_DIR_IN,
|
|
@@ -341,27 +491,63 @@ export class DesignComponent extends DesignCommand {
|
|
|
341
491
|
]),
|
|
342
492
|
{
|
|
343
493
|
paths: {
|
|
344
|
-
[`${UI_PROJECT_CONSTRUCTOR_FULL_NAME}/${componentName}`]: [
|
|
345
|
-
PropertiesFile.joinPath([
|
|
346
|
-
root,
|
|
347
|
-
UI_PROJECT_CONSTRUCTOR_NAME,
|
|
348
|
-
UI_DIR_IN,
|
|
349
|
-
UI_DIR_CONSTRUCTOR,
|
|
350
|
-
componentName,
|
|
351
|
-
FILE_INDEX
|
|
352
|
-
])
|
|
353
|
-
]
|
|
494
|
+
[`${UI_PROJECT_CONSTRUCTOR_FULL_NAME}/${componentName}`]: [paths]
|
|
354
495
|
}
|
|
355
496
|
}
|
|
356
497
|
)
|
|
357
498
|
|
|
358
|
-
this.propsType =
|
|
499
|
+
this.propsType = tsRead.getType(`${componentName}Props`)?.props
|
|
359
500
|
}
|
|
360
501
|
}
|
|
361
502
|
|
|
362
503
|
return this.propsType
|
|
363
504
|
}
|
|
364
505
|
|
|
506
|
+
/**
|
|
507
|
+
* Getting a list of all slots of a component.
|
|
508
|
+
*
|
|
509
|
+
* Получение списка всех слотов компонента.
|
|
510
|
+
*/
|
|
511
|
+
private getSlotsList(): DesignTypescriptProp[] | undefined {
|
|
512
|
+
if (!this.slotsType) {
|
|
513
|
+
const types = this.getTypesFromConstructor('Slots')
|
|
514
|
+
|
|
515
|
+
if (types) {
|
|
516
|
+
this.slotsType = types
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
return this.slotsType
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Getting a list of all events of a component.
|
|
525
|
+
*
|
|
526
|
+
* Получение списка всех событий компонента.
|
|
527
|
+
*/
|
|
528
|
+
private getEventsList(): DesignTypescriptProp[] | undefined {
|
|
529
|
+
if (!this.eventsType) {
|
|
530
|
+
const types = this.getTypesFromConstructor('Emits')
|
|
531
|
+
|
|
532
|
+
if (types) {
|
|
533
|
+
this.eventsType = forEach(
|
|
534
|
+
types,
|
|
535
|
+
(item) => {
|
|
536
|
+
return {
|
|
537
|
+
name: item.name,
|
|
538
|
+
type: String(item.type)
|
|
539
|
+
.replace(/([^:,[\] ]+): ([^:,[\]]+)/gi, `{ name: '$1', type: '$2' }`)
|
|
540
|
+
.replace(/,{/gi, ', {'),
|
|
541
|
+
description: item.description
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
)
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return this.eventsType
|
|
549
|
+
}
|
|
550
|
+
|
|
365
551
|
/**
|
|
366
552
|
* Returns the description of the component from the wiki
|
|
367
553
|
*
|
|
@@ -396,6 +582,24 @@ export class DesignComponent extends DesignCommand {
|
|
|
396
582
|
return []
|
|
397
583
|
}
|
|
398
584
|
|
|
585
|
+
/**
|
|
586
|
+
* Getting the types from the constructor.
|
|
587
|
+
*
|
|
588
|
+
* Получение типов из конструктора.
|
|
589
|
+
* @param name name of the type/ имя типа
|
|
590
|
+
*/
|
|
591
|
+
private getTypesFromConstructor(name: string): DesignTypescriptProp[] | undefined {
|
|
592
|
+
const paths = this.getTypescriptPathsType()
|
|
593
|
+
const componentName = this.getStructure().getComponentNameFirst()
|
|
594
|
+
|
|
595
|
+
if (paths) {
|
|
596
|
+
const tsRead = new DesignTypescript(paths)
|
|
597
|
+
return tsRead.getType(`${componentName}${name}`)?.props
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
return undefined
|
|
601
|
+
}
|
|
602
|
+
|
|
399
603
|
/**
|
|
400
604
|
* Converts the code to the component name.
|
|
401
605
|
*
|
|
@@ -404,11 +608,12 @@ export class DesignComponent extends DesignCommand {
|
|
|
404
608
|
*/
|
|
405
609
|
private toComponentName(code: string): string {
|
|
406
610
|
const design = this.getStructure().getDesignFirst()
|
|
407
|
-
const name = this.getStructure().
|
|
611
|
+
const name = this.getStructure().getComponentName()
|
|
612
|
+
const fullName = this.getStructure().getFullComponentName()
|
|
408
613
|
|
|
409
614
|
return code
|
|
410
|
-
.replace(/DesignComponent/g,
|
|
411
|
-
.replace(/design-component/g,
|
|
615
|
+
.replace(/DesignComponent/g, fullName).trim()
|
|
616
|
+
.replace(/design-component/g, `${toCamelCase(design)}-${toCamelCase(name)}`).trim()
|
|
412
617
|
.replace(/<(\/?)Design/g, `<$1${design}`)
|
|
413
618
|
}
|
|
414
619
|
|
|
@@ -588,7 +793,7 @@ export class DesignComponent extends DesignCommand {
|
|
|
588
793
|
this.updatePackage(
|
|
589
794
|
`exports|${name}`,
|
|
590
795
|
{
|
|
591
|
-
types: `./dist/${this.getFullName()}.d.ts`,
|
|
796
|
+
types: `./dist/library/${this.getFullName()}.d.ts`,
|
|
592
797
|
default: `./dist/${this.getFullName()}.js`
|
|
593
798
|
}
|
|
594
799
|
)
|
|
@@ -607,8 +812,10 @@ export class DesignComponent extends DesignCommand {
|
|
|
607
812
|
|
|
608
813
|
PropertiesFile.writeByPath(
|
|
609
814
|
[...UI_DIRS_LIBRARY, `${name}.ts`],
|
|
610
|
-
|
|
611
|
-
|
|
815
|
+
`// This file is generated by a script, do not edit.
|
|
816
|
+
// Этот файл генерируется скриптом, не редактировать.
|
|
817
|
+
|
|
818
|
+
export * from '${dir}index.js'
|
|
612
819
|
`
|
|
613
820
|
)
|
|
614
821
|
|
|
@@ -18,18 +18,22 @@ const FILE_CLASS = 'ConstructorsDesign.tsx'
|
|
|
18
18
|
const FILE_INDEX = 'index.ts'
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Class for generating files based on a constructor.
|
|
21
|
+
* Class for generating files and configurations based on a component's constructor.
|
|
22
|
+
* It automates the creation of property definitions, type files, styles, and integration logic for constructors.
|
|
22
23
|
*
|
|
23
|
-
* Класс для генерации файлов
|
|
24
|
+
* Класс для генерации файлов и конфигураций на основе конструктора компонента.
|
|
25
|
+
* Автоматизирует создание определений свойств, файлов типов, стилей и логики интеграции для конструкторов.
|
|
24
26
|
*/
|
|
25
27
|
export class DesignConstructor extends DesignCommand {
|
|
26
28
|
protected DIR_SAMPLE: string = UI_DIR_CONSTRUCTOR
|
|
27
29
|
protected dir: string[]
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
|
-
* Constructor
|
|
31
|
-
*
|
|
32
|
-
*
|
|
32
|
+
* Constructor for DesignConstructor.
|
|
33
|
+
*
|
|
34
|
+
* Конструктор для DesignConstructor.
|
|
35
|
+
* @param command component name or command identifier / название компонента или идентификатор команды
|
|
36
|
+
* @param options additional key-value parameters / дополнительные параметры ключ-значение
|
|
33
37
|
*/
|
|
34
38
|
constructor(
|
|
35
39
|
command: string,
|
|
@@ -9,14 +9,18 @@ import { DesignConstructor } from './DesignConstructor'
|
|
|
9
9
|
import { UI_DIR_CONSTRUCTOR, UI_DIR_IN, UI_DIRS_LIBRARY, UI_FILE_STYLE_SCSS } from '../../config'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Class for
|
|
12
|
+
* Class for orchestrating the generation and update of multiple design constructors.
|
|
13
|
+
* It manages the collective lifecycle of component constructors, including bulk updates and shared style generation.
|
|
13
14
|
*
|
|
14
|
-
* Класс для управления
|
|
15
|
+
* Класс для управления генерацией и обновлением нескольких конструкторов дизайна.
|
|
16
|
+
* Управляет коллективным жизненным циклом конструкторов компонентов, включая массовые обновления и генерацию общих стилей.
|
|
15
17
|
*/
|
|
16
18
|
export class DesignConstructors {
|
|
17
19
|
/**
|
|
18
|
-
* Constructor
|
|
19
|
-
*
|
|
20
|
+
* Constructor for DesignConstructors.
|
|
21
|
+
*
|
|
22
|
+
* Конструктор для DesignConstructors.
|
|
23
|
+
* @param name optional specific component name to process / необязательное имя конкретного компонента для обработки
|
|
20
24
|
*/
|
|
21
25
|
constructor(
|
|
22
26
|
protected readonly name?: string
|
|
@@ -15,6 +15,13 @@ const DESIGN_FLAGS_FILE_PATH = ['.', '..', 'assets', DESIGN_FLAGS_FILE_NAME_ITEM
|
|
|
15
15
|
const DESIGN_FLAGS_FILE_STYLE_NAME = [UI_DIR_IN, 'styles', 'flags.css']
|
|
16
16
|
const DESIGN_FLAGS_CLASS_NAME = '.ui-sys-flags'
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Class for generating a sprite image and CSS mapping from a directory of flag icons.
|
|
20
|
+
* It automates the creation of a combined webp image and a CSS file with specific background-position utility classes.
|
|
21
|
+
*
|
|
22
|
+
* Класс для генерации спрайта и CSS-маппинга из директории иконок флагов.
|
|
23
|
+
* Автоматизирует создание комбинированного изображения webp и CSS-файла с утилитарными классами для позиционирования фона.
|
|
24
|
+
*/
|
|
18
25
|
export class DesignFlags {
|
|
19
26
|
protected list: string[]
|
|
20
27
|
protected data: DesignFlagsList = []
|
|
@@ -29,6 +36,15 @@ export class DesignFlags {
|
|
|
29
36
|
protected readonly canvas: Canvas
|
|
30
37
|
protected readonly context: SKRSContext2D
|
|
31
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Constructor for DesignFlags.
|
|
41
|
+
*
|
|
42
|
+
* Конструктор для DesignFlags.
|
|
43
|
+
* @param dir path to the directory containing SVG icons / путь к директории с SVG-иконками
|
|
44
|
+
* @param width width of a single flag in the sprite / ширина одного флага в спрайте
|
|
45
|
+
* @param height height of a single flag in the sprite / высота одного флага в спрайте
|
|
46
|
+
* @param columns number of columns in the sprite grid / количество колонок в сетке спрайта
|
|
47
|
+
*/
|
|
32
48
|
constructor(
|
|
33
49
|
protected readonly dir: string = 'src/assets/flags',
|
|
34
50
|
protected readonly width: number = 96,
|
|
@@ -15,19 +15,23 @@ import { UI_KEY_CUSTOM } from '../../config'
|
|
|
15
15
|
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Engine for systematic text replacement within file templates based on component structure.
|
|
19
|
+
* It manages the transformation of labels (marks) into actual code segments, including property types, default values, and CSS class mappings.
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
+
* Движок для систематической замены текста в шаблонах файлов на основе структуры компонента.
|
|
22
|
+
* Управляет преобразованием меток (marks) в реальные сегменты кода, включая типы свойств, значения по умолчанию и маппинг CSS-классов.
|
|
21
23
|
*/
|
|
22
24
|
export class DesignReplace {
|
|
23
25
|
protected readonly component: string
|
|
24
26
|
protected readonly mark: string
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
|
-
* Constructor
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @param
|
|
29
|
+
* Constructor for DesignReplace.
|
|
30
|
+
*
|
|
31
|
+
* Конструктор для DesignReplace.
|
|
32
|
+
* @param structure object containing component metadata and design logic / объект, содержащий метаданные компонента и логику дизайна
|
|
33
|
+
* @param mark the identifier used in templates for replacement (e.g., 'button') / идентификатор, используемый в шаблонах для замены
|
|
34
|
+
* @param sample the raw template content to be processed / необработанное содержимое шаблона для обработки
|
|
31
35
|
*/
|
|
32
36
|
constructor(
|
|
33
37
|
protected structure: DesignStructure,
|
|
@@ -19,9 +19,11 @@ import {
|
|
|
19
19
|
} from '../../config'
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Class for
|
|
22
|
+
* Class for managing and resolving the data structure of a design system component.
|
|
23
|
+
* It serves as a central hub for reading component metadata, generating class mappings, and resolving style tokens.
|
|
23
24
|
*
|
|
24
|
-
* Класс для
|
|
25
|
+
* Класс для управления и разрешения структуры данных компонента дизайн-системы.
|
|
26
|
+
* Служит центральным узлом для чтения метаданных компонента, генерации маппингов классов и разрешения стилевых токенов.
|
|
25
27
|
*/
|
|
26
28
|
export class DesignStructure {
|
|
27
29
|
protected readonly component: string
|
|
@@ -30,11 +32,11 @@ export class DesignStructure {
|
|
|
30
32
|
protected itemsClasses?: DesignStructureClassesList
|
|
31
33
|
protected itemsStyles?: string[]
|
|
32
34
|
|
|
33
|
-
constructor(path: string)
|
|
34
|
-
constructor(design: string, component: string)
|
|
35
35
|
/**
|
|
36
|
-
* Constructor
|
|
37
|
-
*
|
|
36
|
+
* Constructor for DesignStructure.
|
|
37
|
+
*
|
|
38
|
+
* Конструктор для DesignStructure.
|
|
39
|
+
* @param component component name or identifier / название или идентификатор компонента
|
|
38
40
|
*/
|
|
39
41
|
constructor(
|
|
40
42
|
component?: string
|
|
@@ -14,16 +14,20 @@ import {
|
|
|
14
14
|
} from '../../types/designTypes'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Class for resolving and generating a hierarchical list of CSS classes for a component.
|
|
18
|
+
* It recursively parses component properties to identify subclasses and build BEM-compliant class names.
|
|
18
19
|
*
|
|
19
|
-
* Класс для
|
|
20
|
+
* Класс для разрешения и генерации иерархического списка CSS-классов для компонента.
|
|
21
|
+
* Рекурсивно анализирует свойства компонента для идентификации подклассов и построения имен классов, соответствующих BEM.
|
|
20
22
|
*/
|
|
21
23
|
export class DesignStructureClasses extends DesignStructureItemAbstract<DesignStructureClassesList> {
|
|
22
24
|
protected data: DesignStructureClassesList = []
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
|
-
* Constructor
|
|
26
|
-
*
|
|
27
|
+
* Constructor for DesignStructureClasses.
|
|
28
|
+
*
|
|
29
|
+
* Конструктор для DesignStructureClasses.
|
|
30
|
+
* @param component component name used as the base for class generation / имя компонента, используемое в качестве базы для генерации классов
|
|
27
31
|
*/
|
|
28
32
|
constructor(
|
|
29
33
|
component: string
|
|
@@ -5,6 +5,13 @@ import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
|
5
5
|
|
|
6
6
|
import type { PropertyItemsItem } from '../../types/propertyTypes'
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Base abstract class for structural component items.
|
|
10
|
+
* It provides the foundation for resolving component properties and metadata from the design system's central storage.
|
|
11
|
+
*
|
|
12
|
+
* Базовый абстрактный класс для структурных элементов компонента.
|
|
13
|
+
* Предоставляет основу для разрешения свойств и метаданных компонента из центрального хранилища дизайн-системы.
|
|
14
|
+
*/
|
|
8
15
|
export abstract class DesignStructureItemAbstract<D> {
|
|
9
16
|
protected properties: Properties
|
|
10
17
|
protected items?: PropertyItemsItem
|
|
@@ -12,8 +19,10 @@ export abstract class DesignStructureItemAbstract<D> {
|
|
|
12
19
|
protected abstract data: D
|
|
13
20
|
|
|
14
21
|
/**
|
|
15
|
-
* Constructor
|
|
16
|
-
*
|
|
22
|
+
* Constructor for DesignStructureItemAbstract.
|
|
23
|
+
*
|
|
24
|
+
* Конструктор для DesignStructureItemAbstract.
|
|
25
|
+
* @param component component name for which the structure is being resolved / имя компонента, для которого разрешается структура
|
|
17
26
|
*/
|
|
18
27
|
protected constructor(
|
|
19
28
|
protected readonly component: string
|
|
@@ -19,9 +19,11 @@ import type {
|
|
|
19
19
|
import { UI_PROPERTY_FOR_PROPS } from '../../config'
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Engine for parsing and resolving component property dependencies and states.
|
|
23
|
+
* It processes the raw property metadata to identify interactive states, link classes, and compile all possible values for code generation.
|
|
23
24
|
*
|
|
24
|
-
*
|
|
25
|
+
* Движок для парсинга и разрешения зависимостей свойств и состояний компонента.
|
|
26
|
+
* Обрабатывает сырые метаданные свойств для идентификации интерактивных состояний, связанных классов и компиляции всех возможных значений для генерации кода.
|
|
25
27
|
*/
|
|
26
28
|
export class DesignStructureRead extends DesignStructureItemAbstract<DesignStructureList> {
|
|
27
29
|
protected states: DesignStructureStateList
|
|
@@ -29,8 +31,10 @@ export class DesignStructureRead extends DesignStructureItemAbstract<DesignStruc
|
|
|
29
31
|
protected data: DesignStructureList = {}
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
|
-
* Constructor
|
|
33
|
-
*
|
|
34
|
+
* Constructor for DesignStructureRead.
|
|
35
|
+
*
|
|
36
|
+
* Конструктор для DesignStructureRead.
|
|
37
|
+
* @param component component name whose properties are being resolved / имя компонента, свойства которого разрешаются
|
|
34
38
|
*/
|
|
35
39
|
constructor(
|
|
36
40
|
component: string
|
|
@@ -4,16 +4,20 @@ import { StylesProperties } from '../Styles/StylesProperties'
|
|
|
4
4
|
import { DesignStructureItemAbstract } from './DesignStructureItemAbstract'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Engine for compiling component-specific styles from design system tokens.
|
|
8
|
+
* It coordinates the transformation of structural metadata into CSS-in-JS style rules using the global theme environment.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
+
* Движок для компиляции специфичных для компонента стилей из токенов дизайн-системы.
|
|
11
|
+
* Координирует преобразование структурных метаданных в правила стилей CSS-in-JS с использованием глобального тематического окружения.
|
|
10
12
|
*/
|
|
11
13
|
export class DesignStructureStyles extends DesignStructureItemAbstract<string[]> {
|
|
12
14
|
protected data: string[]
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
|
-
* Constructor
|
|
16
|
-
*
|
|
17
|
+
* Constructor for DesignStructureStyles.
|
|
18
|
+
*
|
|
19
|
+
* Конструктор для DesignStructureStyles.
|
|
20
|
+
* @param component component name for which styles are being compiled / имя компонента, для которого компилируются стили
|
|
17
21
|
*/
|
|
18
22
|
constructor(
|
|
19
23
|
component: string
|