@dxtmisha/scripts 0.7.2 → 0.7.7

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.
Files changed (104) hide show
  1. package/bin/design-wiki-storm.ts +9 -0
  2. package/package.json +5 -3
  3. package/src/classes/Ai/AiAbstract.ts +14 -1
  4. package/src/classes/Ai/AiGoogleLite.ts +2 -1
  5. package/src/classes/Build/__tests__/buildFunctional.test.ts +43 -0
  6. package/src/classes/Build/buildFunctional.ts +15 -0
  7. package/src/classes/Component/ComponentCreator.ts +1 -0
  8. package/src/classes/Component/ComponentItem.ts +15 -0
  9. package/src/classes/Component/ComponentWiki.ts +8 -0
  10. package/src/classes/Component/ComponentWikiFile.ts +2 -0
  11. package/src/classes/Component/__tests__/ComponentCreator.test.ts +71 -0
  12. package/src/classes/Component/__tests__/ComponentItem.test.ts +71 -0
  13. package/src/classes/Design/DesignCommand.ts +15 -14
  14. package/src/classes/Design/DesignComponent.ts +235 -28
  15. package/src/classes/Design/DesignConstructor.ts +9 -5
  16. package/src/classes/Design/DesignConstructors.ts +8 -4
  17. package/src/classes/Design/DesignFlags.ts +16 -0
  18. package/src/classes/Design/DesignReplace.ts +10 -6
  19. package/src/classes/Design/DesignStructure.ts +8 -6
  20. package/src/classes/Design/DesignStructureClasses.ts +8 -4
  21. package/src/classes/Design/DesignStructureItemAbstract.ts +11 -2
  22. package/src/classes/Design/DesignStructureRead.ts +8 -4
  23. package/src/classes/Design/DesignStructureStyles.ts +8 -4
  24. package/src/classes/Design/DesignTypes.ts +53 -28
  25. package/src/classes/Design/DesignTypescript.ts +11 -2
  26. package/src/classes/Design/DesignUi.ts +42 -11
  27. package/src/classes/Design/DesignWiki.ts +4 -6
  28. package/src/classes/Design/DesignWikiStorm.ts +94 -0
  29. package/src/classes/Design/DesignWikiStormItem.ts +246 -0
  30. package/src/classes/Git/GitRead.ts +1 -0
  31. package/src/classes/Git/__tests__/GitRead.test.ts +70 -0
  32. package/src/classes/Library/LibraryAiWiki.ts +2 -1
  33. package/src/classes/Library/LibraryFlags.ts +9 -7
  34. package/src/classes/Library/LibraryItems.ts +9 -9
  35. package/src/classes/Library/LibraryList.ts +10 -5
  36. package/src/classes/Library/LibraryMedia.ts +21 -6
  37. package/src/classes/Library/LibraryPlugin.ts +8 -5
  38. package/src/classes/Library/LibraryTypes.ts +34 -10
  39. package/src/classes/Package/PackageInit.ts +12 -4
  40. package/src/classes/Package/PackageItem.ts +13 -4
  41. package/src/classes/Properties/Properties.ts +14 -3
  42. package/src/classes/Properties/PropertiesCache.ts +19 -20
  43. package/src/classes/Properties/PropertiesConfig.ts +39 -28
  44. package/src/classes/Properties/PropertiesConvector.ts +10 -6
  45. package/src/classes/Properties/PropertiesFile.ts +22 -28
  46. package/src/classes/Properties/PropertiesImport.ts +10 -7
  47. package/src/classes/Properties/PropertiesItems.ts +19 -12
  48. package/src/classes/Properties/PropertiesKeys.ts +15 -9
  49. package/src/classes/Properties/PropertiesMain.ts +13 -7
  50. package/src/classes/Properties/PropertiesPalette.ts +12 -6
  51. package/src/classes/Properties/PropertiesPath.ts +17 -11
  52. package/src/classes/Properties/PropertiesScss.ts +10 -8
  53. package/src/classes/Properties/PropertiesSeparator.ts +9 -11
  54. package/src/classes/Properties/PropertiesSettings.ts +8 -6
  55. package/src/classes/Properties/PropertiesStandard.ts +5 -6
  56. package/src/classes/Properties/PropertiesTool.ts +16 -9
  57. package/src/classes/Properties/PropertiesTypes.ts +12 -12
  58. package/src/classes/Properties/PropertiesValues.ts +14 -14
  59. package/src/classes/Properties/PropertiesWrap.ts +5 -6
  60. package/src/classes/Properties/convector/convectorColor.ts +5 -3
  61. package/src/classes/Properties/to/PropertiesToAbstract.ts +18 -4
  62. package/src/composables/__tests__/useAi.test.ts +75 -0
  63. package/src/config.ts +2 -0
  64. package/src/functions/__tests__/getComponentPaths.test.ts +19 -0
  65. package/src/functions/__tests__/getConfigAi.test.ts +26 -0
  66. package/src/functions/__tests__/getConstructorProperties.test.ts +51 -0
  67. package/src/functions/__tests__/getDirname.test.ts +31 -0
  68. package/src/functions/__tests__/getNameDirByPaths.test.ts +40 -0
  69. package/src/functions/__tests__/getPackageJson.test.ts +34 -0
  70. package/src/functions/__tests__/hasNativeDirname.test.ts +18 -0
  71. package/src/functions/__tests__/toPathStandardSep.test.ts +31 -0
  72. package/src/functions/getConfigAi.ts +3 -2
  73. package/src/functions/toPathStandardSep.ts +1 -1
  74. package/src/library-ai.ts +0 -1
  75. package/src/library.ts +6 -0
  76. package/src/media/properties/css.ts +3 -1
  77. package/src/media/templates/component/props.ts +1 -1
  78. package/src/media/templates/component/wiki.ts +6 -12
  79. package/src/media/templates/component/wikiData.ts +28 -0
  80. package/src/media/templates/packages/figma/README.md +1 -0
  81. package/src/media/templates/packages/figma/ai.sample.config.ts +2 -0
  82. package/src/media/templates/packages/figma/design.config.json +3 -0
  83. package/src/media/templates/packages/figma/index.html +12 -0
  84. package/src/media/templates/packages/figma/manifest.json +25 -0
  85. package/src/media/templates/packages/figma/package.json +37 -0
  86. package/src/media/templates/packages/figma/src/App.vue +9 -0
  87. package/src/media/templates/packages/figma/src/classes/_.gitignore.txt +1 -0
  88. package/src/media/templates/packages/figma/src/code.ts +16 -0
  89. package/src/media/templates/packages/figma/src/components/_.gitignore.txt +1 -0
  90. package/src/media/templates/packages/figma/src/composables/_.gitignore.txt +1 -0
  91. package/src/media/templates/packages/figma/src/config.ts +0 -0
  92. package/src/media/templates/packages/figma/src/functions/_.gitignore.txt +1 -0
  93. package/src/media/templates/packages/figma/src/library.ts +0 -0
  94. package/src/media/templates/packages/figma/src/main.ts +4 -0
  95. package/src/media/templates/packages/figma/src/media/_.gitignore.txt +1 -0
  96. package/src/media/templates/packages/figma/src/storybook/_.gitignore.txt +1 -0
  97. package/src/media/templates/packages/figma/src/types/_.gitignore.txt +1 -0
  98. package/src/media/templates/packages/figma/src/vite-env.d.ts +1 -0
  99. package/src/media/templates/packages/figma/tsconfig.app.json +12 -0
  100. package/src/media/templates/packages/figma/tsconfig.json +7 -0
  101. package/src/media/templates/packages/figma/tsconfig.node.json +8 -0
  102. package/src/media/templates/packages/figma/vite.config.ts +7 -0
  103. package/src/types/configTypes.ts +3 -0
  104. package/src/types/webTypes.ts +105 -0
