@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,261 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { forEach, isObjectNotArray } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesItems } from './PropertiesItems'
|
|
6
|
-
import { PropertiesPalette } from './PropertiesPalette'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
PropertyCategory,
|
|
10
|
-
type PropertyItem,
|
|
11
|
-
PropertyKey, PropertyType
|
|
12
|
-
} from '../../types/propertyTypes'
|
|
13
|
-
|
|
14
|
-
const NAME_DESIGNS = 'setDesignsDesigns'
|
|
15
|
-
const NAME_ROOT = 'setDesignsRoot'
|
|
16
|
-
const NAME_MEDIA = 'setDesignsMedia'
|
|
17
|
-
const NAME_CLASSES = 'setDesignsClasses'
|
|
18
|
-
const NAME_PALETTE = 'setDesignsPalette'
|
|
19
|
-
const NAME_SHADE = 'setDesignShade'
|
|
20
|
-
const NAME_PROPERTIES = 'setDesignsProperties'
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Class for generating SCSS structures from design tokens.
|
|
24
|
-
*
|
|
25
|
-
* Класс для генерации структур SCSS из токенов дизайна.
|
|
26
|
-
*/
|
|
27
|
-
export class PropertiesScss {
|
|
28
|
-
/**
|
|
29
|
-
* Constructor for initializing the SCSS generator.
|
|
30
|
-
*
|
|
31
|
-
* Конструктор для инициализации генератора SCSS.
|
|
32
|
-
* @param items property management instance / экземпляр управления свойствами
|
|
33
|
-
*/
|
|
34
|
-
constructor(private items: PropertiesItems) {
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Returns a complete SCSS formatted string containing all configuration mixins.
|
|
39
|
-
*
|
|
40
|
-
* Возвращает полную отформатированную строку SCSS, содержащую все миксины конфигурации.
|
|
41
|
-
*/
|
|
42
|
-
get() {
|
|
43
|
-
let data = '@use "@dxtmisha/styles" as variables;\r\n\r\n'
|
|
44
|
-
|
|
45
|
-
data += `${this.getDesigns()}\r\n`
|
|
46
|
-
data += `${this.getRoot()}\r\n`
|
|
47
|
-
data += `${this.getMedia()}\r\n`
|
|
48
|
-
data += `${this.getClasses()}\r\n`
|
|
49
|
-
data += `${this.getPalette()}\r\n`
|
|
50
|
-
data += `${this.getShade()}\r\n`
|
|
51
|
-
data += `${this.getProperties()}\r\n`
|
|
52
|
-
|
|
53
|
-
return data
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns a list of connected designs.
|
|
58
|
-
*
|
|
59
|
-
* Возвращает список подключенных дизайнов.
|
|
60
|
-
*/
|
|
61
|
-
protected getDesigns(): string {
|
|
62
|
-
const designs = forEach(this.items.getDesigns(), design => `\r\n '${design}',`)
|
|
63
|
-
return this.getPropertiesValue(NAME_DESIGNS, designs.join(''))
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Returns a list of properties for the root.
|
|
68
|
-
*
|
|
69
|
-
* Возвращает список свойств для root.
|
|
70
|
-
*/
|
|
71
|
-
protected getRoot(): string {
|
|
72
|
-
return this.getPropertiesValue(NAME_ROOT, this.getByCategory(PropertyCategory.root))
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Returns a list of device sizes.
|
|
77
|
-
*
|
|
78
|
-
* Возвращает список размеров устройства.
|
|
79
|
-
*/
|
|
80
|
-
protected getMedia(): string {
|
|
81
|
-
let data = ''
|
|
82
|
-
|
|
83
|
-
forEach(this.items.getMedia(), (
|
|
84
|
-
values,
|
|
85
|
-
design
|
|
86
|
-
) => {
|
|
87
|
-
if (isObjectNotArray(values)) {
|
|
88
|
-
forEach(values, (
|
|
89
|
-
item,
|
|
90
|
-
name
|
|
91
|
-
) => {
|
|
92
|
-
data += `\r\n '${design}-${name}': ${this.getValueItem(item)},`
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
return this.getPropertiesValue(NAME_MEDIA, data)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Returns a list of all classes for generation.
|
|
102
|
-
*
|
|
103
|
-
* Возвращает список всех классов для генерации.
|
|
104
|
-
*/
|
|
105
|
-
protected getClasses(): string {
|
|
106
|
-
return this.getPropertiesValue(NAME_CLASSES, this.getByCategory(['class', 'theme']))
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Returns a list of colors.
|
|
111
|
-
*
|
|
112
|
-
* Возвращает список цветов.
|
|
113
|
-
*/
|
|
114
|
-
protected getPalette(): string {
|
|
115
|
-
let data = ''
|
|
116
|
-
|
|
117
|
-
new PropertiesPalette(this.items)
|
|
118
|
-
.getUsed()
|
|
119
|
-
.forEach(({
|
|
120
|
-
name,
|
|
121
|
-
value
|
|
122
|
-
}) => {
|
|
123
|
-
data += `\r\n '${name}': ('${value.join('\', \'')}'),`
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
return this.getPropertiesValue(NAME_PALETTE, data)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Returns a list of color saturation codes.
|
|
131
|
-
*
|
|
132
|
-
* Возвращает список кодов насыщенности цветов.
|
|
133
|
-
*/
|
|
134
|
-
protected getShade(): string {
|
|
135
|
-
let data = ''
|
|
136
|
-
|
|
137
|
-
new PropertiesPalette(this.items)
|
|
138
|
-
.getShade()
|
|
139
|
-
.forEach(({
|
|
140
|
-
design,
|
|
141
|
-
value
|
|
142
|
-
}) => {
|
|
143
|
-
data += `\r\n '${design}': (${value.join(',')}),`
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
return this.getPropertiesValue(NAME_SHADE, data)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Generates a SCSS map structure for all identified properties.
|
|
151
|
-
*
|
|
152
|
-
* Генерирует структуру карты SCSS для всех определенных свойств.
|
|
153
|
-
*/
|
|
154
|
-
getProperties(): string {
|
|
155
|
-
return this.getPropertiesValue(NAME_PROPERTIES, this.to())
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Returns a list of all records with the selected type.
|
|
160
|
-
*
|
|
161
|
-
* Возвращает список всех записей с выбранным типом.
|
|
162
|
-
* @param category category names/ названия категорий
|
|
163
|
-
*/
|
|
164
|
-
private getByCategory(category: string | string[]): string {
|
|
165
|
-
const data: string[] = []
|
|
166
|
-
|
|
167
|
-
this.items.findCategory(category)
|
|
168
|
-
.forEach(property => data.push(`\r\n '${property.index}',`))
|
|
169
|
-
|
|
170
|
-
return data.join('')
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Returns the property value.
|
|
175
|
-
*
|
|
176
|
-
* Возвращает значение свойства.
|
|
177
|
-
* @param property property value/ значение свойства
|
|
178
|
-
* @param space пробелы
|
|
179
|
-
*/
|
|
180
|
-
private getValue(property: PropertyItem, space: string) {
|
|
181
|
-
if (isObjectNotArray(property.value)) {
|
|
182
|
-
return `value: (${this.to(property.value, `${space} `)}\r\n${space} ),`
|
|
183
|
-
} else if (Array.isArray(property.value)) {
|
|
184
|
-
return `value: (${property.value.join(', ')}),`
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return `value: ${this.getValueItem(property)},`
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Returns the value of a property.
|
|
192
|
-
*
|
|
193
|
-
* Возвращает значение свойства.
|
|
194
|
-
* @param item property value/ значение свойства
|
|
195
|
-
*/
|
|
196
|
-
private getValueItem(item: PropertyItem): string {
|
|
197
|
-
const value = item?.[PropertyKey.css] || item.value
|
|
198
|
-
|
|
199
|
-
if (typeof value === 'string') {
|
|
200
|
-
if (
|
|
201
|
-
value.match(/^#[a-zA-Z0-9]+$/)
|
|
202
|
-
|| value.match(/^([0-9]+|([0-9]+\.[0-9]+))(px|em|rem|vw|vh|%|)$/)
|
|
203
|
-
) {
|
|
204
|
-
return `${value}`
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return `'${value}'`
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return ''
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
private getPropertiesValue(name: string, data: string) {
|
|
214
|
-
return `@include variables.${name}((${data}));`
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Method for iterating over all properties and converting them to a SCSS structure.
|
|
219
|
-
*
|
|
220
|
-
* Метод для обхода всех свойств и преобразования их в структуру SCSS.
|
|
221
|
-
* @param properties list of properties/ свойств
|
|
222
|
-
* @param space пробелы
|
|
223
|
-
*/
|
|
224
|
-
private to(
|
|
225
|
-
properties = this.items.get(),
|
|
226
|
-
space = ' '
|
|
227
|
-
) {
|
|
228
|
-
let data = ''
|
|
229
|
-
|
|
230
|
-
forEach(properties, (property, name) => {
|
|
231
|
-
if (
|
|
232
|
-
property?.value
|
|
233
|
-
&& property?.[PropertyKey.variable] !== 'none'
|
|
234
|
-
) {
|
|
235
|
-
data += `\r\n${space}'${name}':(`
|
|
236
|
-
data += `\r\n${space} index: '${name}',`
|
|
237
|
-
data += `\r\n${space} name: '${property?.[PropertyKey.name] || name}',`
|
|
238
|
-
data += `\r\n${space} type: '${property?.[PropertyKey.variable]}',`
|
|
239
|
-
|
|
240
|
-
if (
|
|
241
|
-
property?.[PropertyKey.category]
|
|
242
|
-
|| property?.[PropertyKey.variable] !== PropertyType.component
|
|
243
|
-
) {
|
|
244
|
-
data += `\r\n${space} ${this.getValue(property, space)}`
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (property?.[PropertyKey.modification] === false) {
|
|
248
|
-
data += `\r\n${space} modification: false,`
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (property?.[PropertyKey.varKey] === true) {
|
|
252
|
-
data += `\r\n${space} var: true,`
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
data += `\r\n${space}),`
|
|
256
|
-
}
|
|
257
|
-
})
|
|
258
|
-
|
|
259
|
-
return data
|
|
260
|
-
}
|
|
261
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { forEach, isObjectNotArray, replaceRecursive } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesConfig } from './PropertiesConfig'
|
|
6
|
-
import { PropertiesKeys } from './PropertiesKeys'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
type PropertyItem,
|
|
10
|
-
PropertyKey,
|
|
11
|
-
type PropertyList
|
|
12
|
-
} from '../../types/propertyTypes'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Class for handling the splitting of property names with separators into nested sub-properties.
|
|
16
|
-
*
|
|
17
|
-
* Класс для работы с разделением названий свойств с разделителями на вложенные под-свойства.
|
|
18
|
-
*/
|
|
19
|
-
export class PropertiesSeparator {
|
|
20
|
-
/**
|
|
21
|
-
* Checks if the property list contains any keys that require splitting (contain separators).
|
|
22
|
-
*
|
|
23
|
-
* Проверяет, содержит ли список свойств ключи, требующие разделения (содержащие разделители).
|
|
24
|
-
* @param properties list of properties to check / список свойств для проверки
|
|
25
|
-
* @param limit maximum recursion depth for verification / максимальная глубина рекурсии для проверки
|
|
26
|
-
*/
|
|
27
|
-
static is(
|
|
28
|
-
properties: PropertyList,
|
|
29
|
-
limit = PropertiesConfig.getSeparatorLimit()
|
|
30
|
-
): boolean {
|
|
31
|
-
if (limit > 0) {
|
|
32
|
-
for (const index in properties) {
|
|
33
|
-
if (PropertiesKeys.isSeparator(index)) {
|
|
34
|
-
return true
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const value = properties?.[index]?.value
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
value
|
|
41
|
-
&& isObjectNotArray(value)
|
|
42
|
-
&& this.is(value, limit - 1)
|
|
43
|
-
) {
|
|
44
|
-
return true
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return false
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Transforms properties with separator-containing keys into a nested object structure.
|
|
54
|
-
*
|
|
55
|
-
* Преобразует свойства с ключами, содержащими разделители, во вложенную структуру объектов.
|
|
56
|
-
* @param properties the property list to transform / список свойств для преобразования
|
|
57
|
-
*/
|
|
58
|
-
static to(properties: PropertyList): PropertyList {
|
|
59
|
-
let data: PropertyList = {}
|
|
60
|
-
|
|
61
|
-
forEach(properties, (item, name) => {
|
|
62
|
-
const newItem: PropertyItem = {
|
|
63
|
-
...item,
|
|
64
|
-
value: isObjectNotArray(item.value) ? this.to(item.value) : item.value
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (PropertiesKeys.isSeparator(name)) {
|
|
68
|
-
data = replaceRecursive(data, this.wrap(newItem, this.removeBasicName(name)))
|
|
69
|
-
} else {
|
|
70
|
-
data = replaceRecursive(data, { [name]: newItem })
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
return data
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Removing unnecessary characters from the name.
|
|
79
|
-
*
|
|
80
|
-
* Удаление лишних символов из названия.
|
|
81
|
-
* @param name property names/ названия свойств
|
|
82
|
-
*/
|
|
83
|
-
private static removeBasicName(name: string): string[] {
|
|
84
|
-
const separator = PropertiesConfig.getSeparator()
|
|
85
|
-
const basicName = PropertiesConfig.getSeparatorBasicName()
|
|
86
|
-
|
|
87
|
-
return name
|
|
88
|
-
.replace(new RegExp(`${separator}${basicName}`, 'g'), '')
|
|
89
|
-
.replace(new RegExp(`${separator}$`), '')
|
|
90
|
-
.split(separator)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Packs a property into objects by an array of titles.
|
|
95
|
-
*
|
|
96
|
-
* Упаковывает свойство в объекты по массиву названий.
|
|
97
|
-
* @param item property values/ значения свойств
|
|
98
|
-
* @param list array of titles/ массив названий
|
|
99
|
-
*/
|
|
100
|
-
private static wrap(item: PropertyItem, list: string[]): PropertyList {
|
|
101
|
-
let data = item;
|
|
102
|
-
|
|
103
|
-
[...list]
|
|
104
|
-
.reverse()
|
|
105
|
-
.forEach((name) => {
|
|
106
|
-
data = {
|
|
107
|
-
value: {
|
|
108
|
-
[name]: {
|
|
109
|
-
...data,
|
|
110
|
-
[PropertyKey.wrap]: true
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
return data.value as PropertyList
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { isFilled, replaceRecursive, toKebabCase } from '@dxtmisha/functional-basic'
|
|
4
|
-
import { getConstructorProperties } from '../../functions/getConstructorProperties'
|
|
5
|
-
|
|
6
|
-
import { PropertiesConfig } from './PropertiesConfig'
|
|
7
|
-
import { PropertiesFile } from './PropertiesFile'
|
|
8
|
-
import { PropertiesPath } from './PropertiesPath'
|
|
9
|
-
import { PropertiesStandard } from './PropertiesStandard'
|
|
10
|
-
import { PropertiesTool } from './PropertiesTool'
|
|
11
|
-
|
|
12
|
-
import { type PropertyList } from '../../types/propertyTypes'
|
|
13
|
-
|
|
14
|
-
import { UI_DIRS_COMPONENTS, UI_DIRS_CONSTRUCTOR, UI_KEY_CONSTRUCTOR } from '../../config'
|
|
15
|
-
|
|
16
|
-
const DIR_NAME = 'settings'
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Class for searching and loading global component settings.
|
|
20
|
-
*
|
|
21
|
-
* Класс для поиска и загрузки глобальных настроек компонентов.
|
|
22
|
-
*/
|
|
23
|
-
export class PropertiesSettings {
|
|
24
|
-
/**
|
|
25
|
-
* Constructor for initializing the settings resolver.
|
|
26
|
-
*
|
|
27
|
-
* Конструктор для инициализации резолвера настроек.
|
|
28
|
-
* @param path path handler instance / экземпляр обработчика путей
|
|
29
|
-
*/
|
|
30
|
-
constructor(
|
|
31
|
-
private readonly path: PropertiesPath
|
|
32
|
-
) {
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Returns a unified list of settings for all identified components and constructors.
|
|
37
|
-
*
|
|
38
|
-
* Возвращает унифицированный список настроек для всех определенных компонентов и конструкторов.
|
|
39
|
-
*/
|
|
40
|
-
get(): PropertyList {
|
|
41
|
-
return {
|
|
42
|
-
...this.getComponents(),
|
|
43
|
-
...this.getConstructors()
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Returns a list of available components.
|
|
49
|
-
*
|
|
50
|
-
* Возвращает список доступных компонентов.
|
|
51
|
-
*/
|
|
52
|
-
protected getComponentList(): string[] {
|
|
53
|
-
const list: string[] = []
|
|
54
|
-
let paths: string[] = [
|
|
55
|
-
...UI_DIRS_COMPONENTS,
|
|
56
|
-
PropertiesConfig.getProjectName()
|
|
57
|
-
]
|
|
58
|
-
|
|
59
|
-
if (this.path.isConstructor()) {
|
|
60
|
-
paths = [...UI_DIRS_CONSTRUCTOR]
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
PropertiesFile.readDir(paths).forEach(dir => list.push(dir))
|
|
64
|
-
|
|
65
|
-
return list
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Returns a list of design system components.
|
|
70
|
-
*
|
|
71
|
-
* Возвращает список компонентов дизайн-системы.
|
|
72
|
-
*/
|
|
73
|
-
protected getComponents(): PropertyList {
|
|
74
|
-
return this.path.toAll(DIR_NAME, (
|
|
75
|
-
_,
|
|
76
|
-
path,
|
|
77
|
-
design
|
|
78
|
-
) => {
|
|
79
|
-
let data: PropertyList = {}
|
|
80
|
-
|
|
81
|
-
if (path) {
|
|
82
|
-
PropertiesFile.readDir(path).forEach((dir) => {
|
|
83
|
-
const properties = PropertiesTool.readFile(design, [...path, dir])
|
|
84
|
-
|
|
85
|
-
if (isFilled(properties)) {
|
|
86
|
-
data = replaceRecursive(data, PropertiesStandard.to({
|
|
87
|
-
[design]: {
|
|
88
|
-
[toKebabCase(dir)]: properties
|
|
89
|
-
}
|
|
90
|
-
}))
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return data
|
|
96
|
-
}) as PropertyList
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
protected getConstructors(): PropertyList {
|
|
100
|
-
return PropertiesStandard.to({
|
|
101
|
-
[UI_KEY_CONSTRUCTOR]: getConstructorProperties(this.getComponentList())
|
|
102
|
-
}) as any as PropertyList
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { forEach, isFilled, isObjectNotArray, replaceRecursive } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesKeys } from './PropertiesKeys'
|
|
6
|
-
import { PropertiesTypes } from './PropertiesTypes'
|
|
7
|
-
import { PropertiesValues } from './PropertiesValues'
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
type PropertyItem,
|
|
11
|
-
type PropertyItemInput,
|
|
12
|
-
type PropertyItemPartial,
|
|
13
|
-
PropertyKey,
|
|
14
|
-
type PropertyList,
|
|
15
|
-
type PropertyListOrData
|
|
16
|
-
} from '../../types/propertyTypes'
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Class for transforming raw property data into a standardized structure for internal processing.
|
|
20
|
-
*
|
|
21
|
-
* Класс для преобразования сырых данных свойств в стандартизированную структуру для внутренней обработки.
|
|
22
|
-
*/
|
|
23
|
-
export class PropertiesStandard {
|
|
24
|
-
/**
|
|
25
|
-
* Transforms a property list or raw data into a standardized PropertyList structure.
|
|
26
|
-
*
|
|
27
|
-
* Преобразует список свойств или сырые данные в стандартизированную структуру PropertyList.
|
|
28
|
-
* @param properties the property list or data to transform / список свойств или данные для преобразования
|
|
29
|
-
*/
|
|
30
|
-
static to(properties: PropertyListOrData): PropertyList {
|
|
31
|
-
const data: PropertyList = {}
|
|
32
|
-
|
|
33
|
-
forEach(properties, (item, index) => {
|
|
34
|
-
const newItem = this.getItem(index, item)
|
|
35
|
-
const key = PropertiesKeys.reKey(index, newItem?.[PropertyKey.type])
|
|
36
|
-
|
|
37
|
-
if (isObjectNotArray(newItem.value)) {
|
|
38
|
-
newItem.value = this.to(newItem.value)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
this.addValue(newItem)
|
|
42
|
-
|
|
43
|
-
newItem[PropertyKey.index] = index.replace(/^=/, '')
|
|
44
|
-
|
|
45
|
-
if (key in newItem) {
|
|
46
|
-
data[key] = replaceRecursive(data[key] ?? {}, newItem) as PropertyItem
|
|
47
|
-
} else {
|
|
48
|
-
data[key] = newItem
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
return data
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* We get the values that have been updated.
|
|
57
|
-
*
|
|
58
|
-
* Получаем доработанные значения.
|
|
59
|
-
* @param name key name/ название ключа
|
|
60
|
-
* @param item values for conversion/ значения для преобразования
|
|
61
|
-
*/
|
|
62
|
-
private static getItem(
|
|
63
|
-
name: string,
|
|
64
|
-
item: PropertyItemInput
|
|
65
|
-
): PropertyItem {
|
|
66
|
-
const newItem = this.toItem(item)
|
|
67
|
-
|
|
68
|
-
this.addType(name, newItem)
|
|
69
|
-
this.addFull(name, newItem)
|
|
70
|
-
|
|
71
|
-
return newItem as PropertyItem
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Separate a special property from regular values.
|
|
76
|
-
*
|
|
77
|
-
* Разделить специальное свойство от обычных значений.
|
|
78
|
-
* @param property an array that needs to be transformed/
|
|
79
|
-
* массив, который нужно преобразовать
|
|
80
|
-
*/
|
|
81
|
-
private static getValueAndSpecial(property: PropertyItemInput): PropertyItemPartial {
|
|
82
|
-
const data: Record<string, any> = {
|
|
83
|
-
value: property?.value || {}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
forEach(property, (item, name) => {
|
|
87
|
-
if (PropertiesKeys.isSpecialKey(name)) {
|
|
88
|
-
data[name] = item
|
|
89
|
-
} else {
|
|
90
|
-
data.value[name] = item as PropertyItemPartial['value']
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
return data
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Adds the type if it exists.
|
|
99
|
-
*
|
|
100
|
-
* Добавляет тип, если есть.
|
|
101
|
-
* @param name key name/ название ключа
|
|
102
|
-
* @param item values for conversion/ значения для преобразования
|
|
103
|
-
*/
|
|
104
|
-
private static addType(
|
|
105
|
-
name: string,
|
|
106
|
-
item: PropertyItemPartial
|
|
107
|
-
): void {
|
|
108
|
-
if (!(PropertyKey.type in item)) {
|
|
109
|
-
const type = PropertiesTypes.getTypeInName(name)
|
|
110
|
-
|
|
111
|
-
if (type) {
|
|
112
|
-
item[PropertyKey.type] = type
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Adds a label that the property name is the final version and does not require additional processing.
|
|
119
|
-
*
|
|
120
|
-
* Добавляет метку, что имя свойства является финальной версией и не требует дополнительной обработки.
|
|
121
|
-
* @param name key name/ название ключа
|
|
122
|
-
* @param item values for conversion/ значения для преобразования
|
|
123
|
-
*/
|
|
124
|
-
private static addFull(
|
|
125
|
-
name: string,
|
|
126
|
-
item: PropertyItemPartial
|
|
127
|
-
): void {
|
|
128
|
-
if (PropertiesKeys.isFull(name)) {
|
|
129
|
-
item[PropertyKey.fullName] = true
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (
|
|
133
|
-
typeof item.value === 'string' && (
|
|
134
|
-
PropertiesValues.isFull(item.value)
|
|
135
|
-
|| name.match(/aspect/i)
|
|
136
|
-
)
|
|
137
|
-
) {
|
|
138
|
-
item[PropertyKey.fullValue] = true
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Converts values to string, if they are of type number.
|
|
144
|
-
*
|
|
145
|
-
* Преобразовывает значения в строку, если являются типом число.
|
|
146
|
-
* @param item values for conversion/ значения для преобразования
|
|
147
|
-
* @private
|
|
148
|
-
*/
|
|
149
|
-
private static addValue(item: PropertyItemPartial): void {
|
|
150
|
-
item.value = PropertiesValues.reValue(item.value)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Transform the property value into the required format.
|
|
155
|
-
*
|
|
156
|
-
* Преобразовать значение свойства в необходимый формат.
|
|
157
|
-
* @param value values for conversion/ значения для преобразования
|
|
158
|
-
*/
|
|
159
|
-
private static toItem(value: PropertyItemPartial['value']): PropertyItemPartial {
|
|
160
|
-
if (
|
|
161
|
-
typeof value !== 'object'
|
|
162
|
-
|| Array.isArray(value)
|
|
163
|
-
) {
|
|
164
|
-
return { value } as PropertyItemPartial
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (isFilled(value)) {
|
|
168
|
-
if (
|
|
169
|
-
!('value' in value)
|
|
170
|
-
|| isObjectNotArray(value.value)
|
|
171
|
-
) {
|
|
172
|
-
return this.getValueAndSpecial(value)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return value
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return { value: {} }
|
|
179
|
-
}
|
|
180
|
-
}
|