@dxtmisha/scripts 0.11.7 → 1.0.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/CHANGELOG.md +67 -0
- package/ai-resources/componentMaterials.md +19 -0
- package/ai-resources/componentPrompt.md +381 -0
- package/ai-resources/componentWiki.md +13 -0
- package/bin/arguments.ts +168 -0
- package/bin/build-packages.ts +12 -2
- package/bin/build-publish-packages.ts +12 -2
- package/bin/design-component.ts +7 -1
- package/bin/design-constructor.ts +22 -3
- package/bin/design-figma.ts +26 -4
- package/bin/design-flags.ts +14 -2
- package/bin/design-library.ts +7 -1
- package/bin/design-package.ts +29 -5
- package/bin/design-prompt.ts +22 -3
- package/bin/design-screenshot.ts +12 -2
- package/bin/design-types-save.ts +32 -5
- package/bin/design-types.ts +32 -6
- package/bin/design-ui.ts +21 -3
- package/bin/design-wiki-storm.ts +11 -3
- package/dist/AiZAi-x3CInynJ.js +232 -0
- package/dist/PropertiesConfig-ChizwW5y.js +250 -0
- package/{src/config.ts → dist/config.d.ts} +179 -158
- package/dist/config.js +20 -0
- package/dist/figmaApiTypes-CArSsNW8.js +6 -0
- package/dist/library-ai.d.ts +482 -0
- package/dist/library-ai.js +2 -0
- package/dist/library-figma.d.ts +462 -0
- package/dist/library-figma.js +75 -0
- package/dist/library-ui.d.ts +586 -0
- package/dist/library-ui.js +3760 -0
- package/dist/library.d.ts +4677 -0
- package/dist/library.js +1436 -0
- package/dist/propertyTypes-DflziKuR.js +236 -0
- package/package.json +69 -20
- package/bin/ai-doc.ts +0 -7
- package/bin/build-functional.ts +0 -5
- package/bin/design-component-wiki.ts +0 -11
- package/src/classes/Ai/AiAbstract.ts +0 -242
- package/src/classes/Ai/AiClaude.ts +0 -26
- package/src/classes/Ai/AiClaudeAgent.ts +0 -16
- package/src/classes/Ai/AiClaudeAgentLite.ts +0 -86
- package/src/classes/Ai/AiClaudeCli.ts +0 -24
- package/src/classes/Ai/AiClaudeCliLite.ts +0 -108
- package/src/classes/Ai/AiClaudeLite.ts +0 -112
- package/src/classes/Ai/AiDoc.ts +0 -81
- package/src/classes/Ai/AiDocItem.ts +0 -27
- package/src/classes/Ai/AiDocItemAbstract.ts +0 -209
- package/src/classes/Ai/AiDocItemClasses.ts +0 -27
- package/src/classes/Ai/AiDocItemComposables.ts +0 -20
- package/src/classes/Ai/AiDocType.ts +0 -45
- package/src/classes/Ai/AiGoogle.ts +0 -26
- package/src/classes/Ai/AiGoogleCli.ts +0 -24
- package/src/classes/Ai/AiGoogleCliLite.ts +0 -108
- package/src/classes/Ai/AiGoogleLite.ts +0 -78
- package/src/classes/Ai/AiOpenAi.ts +0 -26
- package/src/classes/Ai/AiOpenAiLite.ts +0 -107
- package/src/classes/Ai/AiZAi.ts +0 -17
- package/src/classes/Ai/AiZAiLite.ts +0 -77
- package/src/classes/Ai/ApiTmp.ts +0 -43
- package/src/classes/BrowserItem.ts +0 -408
- package/src/classes/Build/BuildFunctional.ts +0 -54
- package/src/classes/Build/BuildPackages.ts +0 -137
- package/src/classes/Build/BuildPublishPackages.ts +0 -105
- package/src/classes/BuildItem.ts +0 -187
- package/src/classes/Component/ComponentCreator.ts +0 -45
- package/src/classes/Component/ComponentItem.ts +0 -161
- package/src/classes/Component/ComponentWiki.ts +0 -258
- package/src/classes/Component/ComponentWikiFile.ts +0 -138
- package/src/classes/Design/DesignCommand.ts +0 -243
- package/src/classes/Design/DesignComponent.ts +0 -824
- package/src/classes/Design/DesignConstructor.ts +0 -222
- package/src/classes/Design/DesignConstructors.ts +0 -101
- package/src/classes/Design/DesignFigma.ts +0 -61
- package/src/classes/Design/DesignFlags.ts +0 -215
- package/src/classes/Design/DesignReplace.ts +0 -672
- package/src/classes/Design/DesignScreenshot.ts +0 -133
- package/src/classes/Design/DesignStructure.ts +0 -201
- package/src/classes/Design/DesignStructureClasses.ts +0 -105
- package/src/classes/Design/DesignStructureItemAbstract.ts +0 -52
- package/src/classes/Design/DesignStructureRead.ts +0 -349
- package/src/classes/Design/DesignStructureStyles.ts +0 -45
- package/src/classes/Design/DesignTypes.ts +0 -94
- package/src/classes/Design/DesignTypesAi.ts +0 -135
- package/src/classes/Design/DesignTypesDescription.ts +0 -119
- package/src/classes/Design/DesignTypesMake.ts +0 -460
- package/src/classes/Design/DesignTypesMcp.ts +0 -90
- package/src/classes/Design/DesignTypesPrompts.ts +0 -332
- package/src/classes/Design/DesignTypescript.ts +0 -244
- package/src/classes/Design/DesignUi.ts +0 -143
- package/src/classes/Design/DesignWiki.ts +0 -52
- package/src/classes/Design/DesignWikiStorm.ts +0 -95
- package/src/classes/Design/DesignWikiStormItem.ts +0 -316
- package/src/classes/FigmaApi.ts +0 -190
- package/src/classes/Git/GitRead.ts +0 -261
- package/src/classes/Library/LibraryAiMcpItem.ts +0 -67
- package/src/classes/Library/LibraryAiPrompt.ts +0 -268
- package/src/classes/Library/LibraryAiPromptItem.ts +0 -331
- package/src/classes/Library/LibraryAiWiki.ts +0 -127
- package/src/classes/Library/LibraryAiWikiItem.ts +0 -79
- package/src/classes/Library/LibraryExport.ts +0 -167
- package/src/classes/Library/LibraryFlags.ts +0 -62
- package/src/classes/Library/LibraryItems.ts +0 -138
- package/src/classes/Library/LibraryList.ts +0 -189
- package/src/classes/Library/LibraryMedia.ts +0 -139
- package/src/classes/Library/LibraryPlugin.ts +0 -73
- package/src/classes/Library/LibraryTypes.ts +0 -130
- package/src/classes/Package/PackageFile.ts +0 -154
- package/src/classes/Package/PackageInit.ts +0 -54
- package/src/classes/Package/PackageItem.ts +0 -329
- package/src/classes/Properties/Properties.ts +0 -175
- package/src/classes/Properties/PropertiesCache.ts +0 -248
- package/src/classes/Properties/PropertiesConfig.ts +0 -213
- package/src/classes/Properties/PropertiesConvector.ts +0 -52
- package/src/classes/Properties/PropertiesFile.ts +0 -522
- package/src/classes/Properties/PropertiesImport.ts +0 -182
- package/src/classes/Properties/PropertiesItems.ts +0 -605
- package/src/classes/Properties/PropertiesKeys.ts +0 -121
- package/src/classes/Properties/PropertiesMain.ts +0 -138
- package/src/classes/Properties/PropertiesPalette.ts +0 -149
- package/src/classes/Properties/PropertiesPath.ts +0 -193
- package/src/classes/Properties/PropertiesScss.ts +0 -261
- package/src/classes/Properties/PropertiesSeparator.ts +0 -118
- package/src/classes/Properties/PropertiesSettings.ts +0 -104
- package/src/classes/Properties/PropertiesStandard.ts +0 -180
- package/src/classes/Properties/PropertiesTool.ts +0 -80
- package/src/classes/Properties/PropertiesTypes.ts +0 -147
- package/src/classes/Properties/PropertiesValues.ts +0 -75
- package/src/classes/Properties/PropertiesWrap.ts +0 -187
- package/src/classes/Properties/convector/convectorColor.ts +0 -27
- package/src/classes/Properties/convector/convectorFontFamilies.ts +0 -18
- package/src/classes/Properties/convector/convectorShadow.ts +0 -61
- package/src/classes/Properties/convector/convectorTypography.ts +0 -19
- package/src/classes/Properties/to/PropertiesToAbstract.ts +0 -51
- package/src/classes/Properties/to/PropertiesToAnimate.ts +0 -59
- package/src/classes/Properties/to/PropertiesToClass.ts +0 -49
- package/src/classes/Properties/to/PropertiesToClone.ts +0 -114
- package/src/classes/Properties/to/PropertiesToComponent.ts +0 -52
- package/src/classes/Properties/to/PropertiesToDrag.ts +0 -231
- package/src/classes/Properties/to/PropertiesToDuplicate.ts +0 -165
- package/src/classes/Properties/to/PropertiesToFull.ts +0 -36
- package/src/classes/Properties/to/PropertiesToLink.ts +0 -259
- package/src/classes/Properties/to/PropertiesToMedia.ts +0 -187
- package/src/classes/Properties/to/PropertiesToMulti.ts +0 -101
- package/src/classes/Properties/to/PropertiesToNone.ts +0 -46
- package/src/classes/Properties/to/PropertiesToPalette.ts +0 -241
- package/src/classes/Properties/to/PropertiesToProperty.ts +0 -31
- package/src/classes/Properties/to/PropertiesToRemove.ts +0 -33
- package/src/classes/Properties/to/PropertiesToReplace.ts +0 -77
- package/src/classes/Properties/to/PropertiesToRoot.ts +0 -40
- package/src/classes/Properties/to/PropertiesToSimilar.ts +0 -128
- package/src/classes/Properties/to/PropertiesToSort.ts +0 -146
- package/src/classes/Properties/to/PropertiesToState.ts +0 -65
- package/src/classes/Properties/to/PropertiesToStyle.ts +0 -52
- package/src/classes/Properties/to/PropertiesToSub.ts +0 -95
- package/src/classes/Properties/to/PropertiesToSubclass.ts +0 -76
- package/src/classes/Properties/to/PropertiesToVar.ts +0 -194
- package/src/classes/Properties/to/PropertiesToVariable.ts +0 -176
- package/src/classes/Styles/Styles.ts +0 -247
- package/src/classes/Styles/StylesClasses.ts +0 -86
- package/src/classes/Styles/StylesProperties.ts +0 -197
- package/src/classes/Styles/StylesRoot.ts +0 -103
- package/src/classes/Styles/StylesTool.ts +0 -112
- package/src/classes/Styles/to/StylesToAbstract.ts +0 -93
- package/src/classes/Styles/to/StylesToAnimate.ts +0 -19
- package/src/classes/Styles/to/StylesToClass.ts +0 -25
- package/src/classes/Styles/to/StylesToClassFull.ts +0 -19
- package/src/classes/Styles/to/StylesToContainer.ts +0 -24
- package/src/classes/Styles/to/StylesToMedia.ts +0 -19
- package/src/classes/Styles/to/StylesToProperty.ts +0 -123
- package/src/classes/Styles/to/StylesToRoot.ts +0 -14
- package/src/classes/Styles/to/StylesToSelector.ts +0 -71
- package/src/classes/Styles/to/StylesToVar.ts +0 -105
- package/src/classes/Styles/to/StylesToVirtual.ts +0 -33
- package/src/composables/useAi.ts +0 -38
- package/src/demo/ai.ts +0 -10
- package/src/functions/getComponentPaths.ts +0 -13
- package/src/functions/getConfigAi.ts +0 -14
- package/src/functions/getConstructorProperties.ts +0 -54
- package/src/functions/getDirname.ts +0 -17
- package/src/functions/getNameDirByPaths.ts +0 -16
- package/src/functions/getPackageJson.ts +0 -19
- package/src/functions/hasNativeDirname.ts +0 -8
- package/src/functions/run.ts +0 -47
- package/src/functions/toPathStandardSep.ts +0 -14
- package/src/library-ai.ts +0 -10
- package/src/library.ts +0 -73
- package/src/media/ai/ai-doc-types.ts +0 -21
- package/src/media/properties/css.ts +0 -634
- package/src/media/properties/cssSelector.ts +0 -74
- package/src/media/properties/cssVirtual.ts +0 -12
- package/src/media/properties/listSort.ts +0 -113
- package/src/media/properties/style.ts +0 -81
- package/src/media/templates/component/DesignComponent.mdx +0 -30
- package/src/media/templates/component/DesignComponent.stories.ts +0 -34
- package/src/media/templates/component/DesignComponent.vue +0 -54
- package/src/media/templates/component/DesignComponentAiWiki.vue +0 -25
- package/src/media/templates/component/index.ts +0 -13
- package/src/media/templates/component/props.ts +0 -27
- package/src/media/templates/component/styleToken.scss +0 -17
- package/src/media/templates/component/wiki.ts +0 -13
- package/src/media/templates/component/wikiData.ts +0 -28
- package/src/media/templates/componentDoc/ComponentDoc.vue +0 -26
- package/src/media/templates/componentDoc/index.ts +0 -12
- package/src/media/templates/componentDoc/materials/README.md +0 -8
- package/src/media/templates/componentDoc/materials/prompt.md +0 -38
- package/src/media/templates/componentDoc/subcomponents/_.gitignore.txt +0 -0
- package/src/media/templates/componentDoc/types.ts +0 -15
- package/src/media/templates/componentDoc/wiki/ComponentDoc.mdx +0 -13
- package/src/media/templates/componentDoc/wiki/ComponentDoc.stories.ts +0 -24
- package/src/media/templates/componentDoc/wiki/prompt.md +0 -41
- package/src/media/templates/constructors/Constructors.ts +0 -33
- package/src/media/templates/constructors/ConstructorsDesign.tsx +0 -129
- package/src/media/templates/constructors/basicTypes.ts +0 -0
- package/src/media/templates/constructors/index.ts +0 -5
- package/src/media/templates/constructors/props.ts +0 -28
- package/src/media/templates/constructors/style.scss +0 -5
- package/src/media/templates/constructors/types.ts +0 -47
- package/src/media/templates/packages/figma/README.md +0 -1
- package/src/media/templates/packages/figma/_.gitignore.txt +0 -29
- package/src/media/templates/packages/figma/ai.sample.config.ts +0 -2
- package/src/media/templates/packages/figma/design.config.json +0 -3
- package/src/media/templates/packages/figma/index.html +0 -12
- package/src/media/templates/packages/figma/manifest.json +0 -25
- package/src/media/templates/packages/figma/package.json +0 -37
- package/src/media/templates/packages/figma/src/App.vue +0 -9
- package/src/media/templates/packages/figma/src/classes/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/code.ts +0 -16
- package/src/media/templates/packages/figma/src/components/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/composables/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/config.ts +0 -0
- package/src/media/templates/packages/figma/src/functions/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/library.ts +0 -0
- package/src/media/templates/packages/figma/src/main.ts +0 -4
- package/src/media/templates/packages/figma/src/media/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/storybook/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/types/_.gitignore.txt +0 -1
- package/src/media/templates/packages/figma/src/vite-env.d.ts +0 -1
- package/src/media/templates/packages/figma/tsconfig.app.json +0 -12
- package/src/media/templates/packages/figma/tsconfig.json +0 -7
- package/src/media/templates/packages/figma/tsconfig.node.json +0 -8
- package/src/media/templates/packages/figma/vite.config.ts +0 -7
- package/src/media/templates/packages/library/README.md +0 -1
- package/src/media/templates/packages/library/_.gitignore.txt +0 -27
- package/src/media/templates/packages/library/ai-description.md +0 -15
- package/src/media/templates/packages/library/design.config.json +0 -3
- package/src/media/templates/packages/library/index.html +0 -12
- package/src/media/templates/packages/library/materials/README.md +0 -8
- package/src/media/templates/packages/library/materials/prompt.md +0 -45
- package/src/media/templates/packages/library/package.json +0 -46
- package/src/media/templates/packages/library/src/App.vue +0 -8
- package/src/media/templates/packages/library/src/classes/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/components/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/composables/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/functions/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/library.ts +0 -0
- package/src/media/templates/packages/library/src/main.ts +0 -6
- package/src/media/templates/packages/library/src/style.scss +0 -0
- package/src/media/templates/packages/library/src/types/_.gitignore.txt +0 -1
- package/src/media/templates/packages/library/src/vite-env.d.ts +0 -1
- package/src/media/templates/packages/library/tsconfig.app.json +0 -11
- package/src/media/templates/packages/library/tsconfig.json +0 -7
- package/src/media/templates/packages/library/tsconfig.node.json +0 -7
- package/src/media/templates/packages/library/vite.config.ts +0 -14
- package/src/media/templates/packages/nitro/README.md +0 -1
- package/src/media/templates/packages/nitro/_.gitignore.txt +0 -28
- package/src/media/templates/packages/nitro/index.html +0 -2
- package/src/media/templates/packages/nitro/package.json +0 -25
- package/src/media/templates/packages/nitro/server/plugins/ui-plugin.ts +0 -7
- package/src/media/templates/packages/nitro/server/routes/api/hello.ts +0 -13
- package/src/media/templates/packages/nitro/src/App.vue +0 -10
- package/src/media/templates/packages/nitro/src/assets/_.gitignore.txt +0 -0
- package/src/media/templates/packages/nitro/src/components/_.gitignore.txt +0 -0
- package/src/media/templates/packages/nitro/src/composables/_.gitignore.txt +0 -0
- package/src/media/templates/packages/nitro/src/entry-client.ts +0 -13
- package/src/media/templates/packages/nitro/src/entry-server.ts +0 -29
- package/src/media/templates/packages/nitro/src/main.ts +0 -14
- package/src/media/templates/packages/nitro/src/pages/HomePage.vue +0 -8
- package/src/media/templates/packages/nitro/src/router.ts +0 -11
- package/src/media/templates/packages/nitro/src/style.scss +0 -0
- package/src/media/templates/packages/nitro/src/templates/main.html +0 -21
- package/src/media/templates/packages/nitro/src/vite-env.d.ts +0 -11
- package/src/media/templates/packages/nitro/tsconfig.app.json +0 -14
- package/src/media/templates/packages/nitro/tsconfig.json +0 -7
- package/src/media/templates/packages/nitro/tsconfig.node.json +0 -12
- package/src/media/templates/packages/nitro/vite.config.ts +0 -17
- package/src/media/templates/packages/project/README.md +0 -1
- package/src/media/templates/packages/project/_.gitignore.txt +0 -28
- package/src/media/templates/packages/project/design.config.json +0 -3
- package/src/media/templates/packages/project/index.html +0 -12
- package/src/media/templates/packages/project/materials/README.md +0 -8
- package/src/media/templates/packages/project/materials/prompt.md +0 -41
- package/src/media/templates/packages/project/package.json +0 -13
- package/src/media/templates/packages/project/public/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/App.vue +0 -12
- package/src/media/templates/packages/project/src/assets/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/components/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/composables/_.gitignore.txt +0 -0
- package/src/media/templates/packages/project/src/main.ts +0 -6
- package/src/media/templates/packages/project/src/style.scss +0 -0
- package/src/media/templates/packages/project/src/vite-env.d.ts +0 -1
- package/src/media/templates/packages/project/tsconfig.app.json +0 -11
- package/src/media/templates/packages/project/tsconfig.json +0 -7
- package/src/media/templates/packages/project/tsconfig.node.json +0 -7
- package/src/media/templates/packages/project/vite.config.ts +0 -7
- package/src/media/templates/prompts/aiCodeGlobalPrompt.en.md +0 -22
- package/src/media/templates/prompts/aiCodeGlobalPrompt.ru.md +0 -21
- package/src/media/templates/prompts/aiCodeVuePrompt.en.md +0 -17
- package/src/media/templates/prompts/aiCodeVuePrompt.ru.md +0 -17
- package/src/media/templates/prompts/aiDocClassPrompt.en.txt +0 -63
- package/src/media/templates/prompts/aiDocClassPrompt.ru.txt +0 -63
- package/src/media/templates/prompts/aiDocComposablePrompt.en.txt +0 -67
- package/src/media/templates/prompts/aiDocComposablePrompt.ru.txt +0 -67
- package/src/media/templates/prompts/aiDocFunctionPrompt.en.txt +0 -57
- package/src/media/templates/prompts/aiDocFunctionPrompt.ru.txt +0 -57
- package/src/media/templates/prompts/componentPrompt.en.txt +0 -182
- package/src/media/templates/prompts/componentPrompt.ru.txt +0 -182
- package/src/media/templates/prompts/demoClassEn.mdx +0 -111
- package/src/media/templates/prompts/demoClassRu.mdx +0 -111
- package/src/media/templates/prompts/demoComponentEn.mdx +0 -282
- package/src/media/templates/prompts/demoComponentRu.mdx +0 -282
- package/src/media/templates/prompts/demoComposableEn.mdx +0 -103
- package/src/media/templates/prompts/demoComposableRu.mdx +0 -103
- package/src/media/templates/prompts/demoDocEn.mdx +0 -30
- package/src/media/templates/prompts/demoDocRu.mdx +0 -30
- package/src/media/templates/viteComponentTemplateConfig.ts +0 -14
- package/src/types/aiTypes.ts +0 -19
- package/src/types/configTypes.ts +0 -69
- package/src/types/designTypes.ts +0 -167
- package/src/types/figmaApiTypes.ts +0 -337
- package/src/types/gitTypes.ts +0 -59
- package/src/types/libraryTypes.ts +0 -49
- package/src/types/propertyTypes.ts +0 -586
- package/src/types/screenshotTypes.ts +0 -55
- package/src/types/webTypes.ts +0 -134
- package/src/vite-env.d.ts +0 -1
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { toArray } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
PropertiesFile,
|
|
7
|
-
type PropertiesFilePath,
|
|
8
|
-
type PropertiesFileValue
|
|
9
|
-
} from './PropertiesFile'
|
|
10
|
-
|
|
11
|
-
const DIR_CACHE = ['.cache']
|
|
12
|
-
const DIR_STEP = ['step']
|
|
13
|
-
const FILE_SYSTEM = 'system'
|
|
14
|
-
|
|
15
|
-
type PropertiesCacheList = Record<string, string[]>
|
|
16
|
-
type PropertiesCacheSystem = {
|
|
17
|
-
time: number
|
|
18
|
-
files: PropertiesCacheList
|
|
19
|
-
sizes: PropertiesCacheList
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Static orchestrator for managing persistent file caching in the design system.
|
|
24
|
-
* Provides a structured mechanism for storing transformed tokens, tracking file dependencies, and ensuring incremental build performance by avoiding redundant processing.
|
|
25
|
-
*
|
|
26
|
-
* Статический оркестратор для управления постоянным файловым кэшированием в дизайн-системе.
|
|
27
|
-
* Предоставляет структурированный механизм для хранения трансформированных токенов, отслеживания зависимостей файлов и обеспечения производительности инкрементальной сборки за счет исключения повторной обработки.
|
|
28
|
-
*/
|
|
29
|
-
export class PropertiesCache {
|
|
30
|
-
private static time = 0
|
|
31
|
-
private static readonly files: PropertiesCacheList = {}
|
|
32
|
-
private static readonly sizes: PropertiesCacheList = {}
|
|
33
|
-
private static readonly listenerName: string[] = ['global']
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Retrieves data from the cache or executes the callback to regenerate and store it if the cache is missing or outdated.
|
|
37
|
-
*
|
|
38
|
-
* Извлекает данные из кэша или выполняет функцию обратного вызова для регенерации и сохранения данных, если кэш отсутствует или устарел.
|
|
39
|
-
* @param path the logical path structure for the cache file/ логическая структура пути для файла кэша
|
|
40
|
-
* @param name the unique identifier for the cache entry/ уникальный идентификатор записи кэша
|
|
41
|
-
* @param callback the generator function to execute on cache miss/ функция-генератор, выполняемая при отсутствии данных в кэше
|
|
42
|
-
* @param extension the file extension, typically 'json'/ расширение файла, обычно 'json'
|
|
43
|
-
*/
|
|
44
|
-
static get<T extends PropertiesFileValue>(
|
|
45
|
-
path: PropertiesFilePath,
|
|
46
|
-
name: string,
|
|
47
|
-
callback: () => T,
|
|
48
|
-
extension = 'json'
|
|
49
|
-
): T {
|
|
50
|
-
if (
|
|
51
|
-
this.is(path, name, extension)
|
|
52
|
-
&& this.isBySystem(name)
|
|
53
|
-
) {
|
|
54
|
-
return this.readFile<T>(path, name, extension) as T
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
this.listenerName.push(name)
|
|
58
|
-
|
|
59
|
-
const value = callback()
|
|
60
|
-
this.writeFile(path, name, value, extension)
|
|
61
|
-
|
|
62
|
-
this.listenerName.pop()
|
|
63
|
-
this.writeSystem()
|
|
64
|
-
|
|
65
|
-
return value
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Directly reads a file and registers it as a dependency for the currently active cache listener.
|
|
70
|
-
*
|
|
71
|
-
* Напрямую читает файл и регистрирует его как зависимость для текущего активного слушателя кэша.
|
|
72
|
-
* @param path the path to the file to be read/ путь к считываемому файлу
|
|
73
|
-
*/
|
|
74
|
-
static read<R>(path: PropertiesFilePath): R | undefined {
|
|
75
|
-
if (PropertiesFile.is(path)) {
|
|
76
|
-
const value = PropertiesFile.joinPath(path)
|
|
77
|
-
|
|
78
|
-
this.listenerName.forEach((name) => {
|
|
79
|
-
if (!(name in this.files)) {
|
|
80
|
-
this.files[name] = [value]
|
|
81
|
-
} else if (this.files?.[name]?.indexOf(value) === -1) {
|
|
82
|
-
this.files[name].push(value)
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return PropertiesFile.readFile<R>(path)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Persists intermediate results to the temporary step-based cache directory.
|
|
92
|
-
*
|
|
93
|
-
* Сохраняет промежуточные результаты во временную директорию пошагового кэша.
|
|
94
|
-
* @param name the name of the cached step result/ название кэшированного результата шага
|
|
95
|
-
* @param value the data structure to persist/ структура данных для сохранения
|
|
96
|
-
*/
|
|
97
|
-
static write<T extends PropertiesFileValue>(name: string, value: T): void {
|
|
98
|
-
this.writeFile<T>(DIR_STEP, name, value)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Recursively removes all cached data from the `.cache` directory.
|
|
103
|
-
*
|
|
104
|
-
* Рекурсивно удаляет все кэшированные данные из директории `.cache`.
|
|
105
|
-
*/
|
|
106
|
-
static clear(): void {
|
|
107
|
-
PropertiesFile.removeDir(this.getPath([]))
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Checks if there are files to read
|
|
112
|
-
*
|
|
113
|
-
* Проверяет наличие файлов для чтения.
|
|
114
|
-
* @param path path to the file/ путь к файлу
|
|
115
|
-
* @param name file name/ название файла
|
|
116
|
-
* @param extension file extension by default is json/ расширение файла по умолчанию - json
|
|
117
|
-
*/
|
|
118
|
-
private static is(
|
|
119
|
-
path: PropertiesFilePath,
|
|
120
|
-
name: string,
|
|
121
|
-
extension = 'json'
|
|
122
|
-
): boolean {
|
|
123
|
-
return PropertiesFile.is(this.getPathName(path, name, extension))
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Checks if there are updated files
|
|
128
|
-
*
|
|
129
|
-
* Проверяет, есть ли обновленные файлы.
|
|
130
|
-
* @param name the name of the cache/ название кэша
|
|
131
|
-
*/
|
|
132
|
-
private static isBySystem(name = 'global'): boolean {
|
|
133
|
-
let notUpdate = true
|
|
134
|
-
|
|
135
|
-
if (name in this.files) {
|
|
136
|
-
this.files?.[name]?.forEach((path) => {
|
|
137
|
-
const stat = PropertiesFile.stat(path)
|
|
138
|
-
|
|
139
|
-
if (stat && stat.mtimeMs > this.time) {
|
|
140
|
-
notUpdate = false
|
|
141
|
-
this.console(`Modified file: ${name}, ${path}`)
|
|
142
|
-
}
|
|
143
|
-
})
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return notUpdate
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Returns the path to the file
|
|
151
|
-
*
|
|
152
|
-
* Возвращает путь к файлу.
|
|
153
|
-
* @param path path to the file/ путь к файлу
|
|
154
|
-
*/
|
|
155
|
-
private static getPath(path: PropertiesFilePath): string[] {
|
|
156
|
-
return [PropertiesFile.getRoot(), ...DIR_CACHE, ...toArray(path)]
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Returns the full path to the file
|
|
161
|
-
*
|
|
162
|
-
* Возвращает полный путь к файлу.
|
|
163
|
-
* @param path path to the file/ путь к файлу
|
|
164
|
-
* @param name file name/ название файла
|
|
165
|
-
* @param extension file extension by default is json/ расширение файла по умолчанию - json
|
|
166
|
-
*/
|
|
167
|
-
private static getPathName(
|
|
168
|
-
path: PropertiesFilePath,
|
|
169
|
-
name: string,
|
|
170
|
-
extension = 'json'
|
|
171
|
-
): string[] {
|
|
172
|
-
return PropertiesFile.getPathFile(this.getPath(path), name, extension)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Reads the content of the file
|
|
177
|
-
*
|
|
178
|
-
* Читает содержимое файла.
|
|
179
|
-
* @param path path to the file/ путь к файлу
|
|
180
|
-
* @param name file name/ название файла
|
|
181
|
-
* @param extension file extension by default is json/ расширение файла по умолчанию - json
|
|
182
|
-
*/
|
|
183
|
-
private static readFile<R>(
|
|
184
|
-
path: PropertiesFilePath,
|
|
185
|
-
name: string,
|
|
186
|
-
extension = 'json'
|
|
187
|
-
): R | undefined {
|
|
188
|
-
return PropertiesFile.readFile<R>(this.getPathName(path, name, extension))
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Writing data to a file
|
|
193
|
-
*
|
|
194
|
-
* Запись данных в файл.
|
|
195
|
-
* @param path path to the file/ путь к файлу
|
|
196
|
-
* @param name file name/ название файла
|
|
197
|
-
* @param value values for storage/ значения для хранения
|
|
198
|
-
* @param extension file extension by default is json/ расширение файла по умолчанию - json
|
|
199
|
-
*/
|
|
200
|
-
private static writeFile<T extends PropertiesFileValue>(
|
|
201
|
-
path: PropertiesFilePath,
|
|
202
|
-
name: string,
|
|
203
|
-
value: T,
|
|
204
|
-
extension = 'json'
|
|
205
|
-
): void {
|
|
206
|
-
PropertiesFile.write(this.getPath(path), name, value, extension)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Updates the system data and writes them. Executes after saving the cache
|
|
211
|
-
*
|
|
212
|
-
* Обновляет системные данные и записывает их. Выполняется после сохранения кэша.
|
|
213
|
-
*/
|
|
214
|
-
private static writeSystem(): void {
|
|
215
|
-
if (this.listenerName.length < 2) {
|
|
216
|
-
this.time = new Date().getTime()
|
|
217
|
-
|
|
218
|
-
const data: PropertiesCacheSystem = {
|
|
219
|
-
time: this.time,
|
|
220
|
-
files: this.files,
|
|
221
|
-
sizes: this.sizes
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
this.writeFile([], FILE_SYSTEM, data)
|
|
225
|
-
this.console('Writes the system data')
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Adding a new message to the console
|
|
231
|
-
*
|
|
232
|
-
* Добавление нового сообщения в консоли.
|
|
233
|
-
* @param text text of the message/ текст сообщения
|
|
234
|
-
*/
|
|
235
|
-
private static console(text: string): void {
|
|
236
|
-
console.info('[Cache]', text)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
static {
|
|
240
|
-
const system = this.readFile<PropertiesCacheSystem>([], FILE_SYSTEM)
|
|
241
|
-
|
|
242
|
-
if (system) {
|
|
243
|
-
this.time = system.time
|
|
244
|
-
Object.assign(this.files, system.files)
|
|
245
|
-
Object.assign(this.sizes, system.sizes)
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { toPathStandardSep } from '../../functions/toPathStandardSep'
|
|
4
|
-
|
|
5
|
-
import { PropertiesFile } from './PropertiesFile'
|
|
6
|
-
|
|
7
|
-
import type { AiType, DesignUiConfig } from '../../types/configTypes'
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
UI_AI_DOC_DIRECTORY,
|
|
11
|
-
UI_AI_DOC_STORYBOOK,
|
|
12
|
-
UI_CONFIG_FILE
|
|
13
|
-
} from '../../config'
|
|
14
|
-
|
|
15
|
-
/**
|
|
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.
|
|
18
|
-
*
|
|
19
|
-
* Статический оркестратор конфигурации для дизайн-системы.
|
|
20
|
-
* Отвечает за поиск, загрузку и слияние файла конфигурации `design-ui.json`, обработку рекурсивных расширений и предоставление централизованного интерфейса для доступа к общепроектным настройкам, включая именование, разделители и параметры интеграции ИИ.
|
|
21
|
-
*/
|
|
22
|
-
export class PropertiesConfig {
|
|
23
|
-
protected static config: DesignUiConfig
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves the global project identifier.
|
|
27
|
-
*
|
|
28
|
-
* Получает глобальный идентификатор проекта.
|
|
29
|
-
*/
|
|
30
|
-
static getProjectName(): string {
|
|
31
|
-
return this.config.project ?? 'ui'
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves the primary design system name.
|
|
36
|
-
*
|
|
37
|
-
* Получает основное название дизайн-системы.
|
|
38
|
-
*/
|
|
39
|
-
static getDesignName(): string {
|
|
40
|
-
return this.config.name ?? 'ui'
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Returns alternative design system aliases.
|
|
45
|
-
*
|
|
46
|
-
* Возвращает альтернативные алиасы дизайн-системы.
|
|
47
|
-
*/
|
|
48
|
-
static getDesignAlternativeName(): string[] | undefined {
|
|
49
|
-
return this.config?.alternativeName
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Returns the token path separator character.
|
|
54
|
-
*
|
|
55
|
-
* Возвращает символ-разделитель пути токена.
|
|
56
|
-
*/
|
|
57
|
-
static getSeparator(): string {
|
|
58
|
-
return this.config.separator ?? '/'
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Returns the identifier for the base level separator.
|
|
63
|
-
*
|
|
64
|
-
* Возвращает идентификатор для базового разделителя.
|
|
65
|
-
*/
|
|
66
|
-
static getSeparatorBasicName(): string {
|
|
67
|
-
return this.config.separatorBasicName ?? 'basic'
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Returns the maximum depth for token path segments.
|
|
72
|
-
*
|
|
73
|
-
* Возвращает максимальную глубину сегментов пути токена.
|
|
74
|
-
*/
|
|
75
|
-
static getSeparatorLimit(): number {
|
|
76
|
-
return this.config.separatorLimit ?? 6
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Returns the primary language for documentation generation.
|
|
81
|
-
*
|
|
82
|
-
* Возвращает основной язык для генерации документации.
|
|
83
|
-
*/
|
|
84
|
-
static getWikiLanguage(): string {
|
|
85
|
-
return this.config.wikiLanguage ?? 'en'
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Returns the prefix for generated npm packages.
|
|
90
|
-
*
|
|
91
|
-
* Возвращает префикс для генерируемых npm-пакетов.
|
|
92
|
-
*/
|
|
93
|
-
static getPackagePrefix(): string | undefined {
|
|
94
|
-
return this.config.packagePrefix ?? undefined
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Returns the configured AI provider type.
|
|
99
|
-
*
|
|
100
|
-
* Возвращает настроенный тип ИИ-провайдера.
|
|
101
|
-
*/
|
|
102
|
-
static getAiType(): AiType {
|
|
103
|
-
return this.config.aiType ?? 'gemini'
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Returns the specific AI model identifier.
|
|
108
|
-
*
|
|
109
|
-
* Возвращает конкретный идентификатор модели ИИ.
|
|
110
|
-
*/
|
|
111
|
-
static getAiModel(): string {
|
|
112
|
-
return this.config.aiModel ?? ''
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Returns the secure API key for AI authentication.
|
|
117
|
-
*
|
|
118
|
-
* Возвращает безопасный API-ключ для аутентификации ИИ.
|
|
119
|
-
*/
|
|
120
|
-
static getAiKey(): string {
|
|
121
|
-
return this.config.aiKey ?? ''
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Returns the Figma access token.
|
|
126
|
-
*
|
|
127
|
-
* Возвращает токен доступа к Figma.
|
|
128
|
-
*/
|
|
129
|
-
static getFigmaToken(): string {
|
|
130
|
-
return this.config.figmaToken ?? ''
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Returns the AI configuration object.
|
|
135
|
-
*
|
|
136
|
-
* Возвращает объект конфигурации ИИ.
|
|
137
|
-
*/
|
|
138
|
-
static getAiConfig(): Record<string, any> {
|
|
139
|
-
return this.config.aiConfig ?? {}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Returns the list of directories targeted for AI-driven documentation.
|
|
144
|
-
*
|
|
145
|
-
* Возвращает список директорий, предназначенных для автоматической документации через ИИ.
|
|
146
|
-
*/
|
|
147
|
-
static getAiDocDirectory(): string[] {
|
|
148
|
-
return this.config.aiDocDirectory ?? UI_AI_DOC_DIRECTORY
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Returns the export path for Storybook-compatible AI documentation.
|
|
153
|
-
*
|
|
154
|
-
* Возвращает путь экспорта для AI-документации, совместимой со Storybook.
|
|
155
|
-
*/
|
|
156
|
-
static getAiDocStorybookPath(): string {
|
|
157
|
-
return this.config.aiDocStorybookPath ?? UI_AI_DOC_STORYBOOK
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Recursively retrieves and merges extended configuration files.
|
|
162
|
-
*
|
|
163
|
-
* Рекурсивно получает и объединяет расширенные файлы конфигурации.
|
|
164
|
-
* @param file path to the configuration file/ путь к файлу конфигурации
|
|
165
|
-
* @param dir array of directory paths/ массив путей директорий
|
|
166
|
-
*/
|
|
167
|
-
protected static getExtends(
|
|
168
|
-
file: string,
|
|
169
|
-
dir: string[] = []
|
|
170
|
-
): DesignUiConfig {
|
|
171
|
-
const path = [...dir, toPathStandardSep(file)]
|
|
172
|
-
const read = PropertiesFile.readFile<DesignUiConfig>(path)
|
|
173
|
-
|
|
174
|
-
if (read?.extends) {
|
|
175
|
-
return {
|
|
176
|
-
...this.getExtends(
|
|
177
|
-
read.extends,
|
|
178
|
-
[PropertiesFile.getPathDir(path)]
|
|
179
|
-
),
|
|
180
|
-
...read
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return read ?? ({} as DesignUiConfig)
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
static {
|
|
188
|
-
const paths: string[] = [UI_CONFIG_FILE]
|
|
189
|
-
this.config = {} as DesignUiConfig
|
|
190
|
-
|
|
191
|
-
for (let i = 0; i < 32; i++) {
|
|
192
|
-
if (PropertiesFile.is(paths)) {
|
|
193
|
-
let file = PropertiesFile.readFile<DesignUiConfig>(paths)
|
|
194
|
-
|
|
195
|
-
if (file) {
|
|
196
|
-
if (
|
|
197
|
-
file?.extends
|
|
198
|
-
) {
|
|
199
|
-
file = {
|
|
200
|
-
...this.getExtends(file.extends, [PropertiesFile.getPathDir(paths)]),
|
|
201
|
-
...file
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
this.config = file
|
|
206
|
-
break
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
paths.unshift('..')
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { forEach, isObjectNotArray } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { convectorColor } from './convector/convectorColor'
|
|
6
|
-
import { convectorShadow } from './convector/convectorShadow'
|
|
7
|
-
import { convectorFontFamilies } from './convector/convectorFontFamilies'
|
|
8
|
-
import { convectorTypography } from './convector/convectorTypography'
|
|
9
|
-
|
|
10
|
-
import type { PropertyItemInput, PropertyListOrData } from '../../types/propertyTypes'
|
|
11
|
-
|
|
12
|
-
const LIST: Record<string, (item: PropertyItemInput) => void> = {
|
|
13
|
-
boxShadow: convectorShadow,
|
|
14
|
-
color: convectorColor,
|
|
15
|
-
fontFamilies: convectorFontFamilies,
|
|
16
|
-
typography: convectorTypography
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
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
|
-
* Этот класс координирует преобразование необработанных значений свойств в специализированные форматы дизайна (например, обработка цвета, синтез типографики, нормализация теней), распределяя элементы по конкретным конвертерам на основе их типа метаданных.
|
|
25
|
-
*/
|
|
26
|
-
export class PropertiesConvector {
|
|
27
|
-
/**
|
|
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.
|
|
30
|
-
*
|
|
31
|
-
* Рекурсивно преобразует списки свойств или отдельные структуры данных.
|
|
32
|
-
* Определяет тип свойства и применяет соответствующий специализированный конвертер, если он доступен, или продолжает рекурсивный обход для вложенных объектов.
|
|
33
|
-
* @param properties the property cluster to be transformed / кластер свойств для преобразования
|
|
34
|
-
*/
|
|
35
|
-
static to(properties: PropertyListOrData): void {
|
|
36
|
-
forEach(properties, (item) => {
|
|
37
|
-
if (
|
|
38
|
-
item?.type
|
|
39
|
-
&& item.type in LIST
|
|
40
|
-
) {
|
|
41
|
-
LIST[item.type]?.(item)
|
|
42
|
-
} else if (
|
|
43
|
-
item?.value
|
|
44
|
-
&& isObjectNotArray(item.value)
|
|
45
|
-
) {
|
|
46
|
-
this.to(item.value)
|
|
47
|
-
} else if (isObjectNotArray(item)) {
|
|
48
|
-
this.to(item)
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
}
|