@@ -13,125 +13,136 @@ import {
13
13
  } from '../../config'
14
14
 
15
15
  /**
16
- * Class for retrieving configuration data.
16
+ * Static configuration orchestrator for the design system.
17
+ * Responsible for locating, loading, and merging the `design-ui.json` configuration file, handling recursive extensions, and providing a centralized interface for accessing project-wide settings including naming, separators, and AI integration parameters.
17
18
  *
18
- * Класс для получения данных конфигурации.
19
+ * Статический оркестратор конфигурации для дизайн-системы.
20
+ * Отвечает за поиск, загрузку и слияние файла конфигурации `design-ui.json`, обработку рекурсивных расширений и предоставление централизованного интерфейса для доступа к общепроектным настройкам, включая именование, разделители и параметры интеграции ИИ.
19
21
  */
20
22
  export class PropertiesConfig {
21
23
  protected static config: DesignUiConfig
22
24
 
23
25
  /**
24
- * Returns the project name.
26
+ * Retrieves the global project identifier.
25
27
  *
26
- * Возвращает название проекта.
28
+ * Получает глобальный идентификатор проекта.
27
29
  */
28
30
  static getProjectName(): string {
29
31
  return this.config.project ?? 'ui'
30
32
  }
31
33
 
32
34
  /**
33
- * Returns the project name.
35
+ * Retrieves the primary design system name.
34
36
  *
35
- * Возвращает название проекта.
37
+ * Получает основное название дизайн-системы.
36
38
  */
37
39
  static getDesignName(): string {
38
40
  return this.config.name ?? 'ui'
39
41
  }
40
42
 
41
43
  /**
42
- * Returns alternative design names.
44
+ * Returns alternative design system aliases.
43
45
  *
44
- * Возвращает альтернативные названия дизайна.
46
+ * Возвращает альтернативные алиасы дизайн-системы.
45
47
  */
46
48
  static getDesignAlternativeName(): string[] | undefined {
47
49
  return this.config?.alternativeName
48
50
  }
49
51
 
50
52
  /**
51
- * Returns the separator symbol.
53
+ * Returns the token path separator character.
52
54
  *
53
- * Возвращает символ разделителя.
55
+ * Возвращает символ-разделитель пути токена.
54
56
  */
55
57
  static getSeparator(): string {
56
58
  return this.config.separator ?? '/'
57
59
  }
58
60
 
59
61
  /**
60
- * Returns the base name of the separator.
62
+ * Returns the identifier for the base level separator.
61
63
  *
62
- * Возвращает базовое название разделителя.
64
+ * Возвращает идентификатор для базового разделителя.
63
65
  */
64
66
  static getSeparatorBasicName(): string {
65
67
  return this.config.separatorBasicName ?? 'basic'
66
68
  }
67
69
 
68
70
  /**
69
- * Returns the limit of separator characters in a single key.
71
+ * Returns the maximum depth for token path segments.
70
72
  *
71
- * Возвращает лимит символов-разделителей в одном ключе.
73
+ * Возвращает максимальную глубину сегментов пути токена.
72
74
  */
73
75
  static getSeparatorLimit(): number {
74
76
  return this.config.separatorLimit ?? 6
75
77
  }
76
78
 
77
79
  /**
78
- * Returns the wiki language.
80
+ * Returns the primary language for documentation generation.
79
81
  *
80
- * Возвращает язык wiki.
82
+ * Возвращает основной язык для генерации документации.
81
83
  */
82
84
  static getWikiLanguage(): string {
83
85
  return this.config.wikiLanguage ?? 'en'
84
86
  }
85
87
 
86
88
  /**
87
- * Returns the package prefix.
89
+ * Returns the prefix for generated npm packages.
88
90
  *
89
- * Возвращает префикс пакета.
91
+ * Возвращает префикс для генерируемых npm-пакетов.
90
92
  */
91
93
  static getPackagePrefix(): string | undefined {
92
94
  return this.config.packagePrefix ?? undefined
93
95
  }
94
96
 
95
97
  /**
96
- * Returns the AI type.
98
+ * Returns the configured AI provider type.
97
99
  *
98
- * Возвращает тип ИИ.
100
+ * Возвращает настроенный тип ИИ-провайдера.
99
101
  */
100
102
  static getAiType(): AiType {
101
103
  return this.config.aiType ?? 'gemini'
102
104
  }
103
105
 
104
106
  /**
105
- * Returns the AI model.
107
+ * Returns the specific AI model identifier.
106
108
  *
107
- * Возвращает модель ИИ.
109
+ * Возвращает конкретный идентификатор модели ИИ.
108
110
  */
109
111
  static getAiModel(): string {
110
112
  return this.config.aiModel ?? ''
111
113
  }
112
114
 
113
115
  /**
114
- * Returns the AI API key.
116
+ * Returns the secure API key for AI authentication.
115
117
  *
116
- * Возвращает API ключ ИИ.
118
+ * Возвращает безопасный API-ключ для аутентификации ИИ.
117
119
  */
118
120
  static getAiKey(): string {
119
121
  return this.config.aiKey ?? ''
120
122
  }
121
123
 
122
124
  /**
123
- * Returns the directories for AI documentation generation.
125
+ * Returns the AI configuration object.
124
126
  *
125
- * Возвращает каталоги для генерации AI документации.
127
+ * Возвращает объект конфигурации ИИ.
128
+ */
129
+ static getAiConfig(): Record<string, any> {
130
+ return this.config.aiConfig ?? {}
131
+ }
132
+
133
+ /**
134
+ * Returns the list of directories targeted for AI-driven documentation.
135
+ *
136
+ * Возвращает список директорий, предназначенных для автоматической документации через ИИ.
126
137
  */
127
138
  static getAiDocDirectory(): string[] {
128
139
  return this.config.aiDocDirectory ?? UI_AI_DOC_DIRECTORY
129
140
  }
130
141
 
131
142
  /**
132
- * Returns the Storybook path for AI documentation generation.
143
+ * Returns the export path for Storybook-compatible AI documentation.
133
144
  *
134
- * Возвращает путь Storybook для генерации AI документации.
145
+ * Возвращает путь экспорта для AI-документации, совместимой со Storybook.
135
146
  */
136
147
  static getAiDocStorybookPath(): string {
137
148
  return this.config.aiDocStorybookPath ?? UI_AI_DOC_STORYBOOK
@@ -17,16 +17,20 @@ const LIST: Record<string, (item: PropertyItemInput) => void> = {
17
17
  }
18
18
 
19
19
  /**
20
- * Class for data type conversion.<br>
21
- * Класс для преобразования типов данных.
20
+ * Static utility for semantic token transformation.
21
+ * This class orchestrates the conversion of raw property values into specialized design formats (e.g., color processing, typography synthesis, shadow normalization) by dispatching items to specific convectors based on their metadata type.
22
+ *
23
+ * Статическая утилита для семантического преобразования токенов.
24
+ * Этот класс координирует преобразование необработанных значений свойств в специализированные форматы дизайна (например, обработка цвета, синтез типографики, нормализация теней), распределяя элементы по конкретным конвертерам на основе их типа метаданных.
22
25
  */
23
26
  export class PropertiesConvector {
24
27
  /**
25
- * Basic value transformation.
28
+ * Recursively transforms property lists or individual data structures.
29
+ * Identifies the property type and applies the corresponding specialized convector if available, or continues recursive traversal for nested objects.
26
30
  *
27
- * Базовое преобразование значения.
28
- * @param properties an array that needs to be transformed/
29
- * массив, который нужно преобразовать
31
+ * Рекурсивно преобразует списки свойств или отдельные структуры данных.
32
+ * Определяет тип свойства и применяет соответствующий специализированный конвертер, если он доступен, или продолжает рекурсивный обход для вложенных объектов.
33
+ * @param properties the property cluster to be transformed / кластер свойств для преобразования
30
34
  */
31
35
  static to(properties: PropertyListOrData): void {
32
36
  forEach(properties, (item) => {
@@ -12,34 +12,31 @@ export type PropertiesFileValue<T = any> = string | Record<string, T> | Buffer
12
12
  const dirnamePath = hasNativeDirname() ? __dirname : requirePath.dirname(fileURLToPath(import.meta.url))
13
13
 
14
14
  /**
15
- * A class for working with files.
15
+ * Universal static utility for filesystem orchestration.
16
+ * This class provides a standardized interface for all IO operations within the design system, including path normalization, recursive directory traversal, synchronized file reading/writing, and metadata retrieval. It abstracts platform-specific path differences and ensures consistent data handling across the toolchain.
16
17
  *
17
- * Класс для работы с файлами.
18
+ * Универсальная статическая утилита для оркестрации файловой системы.
19
+ * Этот класс предоставляет стандартизированный интерфейс для всех операций ввода-вывода в рамках дизайн-системы, включая нормализацию путей, рекурсивный обход директорий, синхронное чтение/запись файлов и получение метаданных. Он абстрагирует различия путей в разных ОС и обеспечивает согласованную обработку данных во всей цепочке инструментов.
18
20
  */
19
21
  export class PropertiesFile {
20
22
  protected static root: string
21
23
  protected static module: boolean
22
24
 
23
25
  /**
24
- * The fs.existsSync() method is used to synchronously check if a file already
25
- * exists in the given path or not. It returns a boolean value which indicates
26
- * the presence of a file.
26
+ * Synchronously checks for the existence of a file or directory at the specified path.
27
27
  *
28
- * Метод fs.existsSync() используется для синхронной проверки наличия файла в
29
- * указанном пути. Он возвращает логическое значение, которое указывает на
30
- * наличие файла.
31
- * @param path it holds the path of the file that has to be checked /
32
- * это содержит путь к файлу, который необходимо проверить
28
+ * Синхронно проверяет существование файла или директории по указанному пути.
29
+ * @param path target filesystem path to verify / целевой путь в файловой системе для проверки
33
30
  */
34
31
  static is(path: PropertiesFilePath): boolean {
35
32
  return requireFs.existsSync(this.joinPath(path))
36
33
  }
37
34
 
38
35
  /**
39
- * Checks whether it is a directory.
36
+ * Determines if the specified path points to a directory.
40
37
  *
41
- * Проверяет, является ли это директорией.
42
- * @param path name of the element being checked/ название проверяемого элемента
38
+ * Определяет, указывает ли указанный путь на директорию.
39
+ * @param path path to the filesystem element / путь к элементу файловой системы
43
40
  */
44
41
  static isDir(path: PropertiesFilePath): boolean {
45
42
  if (this.is(path)) {
@@ -59,13 +56,10 @@ export class PropertiesFile {
59
56
  }
60
57
 
61
58
  /**
62
- * The path.joinPath() method joins all given path segments together using the
63
- * platform-specific separator as a delimiter, then normalizes the resulting path.
59
+ * Joins multiple path segments into a single normalized path string using the OS separator.
64
60
  *
65
- * Метод path.joinPath() объединяет все указанные сегменты пути с использованием
66
- * специфического для платформы разделителя в качестве разделителя,
67
- * а затем нормализует полученный путь.
68
- * @param path a sequence of path segments/ последовательность сегментов пути
61
+ * Объединяет несколько сегментов пути в одну нормализованную строку пути, используя разделитель ОС.
62
+ * @param path array or string of path segments / массив или строка сегментов пути
69
63
  */
70
64
  static joinPath(path: PropertiesFilePath): string {
71
65
  const pathArray = forEach(
@@ -344,10 +338,10 @@ export class PropertiesFile {
344
338
  }
345
339
 
346
340
  /**
347
- * Returns the contents of the path.
341
+ * Synchronously reads and parses the contents of a file (JSON or raw text).
348
342
  *
349
- * Возвращает содержимое пути.
350
- * @param path filename/ имя файла
343
+ * Синхронно читает и парсит содержимое файла (JSON или обычный текст).
344
+ * @param path path to the target file / путь к целевому файлу
351
345
  */
352
346
  static readFile<R>(path: PropertiesFilePath): R | undefined {
353
347
  if (this.is(path)) {
@@ -391,13 +385,13 @@ export class PropertiesFile {
391
385
  }
392
386
 
393
387
  /**
394
- * Writing data to a file.
388
+ * Writes data to a file at the specified location, automatically creating directories and formatting objects as JSON by default.
395
389
  *
396
- * Запись данных в файл.
397
- * @param path path to the file/ путь к файлу
398
- * @param name file name/ название файла
399
- * @param value values for storage/ значения для хранения
400
- * @param extension file extension by default is ts/ расширение файла по умолчанию - ts
390
+ * Записывает данные в файл по указанному адресу, автоматически создавая директории и форматируя объекты в JSON по умолчанию.
391
+ * @param path base directory path / путь к базовой директории
392
+ * @param name target filename (without extension if extension provided) / имя целевого файла
393
+ * @param value data to be stored / данные для хранения
394
+ * @param extension file extension (defaults to 'json') / расширение файла (по умолчанию 'json')
401
395
  */
402
396
  static write<T extends PropertiesFileValue>(
403
397
  path: PropertiesFilePath,
@@ -20,9 +20,11 @@ import {
20
20
  } from '../../types/propertyTypes'
21
21
 
22
22
  /**
23
- * Class for working with external files, which adds them to the current list of properties.
23
+ * Resolver for external property references.
24
+ * This class orchestrates the inclusion of external design tokens into the primary property tree. It identifies file references, resolves paths (including nested directory imports and specific object path deep-linking via hashes), and merges the external data into the current configuration cluster.
24
25
  *
25
- * Класс для работы с внешними файлами, который подключает их к текущему списку свойств.
26
+ * Резолвер внешних ссылок на свойства.
27
+ * Этот класс координирует включение внешних токенов дизайна в основное дерево свойств. Он идентифицирует ссылки на файлы, разрешает пути (включая импорт вложенных директорий и глубокие ссылки на конкретные объекты через хеш) и объединяет внешние данные с текущим кластером конфигурации.
26
28
  */
27
29
  export class PropertiesImport {
28
30
  /**
@@ -38,12 +40,13 @@ export class PropertiesImport {
38
40
  }
39
41
 
40
42
  /**
41
- * Method that adds external files to the current property.
43
+ * Resolves and merges external file references within a property cluster.
44
+ * Iterates through the properties, looks for items of type 'file', and recursively imports their content, supporting deep-linking (e.g., 'file.json#path.to.data').
42
45
  *
43
- * Метод подключает внешние файлы к текущему свойству.
44
- * @param properties An array that needs to be transformed/
45
- * Массив, который нужно преобразовать
46
- * @param root path to the directory/ путь к директории
46
+ * Разрешает и объединяет ссылки на внешние файлы внутри кластера свойств.
47
+ * Итерирует по свойствам, ищет элементы типа 'file' и рекурсивно импортирует их содержимое, поддерживая глубокие ссылки (например, 'file.json#path.to.data').
48
+ * @param properties the property list to process / список свойств для обработки
49
+ * @param root the base path segments for resolution / базовые сегменты пути для разрешения
47
50
  */
48
51
  to(
49
52
  properties = this.properties,
@@ -31,9 +31,11 @@ const SUPPORT_NAME = [
31
31
  ]
32
32
 
33
33
  /**
34
- * Class for working with a list of all properties.
34
+ * Coordinator for design property collections.
35
+ * This class provides a high-level API for traversing, searching, and extracting metadata from complex design token trees. It manages state related to design focusing (filtering view to a specific design set), converts complex path strings into normalized keys, and facilitates deep recursive iteration for token processing engines.
35
36
  *
36
- * Класс для работы со списком всех свойств.
37
+ * Координатор коллекций свойств дизайна.
38
+ * Этот класс предоставляет высокоуровневый API для обхода, поиска и извлечения метаданных из сложных деревьев токенов дизайна. Он управляет состоянием, связанным с фокусировкой дизайна (фильтрация представления для конкретного набора дизайнов), преобразует сложные строки путей в нормализованные ключи и упрощает глубокую рекурсивную итерацию для движков обработки токенов.
37
39
  */
38
40
  export class PropertiesItems {
39
41
  private focusDesign?: string
@@ -65,9 +67,11 @@ export class PropertiesItems {
65
67
  }
66
68
 
67
69
  /**
68
- * Getting full structure property.
70
+ * Retrieves the current property structure.
71
+ * If a focus design is set, returns only the subset corresponding to that design and common constructor data; otherwise, returns the full collection.
69
72
  *
70
- * Получение полной структуры свойства.
73
+ * Получает текущую структуру свойств.
74
+ * Если установлен фокус на дизайн, возвращает только подмножество, соответствующее этому дизайну и общим данным конструктора; в противном случае возвращает полную коллекцию.
71
75
  */
72
76
  get(): PropertyList {
73
77
  if (this.focusDesign) {
@@ -114,10 +118,12 @@ export class PropertiesItems {
114
118
  }
115
119
 
116
120
  /**
117
- * Returns the full information about the element by its link.
121
+ * Resolves comprehensive metadata for a property element by its dotted index.
122
+ * Decodes the index, traverses the tree to find the target node, and synthesizes a detailed info object including parent hierarchy, name normalization, and raw values.
118
123
  *
119
- * Возвращает полную информацию об элементе по его ссылке.
120
- * @param index index for splitting/ индекс для разделения
124
+ * Разрешает полные метаданные элемента свойства по его индексу через точку.
125
+ * Декодирует индекс, обходит дерево для поиска целевого узла и синтезирует подробный объект информации, включая иерархию родителей, нормализацию имен и необработанные значения.
126
+ * @param index index for splitting / индекс для разделения
121
127
  */
122
128
  getInfo(index: string): PropertyItemsItem | undefined {
123
129
  const keys = this.getKeys(index)
@@ -376,12 +382,13 @@ export class PropertiesItems {
376
382
  }
377
383
 
378
384
  /**
379
- * Recursively applies a custom function to each element of the property.
385
+ * Performs a deep recursive traversal of the property tree.
386
+ * Executes a callback for every node discovered. If a specific property node is provided, the traversal is restricted to its children; otherwise, the entire tree is visited.
380
387
  *
381
- * Рекурсивно применяет пользовательскую функцию к каждому элементу свойства.
382
- * @param callback the callback function is executed for each element/
383
- * выполняется функция обратного вызова (callback) для каждого элемента
384
- * @param property
388
+ * Выполняет глубокий рекурсивный обход дерева свойств.
389
+ * Выполняет callback для каждого обнаруженного узла. Если предоставлен конкретный узел свойства, обход ограничивается его дочерними элементами; в противном случае посещается все дерево.
390
+ * @param callback the callback function to execute for each element / функция обратного вызова для каждого элемента
391
+ * @param property optional start node for traversal / опциональный начальный узел для обхода
385
392
  */
386
393
  each<T>(
387
394
  callback: PropertyItemsCallback<T>,
@@ -8,16 +8,20 @@ import { PropertiesTypes } from './PropertiesTypes'
8
8
  import { type PropertyItem } from '../../types/propertyTypes'
9
9
 
10
10
  /**
11
- * Key with all special keys for token processing.
11
+ * Parser and transformer for property key semantics.
12
+ * This static utility class handles the identification of special system keys (like metadata or internal references) and orchestrates the transformation of raw key names into normalized, context-aware tokens (e.g., prepending media types or converting to camelCase).
12
13
  *
13
- * Ключ со всеми специальными ключами для обработки токенов.
14
+ * Парсер и трансформер семантики ключей свойств.
15
+ * Этот статический вспомогательный класс обрабатывает идентификацию специальных системных ключей (таких как метаданные или внутренние ссылки) и координирует преобразование необработанных имен ключей в нормализованные токены с учетом контекста (например, добавление типов медиа или преобразование в camelCase).
14
16
  */
15
17
  export class PropertiesKeys {
16
18
  /**
17
- * Checks if the variable is a special value.
19
+ * Identifies if a key is a protected system metadata key or an internal reference.
20
+ * Special keys include 'value', 'type', 'description', and any key starting with an underscore (internal engine states).
18
21
  *
19
- * Проверяет, является ли переменная специальным значением.
20
- * @param key key name/ название ключа
22
+ * Определяет, является ли ключ защищенным системным ключом метаданных или внутренней ссылкой.
23
+ * Специальные ключи включают 'value', 'type', 'description' и любой ключ, начинающийся с подчеркивания (внутренние состояния движка).
24
+ * @param key the key name to verify / название ключа для проверки
21
25
  */
22
26
  static isSpecialKey(key: string | number): key is keyof PropertyItem {
23
27
  return typeof key === 'string' && (
@@ -48,11 +52,13 @@ export class PropertiesKeys {
48
52
  }
49
53
 
50
54
  /**
51
- * Returns the property name, discarding its prefix.
55
+ * Normalizes a raw key name by removing metadata prefixes and applying casing rules.
56
+ * Strips internal type symbols and leading pipes, then optionally converts the result to camelCase (unless the name is a path separator).
52
57
  *
53
- * Возвращает имя свойства, отбрасывая его префикс.
54
- * @param name key name/ название ключа
55
- * @param camelCase to convert case/ преобразуйте этот текст в верхний регистр
58
+ * Нормализует необработанное имя ключа, удаляя префиксы метаданных и применяя правила регистра.
59
+ * Очищает внутренние символы типов и ведущие вертикальные черты, затем опционально преобразует результат в camelCase (если имя не является разделителем пути).
60
+ * @param name the raw key name / необработанное имя ключа
61
+ * @param camelCase whether to apply camelCase transformation / нужно ли применять преобразование в camelCase
56
62
  */
57
63
  static getName(name: string, camelCase = true): string {
58
64
  const newName = name
@@ -19,9 +19,11 @@ import type {
19
19
  const DIR_NAME = 'main'
20
20
 
21
21
  /**
22
- * A class for transforming global tokens.
22
+ * Orchestrator for global design token transformation.
23
+ * This class serves as the primary engine for loading, validating, and normalizing "main" tokens across all supported designs. It coordinates a multi-stage pipeline—including semantic conversion, reference import, and structural wrapping—to synthesize a unified property tree ready for consumption by external builders.
23
24
  *
24
- * Класс для преобразования глобальных токенов.
25
+ * Оркестратор глобальной трансформации токенов дизайна.
26
+ * Этот класс служит основным движком для загрузки, валидации и нормализации «основных» (main) токенов во всех поддерживаемых дизайнах. Он координирует многоэтапный конвейер — включая семантическую конвертацию, импорт ссылок и структурную обертку — для синтеза унифицированного дерева свойств, готового к использованию внешними строителями.
25
27
  */
26
28
  export class PropertiesMain {
27
29
  /**
@@ -34,9 +36,11 @@ export class PropertiesMain {
34
36
  }
35
37
 
36
38
  /**
37
- * Returns all main tokens.
39
+ * Executes the full transformation pipeline for all main design tokens.
40
+ * Discovers token files via the path manager, then sequentially applies reading, conversion, standardization, link resolution, and structural wrapping for every design entry.
38
41
  *
39
- * Возвращает все основные токены.
42
+ * Выполняет полный конвейер трансформации для всех основных токенов дизайна.
43
+ * Обнаруживает файлы токенов через менеджер путей, затем последовательно применяет чтение, конвертацию, стандартизацию, разрешение ссылок и структурную обертку для каждой записи дизайна.
40
44
  */
41
45
  get(): PropertyList {
42
46
  return this.path.toAll(DIR_NAME, (
@@ -66,10 +70,12 @@ export class PropertiesMain {
66
70
  }
67
71
 
68
72
  /**
69
- * We get the main property taking into account the change of settings.
73
+ * Synchronizes global tokens with a provided settings cluster.
74
+ * Retrieves the full set of main tokens and deeply merges internal state flags from the settings list into the corresponding nodes of the global tree.
70
75
  *
71
- * Получаем главное свойство с учетом изменения настроек.
72
- * @param list list of settings/ список настроек
76
+ * Синхронизирует глобальные токены с предоставленным кластером настроек.
77
+ * Получает полный набор основных токенов и глубоко объединяет флаги внутреннего состояния из списка настроек в соответствующие узлы глобального дерева.
78
+ * @param list the settings cluster to apply / кластер настроек для применения
73
79
  */
74
80
  getBySettings(list: PropertyList): PropertyList {
75
81
  const data = this.get()
@@ -14,9 +14,11 @@ import {
14
14
  } from '../../types/propertyTypes'
15
15
 
16
16
  /**
17
- * Class for working with colors.
17
+ * Manager for design palette and color saturation.
18
+ * This class handles the extraction of available shade levels (saturation steps) and tracks the usage of palette colors across the design system. It facilitates the mapping between functional variables and their underlying palette definitions, ensuring that generated styles correctly reference the intended theme colors.
18
19
  *
19
- * Класс для работы с цветами.
20
+ * Менеджер палитры дизайна и насыщенности цветов.
21
+ * Этот класс обрабатывает извлечение доступных уровней оттенков (шагов насыщенности) и отслеживает использование цветов палитры в системе дизайна. Он упрощает сопоставление функциональных переменных с их базовыми определениями в палитре, гарантируя, что сгенерированные стили правильно ссылаются на нужные цвета темы.
20
22
  */
21
23
  export class PropertiesPalette {
22
24
  /**
@@ -28,9 +30,11 @@ export class PropertiesPalette {
28
30
  }
29
31
 
30
32
  /**
31
- * Returns a list of available saturation levels.
33
+ * Retrieves a list of available saturation levels (shades) grouped by design.
34
+ * Scans the token cluster for items categorized as 'shade' and returns their resolved value structures.
32
35
  *
33
- * Возвращает список доступных уровней насыщенности.
36
+ * Возвращает список доступных уровней насыщенности (оттенков), сгруппированных по дизайну.
37
+ * Сканирует кластер токенов на наличие элементов, классифицированных как 'shade', и возвращает их разрешенные структуры значений.
34
38
  */
35
39
  getShade(): PropertyPaletteList {
36
40
  return forEach(this.items.findCategory(PropertyCategory.shade), ({
@@ -49,9 +53,11 @@ export class PropertiesPalette {
49
53
  }
50
54
 
51
55
  /**
52
- * Getting a list of used values.
56
+ * Generates a report of all palette colors currently utilized in functional variables.
57
+ * Iterates through the entire property tree to identify variables referencing palette colors and maps them to their corresponding CSS variable names.
53
58
  *
54
- * Получаем список использованных значений.
59
+ * Генерирует отчет обо всех цветах палитры, используемых в данный момент в функциональных переменных.
60
+ * Итерирует по всему дереву свойств для идентификации переменных, ссылающихся на цвета палитры, и сопоставляет их с соответствующими именами CSS-переменных.
55
61
  */
56
62
  getUsed(): PropertyPaletteUsed[] {
57
63
  const list = this.getList()
@@ -24,9 +24,11 @@ export type PropertiesPathList = PropertiesPathItem[]
24
24
  const DIR_CACHE = 'read'
25
25
 
26
26
  /**
27
- * Class for working with paths by the given name of the design.
27
+ * Directory and path resolver for multi-design token environments.
28
+ * This class translates abstract design names into concrete filesystem paths for global tokens and component-specific settings. It coordinates the cross-platform path discovery flow and provided cached traversal mechanisms (`to`, `toAll`) to efficiently process token files across the entire project structure.
28
29
  *
29
- * Класс для работы с путями по заданному названию дизайна.
30
+ * Резолвер директорий и путей для сред с несколькими дизайнами токенов.
31
+ * Этот класс преобразует абстрактные названия дизайнов в конкретные пути файловой системы для глобальных токенов и настроек компонентов. Он координирует процесс обнаружения путей на разных платформах и предоставляет механизмы кэшированного обхода (`to`, `toAll`) для эффективной обработки файлов токенов во всей структуре проекта.
30
32
  */
31
33
  export class PropertiesPath {
32
34
  private readonly paths: PropertiesPathList
@@ -92,12 +94,14 @@ export class PropertiesPath {
92
94
  }
93
95
 
94
96
  /**
95
- * Processes all token values for the selected design and combines them into one-big array.
97
+ * Executes a cached transformation for a specific design and token group.
98
+ * Resolves paths for the target design, executes the provided callback to process the data, and caches the result for future performance. Ideal for processing individual themes or component layers within a theme.
96
99
  *
97
- * Обрабатывает все значения токена у выбранного дизайна и соединяет их в одну-большую массива.
98
- * @param name name of the group/ названия группы
99
- * @param design design name/ название дизайна
100
- * @param callback function for processing/ функция для обработки
100
+ * Выполняет кэшированную трансформацию для конкретного дизайна и группы токенов.
101
+ * Разрешает пути для целевого дизайна, выполняет предоставленный callback для обработки данных и кэширует результат. Идеально подходит для обработки отдельных тем или слоев компонентов внутри темы.
102
+ * @param name unique name for the processing group (used as cache key) / уникальное имя группы обработки (используется как ключ кэша)
103
+ * @param design names of the design to process / названия дизайна для обработки
104
+ * @param callback function that receives resolved paths and returns processed data / функция, которая получает разрешенные пути и возвращает обработанные данные
101
105
  */
102
106
  to(
103
107
  name: string,
@@ -128,11 +132,13 @@ export class PropertiesPath {
128
132
  }
129
133
 
130
134
  /**
131
- * Processes all token values for all designs and combines them into one-big array.
135
+ * Orchestrates a global cached transformation across all registered designs.
136
+ * Iterates through every design defined in the constructor, processes its tokens using the provided callback, and merges the results into a single unified property tree.
132
137
  *
133
- * Обрабатывает все значения токена у всех дизайнов и соединяет их в одну-большую массива.
134
- * @param name name of the group/ названия группы
135
- * @param callback function for processing/ функция для обработки
138
+ * Координирует глобальную кэшированную трансформацию для всех зарегистрированных дизайнов.
139
+ * Итерирует по каждому дизайну, определенному в конструкторе, обрабатывает его токены с помощью предоставленного callback и объединяет результаты в единое унифицированное дерево свойств.
140
+ * @param name unique name for the global processing group / уникальное имя глобальной группы обработки
141
+ * @param callback function for processing individual designs / функция для обработки отдельных дизайнов
136
142
  */
137
143
  toAll(
138
144
  name: string,