@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,80 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { copyObject, toCamelCase } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesConfig } from './PropertiesConfig'
|
|
6
|
-
import { PropertiesCache } from './PropertiesCache'
|
|
7
|
-
|
|
8
|
-
import type { PropertyList } from '../../types/propertyTypes'
|
|
9
|
-
|
|
10
|
-
import basicProperties from '../../media/properties.json'
|
|
11
|
-
|
|
12
|
-
import { UI_KEY_CONSTRUCTOR, UI_FILE_PROPERTY } from '../../config'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Utility class for naming components and reading design system property files.
|
|
16
|
-
*
|
|
17
|
-
* Утилитарный класс для именования компонентов и чтения файлов свойств дизайн-системы.
|
|
18
|
-
*/
|
|
19
|
-
export class PropertiesTool {
|
|
20
|
-
/**
|
|
21
|
-
* Checks if the design name identifies as a constructor.
|
|
22
|
-
*
|
|
23
|
-
* Проверяет, идентифицирует ли название дизайна конструктор.
|
|
24
|
-
* @param design design name / название дизайна
|
|
25
|
-
*/
|
|
26
|
-
static isConstructor(design: string): boolean {
|
|
27
|
-
return design === UI_KEY_CONSTRUCTOR
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* This method returns the names of designs from the environment variable (env).
|
|
32
|
-
*
|
|
33
|
-
* Данный метод возвращает названия дизайнов из переменной окружения (env)
|
|
34
|
-
*/
|
|
35
|
-
static getDesigns(): string[] {
|
|
36
|
-
return [UI_KEY_CONSTRUCTOR, PropertiesConfig.getDesignName()]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Generates a camelCase component name string based on design and component name.
|
|
41
|
-
*
|
|
42
|
-
* Генерирует строку названия компонента в стиле camelCase на основе дизайна и названия компонента.
|
|
43
|
-
* @param design design name / название дизайна
|
|
44
|
-
* @param component component name / название компонента
|
|
45
|
-
*/
|
|
46
|
-
static getComponentName(design: string, component?: string): string {
|
|
47
|
-
return `${design}${component ? `-${toCamelCase(component)}` : ''}`
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Getting the component name.
|
|
52
|
-
*
|
|
53
|
-
* Получения названия компонента.
|
|
54
|
-
* @param design design name/ название дизайна
|
|
55
|
-
* @param component component name/ название компонента
|
|
56
|
-
*/
|
|
57
|
-
static getClassName(design: string, component?: string): string {
|
|
58
|
-
return `.${this.getComponentName(design, component)}`
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Reads a property list from a specified path, with special handling for constructors.
|
|
63
|
-
*
|
|
64
|
-
* Считывает список свойств по указанному пути с особой обработкой для конструкторов.
|
|
65
|
-
* @param design design name / название дизайна
|
|
66
|
-
* @param path array representing the directory path / массив, представляющий путь к директории
|
|
67
|
-
*/
|
|
68
|
-
static readFile(
|
|
69
|
-
design: string,
|
|
70
|
-
path: string[] | undefined
|
|
71
|
-
): PropertyList | undefined {
|
|
72
|
-
if (PropertiesTool.isConstructor(design)) {
|
|
73
|
-
return copyObject(basicProperties) as any as PropertyList
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (path) {
|
|
77
|
-
return PropertiesCache.read<PropertyList>([...path, UI_FILE_PROPERTY])
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { isFilled, isSelected, toKebabCase } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
type PropertyItem,
|
|
7
|
-
PropertyType
|
|
8
|
-
} from '../../types/propertyTypes'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Utility class for identifying and managing property types based on naming conventions and symbols.
|
|
12
|
-
*
|
|
13
|
-
* Утилитарный класс для идентификации и управления типами свойств на основе соглашений об именовании и символов.
|
|
14
|
-
*/
|
|
15
|
-
export class PropertiesTypes {
|
|
16
|
-
private static readonly SYMBOLS: Record<string, string> = {
|
|
17
|
-
'$': PropertyType.var,
|
|
18
|
-
'::': PropertyType.virtual,
|
|
19
|
-
':': PropertyType.selector,
|
|
20
|
-
'~': PropertyType.state,
|
|
21
|
-
'#': PropertyType.subclass,
|
|
22
|
-
'@@': PropertyType.linkClass,
|
|
23
|
-
'@': PropertyType.link,
|
|
24
|
-
'&&': PropertyType.root,
|
|
25
|
-
'&': PropertyType.scss,
|
|
26
|
-
'--': PropertyType.none
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Checks if the property type matches the specified list of allowed types.
|
|
31
|
-
*
|
|
32
|
-
* Проверяет, соответствует ли тип свойства указанному списку разрешенных типов.
|
|
33
|
-
* @param type current property type / текущий тип свойства
|
|
34
|
-
* @param name list of allowed types / список разрешенных типов
|
|
35
|
-
*/
|
|
36
|
-
static isInType(
|
|
37
|
-
type?: PropertyItem['_type'],
|
|
38
|
-
name?: PropertyType[]
|
|
39
|
-
): boolean {
|
|
40
|
-
if (
|
|
41
|
-
isFilled(type)
|
|
42
|
-
&& isFilled(name)
|
|
43
|
-
) {
|
|
44
|
-
return Boolean(isSelected(type, name))
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return false
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Determines if the property name contains a type-identifying symbol or specific prefix.
|
|
52
|
-
*
|
|
53
|
-
* Определяет, содержит ли название свойства символ-идентификатор типа или специфический префикс.
|
|
54
|
-
* @param name property key name / название ключа свойства
|
|
55
|
-
*/
|
|
56
|
-
static isTypeInName(name: string): boolean {
|
|
57
|
-
return Boolean(name.match(this.getExpSymbols()))
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Checks if it is a media type.
|
|
62
|
-
*
|
|
63
|
-
* Проверяет, если в тип медиа.
|
|
64
|
-
* @param type list of types/ список типы
|
|
65
|
-
*/
|
|
66
|
-
static isMedia(type: PropertyItem['_type']): boolean {
|
|
67
|
-
return this.isInType(type, [PropertyType.media, PropertyType.mediaMax])
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Checks if it is a container type.
|
|
72
|
-
*
|
|
73
|
-
* Проверяет, если в тип контейнера.
|
|
74
|
-
* @param type list of types/ список типы
|
|
75
|
-
*/
|
|
76
|
-
static isContainer(type: PropertyItem['_type']): boolean {
|
|
77
|
-
return this.isInType(type, [PropertyType.container, PropertyType.containerMax])
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Is the property a SCSS selector.
|
|
82
|
-
*
|
|
83
|
-
* Является ли свойство выборки SCSS.
|
|
84
|
-
* @param name key name/ название ключа
|
|
85
|
-
*/
|
|
86
|
-
static isScss(name: string): boolean {
|
|
87
|
-
return name === PropertyType.scss || Boolean(name.match(/^&(?!&)/))
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Is the property extraction SCSS for @at-root.
|
|
92
|
-
*
|
|
93
|
-
* Является ли свойство выборки SCSS для @at-root.
|
|
94
|
-
* @param name key name/ название ключа
|
|
95
|
-
*/
|
|
96
|
-
static isRoot(name: string): boolean {
|
|
97
|
-
return name === PropertyType.root || Boolean(name.match(/^&&/))
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Extracts and returns the property type identifier from its name string.
|
|
102
|
-
*
|
|
103
|
-
* Извлекает и возвращает идентификатор типа свойства из строки его названия.
|
|
104
|
-
* @param name property key name / название ключа свойства
|
|
105
|
-
*/
|
|
106
|
-
static getTypeInName(name: string): PropertyItem['_type'] {
|
|
107
|
-
if (this.isTypeInName(name)) {
|
|
108
|
-
const type = name.replace(this.getExpSymbols(), '$1')
|
|
109
|
-
|
|
110
|
-
if (type in this.SYMBOLS) {
|
|
111
|
-
return this.SYMBOLS[type] as PropertyType
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return toKebabCase(type) as PropertyType
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return null
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Returns the name of the property by its symbol.
|
|
122
|
-
*
|
|
123
|
-
* Возвращает название свойства по его символу.
|
|
124
|
-
* @param name type names/ названия типа
|
|
125
|
-
*/
|
|
126
|
-
static getBySymbol(name: string): string | undefined {
|
|
127
|
-
return this.SYMBOLS?.[name]
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Returns a regular expression for searching symbols in names.
|
|
132
|
-
*
|
|
133
|
-
* Возвращает регулярное выражение для поиска символов в названиях.
|
|
134
|
-
*/
|
|
135
|
-
static getExpSymbols(): RegExp {
|
|
136
|
-
return new RegExp(`^(${this.symbolsToString()}|[\\w-]+(?=[|]))(.*?)$`)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Converting symbol keys to strings.
|
|
141
|
-
*
|
|
142
|
-
* Преобразование ключей-символов в строки.
|
|
143
|
-
*/
|
|
144
|
-
private static symbolsToString(): string {
|
|
145
|
-
return Object.keys(this.SYMBOLS).join('|')
|
|
146
|
-
}
|
|
147
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { type PropertyItemPartial } from '../../types/propertyTypes'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Utility class for validating and normalizing design system property values.
|
|
7
|
-
*
|
|
8
|
-
* Утилитарный класс для валидации и нормализации значений свойств дизайн-системы.
|
|
9
|
-
*/
|
|
10
|
-
export class PropertiesValues {
|
|
11
|
-
/**
|
|
12
|
-
* Checks if the value is marked as "full" (starting with `=`), meaning it doesn't require further processing.
|
|
13
|
-
*
|
|
14
|
-
* Проверяет, помечено ли значение как «полное» (начинается с `=`), что означает отсутствие необходимости дальнейшей обработки.
|
|
15
|
-
* @param value property value / значение свойства
|
|
16
|
-
*/
|
|
17
|
-
static isFull(value: PropertyItemPartial['value']): value is string {
|
|
18
|
-
return typeof value === 'string' && Boolean(value.match(this.getExpFull()))
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Identifies if the value is a hex color string.
|
|
23
|
-
*
|
|
24
|
-
* Определяет, является ли значение строкой цвета в формате HEX.
|
|
25
|
-
* @param value property value / значение свойства
|
|
26
|
-
*/
|
|
27
|
-
static isColor(value: PropertyItemPartial['__c']): boolean {
|
|
28
|
-
return Boolean(
|
|
29
|
-
typeof value === 'string' && (
|
|
30
|
-
value.match(/^#/i)
|
|
31
|
-
)
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Identifies if the value is a hex color string with an alpha channel (opacity).
|
|
37
|
-
*
|
|
38
|
-
* Определяет, является ли значение строкой цвета HEX с альфа-каналом (прозрачностью).
|
|
39
|
-
* @param value property value / значение свойства
|
|
40
|
-
*/
|
|
41
|
-
static isColorWithOpacity(value: PropertyItemPartial['__c']): boolean {
|
|
42
|
-
return Boolean(
|
|
43
|
-
typeof value === 'string' && (
|
|
44
|
-
value.match(/^#[a-z0-9]{8}/i)
|
|
45
|
-
)
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Cleans up the value by removing the "full" marker or converting numeric values to strings.
|
|
51
|
-
*
|
|
52
|
-
* Очищает значение, удаляя маркер «полноты» или преобразовывая числовые значения в строки.
|
|
53
|
-
* @param value property value / значение свойства
|
|
54
|
-
*/
|
|
55
|
-
static reValue(value: PropertyItemPartial['value']): PropertyItemPartial['value'] {
|
|
56
|
-
if (this.isFull(value)) {
|
|
57
|
-
return value.replace(this.getExpFull(), '')
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (typeof value === 'number') {
|
|
61
|
-
return value.toString()
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return value
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Returns a regular expression for validating the format of a value.
|
|
69
|
-
*
|
|
70
|
-
* Возвращает регулярное выражение для проверки полного формата значения.
|
|
71
|
-
*/
|
|
72
|
-
static getExpFull(): RegExp {
|
|
73
|
-
return /^=/
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { forEach, isObjectNotArray } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
PropertyKey,
|
|
7
|
-
type PropertyList,
|
|
8
|
-
type PropertyWrapFocus,
|
|
9
|
-
type PropertyWrapItem,
|
|
10
|
-
type PropertyWrapList
|
|
11
|
-
} from '../../types/propertyTypes'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Utility class for optimizing the property structure by moving duplicated data to a higher level.
|
|
15
|
-
*
|
|
16
|
-
* Утилитарный класс для оптимизации структуры свойств путем переноса дублирующихся данных на более высокий уровень.
|
|
17
|
-
*/
|
|
18
|
-
export class PropertiesWrap {
|
|
19
|
-
/**
|
|
20
|
-
* Analyzes the property list and moves duplicate properties to the parent level to reduce redundancy.
|
|
21
|
-
*
|
|
22
|
-
* Анализирует список свойств и переносит дублирующиеся свойства на родительский уровень для уменьшения избыточности.
|
|
23
|
-
* @param properties property list to transform / список свойств для преобразования
|
|
24
|
-
*/
|
|
25
|
-
static to(properties: PropertyList): void {
|
|
26
|
-
forEach(properties, (item) => {
|
|
27
|
-
if (isObjectNotArray(item.value)) {
|
|
28
|
-
this.to(item.value)
|
|
29
|
-
|
|
30
|
-
if (item?.[PropertyKey.wrap]) {
|
|
31
|
-
const value = item.value
|
|
32
|
-
const selectors = this.getSelectors(value)
|
|
33
|
-
|
|
34
|
-
if (selectors.quantity > 1) {
|
|
35
|
-
forEach(selectors.properties, (property, name) => {
|
|
36
|
-
if (name in value) {
|
|
37
|
-
const valueName = value[name]?.value
|
|
38
|
-
|
|
39
|
-
if (typeof valueName === 'string') {
|
|
40
|
-
this.removeProperties(name, property?.values?.[valueName])
|
|
41
|
-
}
|
|
42
|
-
} else if (property.quantity === selectors.quantity) {
|
|
43
|
-
const repeat = this.getMaxRepeat(property.values)
|
|
44
|
-
|
|
45
|
-
if (repeat) {
|
|
46
|
-
value[name] = {
|
|
47
|
-
...repeat.item[0]?.[name],
|
|
48
|
-
value: repeat.value
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
this.removeProperties(name, repeat.item)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
delete item[PropertyKey.wrap]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Adds a new property if it does not exist and returns an object to work with this property.
|
|
65
|
-
*
|
|
66
|
-
* Добавляет новое свойство, если его нет, и возвращает объект для работы с этим свойством.
|
|
67
|
-
* @param data object with all the collected data/ объект со всеми собранными данными
|
|
68
|
-
* @param name the name of the property/ название свойства
|
|
69
|
-
*/
|
|
70
|
-
private static getSelector(
|
|
71
|
-
data: PropertyWrapList['properties'],
|
|
72
|
-
name: string
|
|
73
|
-
): PropertyWrapItem {
|
|
74
|
-
if (!(name in data)) {
|
|
75
|
-
data[name] = {
|
|
76
|
-
values: {},
|
|
77
|
-
quantity: 0
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return data[name] as PropertyWrapItem
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* The method processes the properties and returns all the names of the property and its values.
|
|
86
|
-
*
|
|
87
|
-
* Метод обрабатывает свойства и возвращает все названия свойства и его значения.
|
|
88
|
-
* @param properties an array that needs to be transformed/
|
|
89
|
-
* массив, который нужно преобразовать
|
|
90
|
-
*/
|
|
91
|
-
private static getSelectors(properties: PropertyList): PropertyWrapList {
|
|
92
|
-
const data: PropertyWrapList = {
|
|
93
|
-
properties: {},
|
|
94
|
-
quantity: 0
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
forEach(properties, (item) => {
|
|
98
|
-
if (isObjectNotArray(item.value)) {
|
|
99
|
-
data.quantity++
|
|
100
|
-
this.addItem(data.properties, item.value)
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
return data
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Returns values with maximum repetitions.
|
|
109
|
-
*
|
|
110
|
-
* Возвращает значения с максимальными повторами.
|
|
111
|
-
* @param properties values for verification/ значения для проверки
|
|
112
|
-
*/
|
|
113
|
-
private static getMaxRepeat(properties: PropertyWrapItem['values']): PropertyWrapFocus | undefined {
|
|
114
|
-
let max = 0
|
|
115
|
-
let focus: PropertyWrapFocus | undefined
|
|
116
|
-
|
|
117
|
-
forEach(properties, (item, value) => {
|
|
118
|
-
if (
|
|
119
|
-
item.length > 1 && (
|
|
120
|
-
item.length > max
|
|
121
|
-
|| focus === undefined
|
|
122
|
-
)
|
|
123
|
-
) {
|
|
124
|
-
max = item.length
|
|
125
|
-
focus = {
|
|
126
|
-
value,
|
|
127
|
-
item
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
return focus
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Adds values to the current property and returns an array for adding a data source.
|
|
137
|
-
*
|
|
138
|
-
* Добавляет значения к текущему свойству и возвращает массив для добавления источника данных.
|
|
139
|
-
* @param selector an object to work with the current property/ объект для работы с текущим свойством
|
|
140
|
-
* @param value the value of the property/ значение свойства
|
|
141
|
-
*/
|
|
142
|
-
private static getValue(
|
|
143
|
-
selector: PropertyWrapItem,
|
|
144
|
-
value: string
|
|
145
|
-
): PropertyList[] {
|
|
146
|
-
if (!(value in selector.values)) {
|
|
147
|
-
selector.values[value] = []
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return selector.values[value] as PropertyList[]
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Adding information about the property and its values.
|
|
155
|
-
*
|
|
156
|
-
* Добавления информация об свойство и его значения.
|
|
157
|
-
* @param data object with all the collected data/ объект со всеми собранными данными
|
|
158
|
-
* @param properties list of properties/ свойств
|
|
159
|
-
*/
|
|
160
|
-
private static addItem(
|
|
161
|
-
data: PropertyWrapList['properties'],
|
|
162
|
-
properties: PropertyList
|
|
163
|
-
): void {
|
|
164
|
-
forEach(properties, (item, name) => {
|
|
165
|
-
const selector = this.getSelector(data, name)
|
|
166
|
-
const values = this.getValue(selector, item.value as string)
|
|
167
|
-
|
|
168
|
-
selector.quantity++
|
|
169
|
-
values.push(properties)
|
|
170
|
-
})
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Deletes all records with the property that was moved up the tree.
|
|
175
|
-
*
|
|
176
|
-
* Удаляет все записи с свойством, которое было перенесено выше по дереву.
|
|
177
|
-
* @param name the name of the property for deletion/ название свойства для удаления
|
|
178
|
-
* @param properties an array with properties by the same values/
|
|
179
|
-
* массив со свойствами по одинаковым значениям
|
|
180
|
-
*/
|
|
181
|
-
private static removeProperties(
|
|
182
|
-
name: string,
|
|
183
|
-
properties?: PropertyList[]
|
|
184
|
-
): void {
|
|
185
|
-
properties?.forEach(item => delete item[name])
|
|
186
|
-
}
|
|
187
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
type PropertyItemInput,
|
|
5
|
-
PropertyKey
|
|
6
|
-
} from '../../../types/propertyTypes'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Convector for transforming design token color metadata into internal property structures.
|
|
10
|
-
* Supports opacity modification based on 'studio.tokens' extensions.
|
|
11
|
-
*
|
|
12
|
-
* Конвектор для преобразования метаданных цвета токенов дизайна во внутренние структуры свойств.
|
|
13
|
-
* Поддерживает модификацию прозрачности на основе расширений 'studio.tokens'.
|
|
14
|
-
* @param item property input object for conversion / входной объект свойства для преобразования
|
|
15
|
-
*/
|
|
16
|
-
export function convectorColor(item: PropertyItemInput): void {
|
|
17
|
-
const type: string | undefined = item?.$extensions?.['studio.tokens']?.modify?.type
|
|
18
|
-
const value: string | undefined = item?.$extensions?.['studio.tokens']?.modify?.value
|
|
19
|
-
|
|
20
|
-
if (type) {
|
|
21
|
-
switch (type) {
|
|
22
|
-
case 'alpha':
|
|
23
|
-
item[PropertyKey.cssColorOpacity] = value?.toString() ?? '1'
|
|
24
|
-
break
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { type PropertyItemInput } from '../../../types/propertyTypes'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Data conversion to standard fonts.
|
|
7
|
-
*
|
|
8
|
-
* Преобразование данных в соответствие стандартным шрифтам.
|
|
9
|
-
* @param item values for conversion/ значения для преобразования
|
|
10
|
-
*/
|
|
11
|
-
export function convectorFontFamilies(item: PropertyItemInput): void {
|
|
12
|
-
if (
|
|
13
|
-
typeof item?.value === 'string'
|
|
14
|
-
&& !item.value.match(/[{}]/)
|
|
15
|
-
) {
|
|
16
|
-
item.value = `'${item.value}', sans-serif`
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { isObject, toArray } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { type PropertyItemInput } from '../../../types/propertyTypes'
|
|
6
|
-
|
|
7
|
-
export type ConvectorShadowItem = {
|
|
8
|
-
type: string
|
|
9
|
-
color: string
|
|
10
|
-
x: string
|
|
11
|
-
y: string
|
|
12
|
-
blur: string
|
|
13
|
-
spread: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Transforming data into shadow.
|
|
18
|
-
*
|
|
19
|
-
* Преобразование данных в тень.
|
|
20
|
-
* @param item values for conversion/ значения для преобразования
|
|
21
|
-
*/
|
|
22
|
-
export function convectorShadow(item: PropertyItemInput): void {
|
|
23
|
-
const data: string | ConvectorShadowItem | ConvectorShadowItem[] = item?.value
|
|
24
|
-
|
|
25
|
-
if (isObject(data)) {
|
|
26
|
-
const shadows: string[] = []
|
|
27
|
-
|
|
28
|
-
toArray(data)
|
|
29
|
-
.forEach((item) => {
|
|
30
|
-
const shadow: string[] = []
|
|
31
|
-
const {
|
|
32
|
-
type,
|
|
33
|
-
color,
|
|
34
|
-
x,
|
|
35
|
-
y,
|
|
36
|
-
blur,
|
|
37
|
-
spread
|
|
38
|
-
} = item
|
|
39
|
-
|
|
40
|
-
const colorValue = color.match(/^{/)
|
|
41
|
-
? `@ui.toCustomVarRgb(${color})`
|
|
42
|
-
: color
|
|
43
|
-
|
|
44
|
-
if (type === 'innerShadow') {
|
|
45
|
-
shadow.push('inset')
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
shadow.push(
|
|
49
|
-
x && x !== '0' && x.match(/^[0-9]+$/) ? `${x}px` : x ?? '0',
|
|
50
|
-
y && y !== '0' && y.match(/^[0-9]+$/) ? `${y}px` : y ?? '0',
|
|
51
|
-
blur && blur !== '0' && blur.match(/^[0-9]+$/) ? `${blur}px` : blur ?? '0',
|
|
52
|
-
spread && spread !== '0' && spread.match(/^-?[0-9]+$/) ? `${spread}px` : spread ?? '0',
|
|
53
|
-
colorValue ?? 'rgba(0, 0, 0, 1)'
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
shadows.push(shadow.join(' ').trim())
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
item.value = shadows.join(', ')
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { isString } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { type PropertyItemInput } from '../../../types/propertyTypes'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Conversion for working with the typography type.
|
|
9
|
-
*
|
|
10
|
-
* Конвертация для работы с типом типография.
|
|
11
|
-
* @param item values for conversion/ значения для преобразования
|
|
12
|
-
*/
|
|
13
|
-
export function convectorTypography(item: PropertyItemInput): void {
|
|
14
|
-
if (isString(item?.value)) {
|
|
15
|
-
item.value = {
|
|
16
|
-
basic: item.value
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { PropertiesItems } from '../PropertiesItems'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Abstract base class for data transformation processes.
|
|
7
|
-
* Provides the core orchestration for initializing and writing transformed property data.
|
|
8
|
-
*
|
|
9
|
-
* Абстрактный базовый класс для процессов преобразования данных.
|
|
10
|
-
* Обеспечивает основную оркестровку инициализации и записи преобразованных данных свойств.
|
|
11
|
-
*/
|
|
12
|
-
export abstract class PropertiesToAbstract {
|
|
13
|
-
/**
|
|
14
|
-
* Abstract property defining the cache file path for the specific transformation.
|
|
15
|
-
*
|
|
16
|
-
* Абстрактное свойство, определяющее путь к файлу кэша для конкретного преобразования.
|
|
17
|
-
*/
|
|
18
|
-
protected readonly abstract FILE_CACHE: string
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Constructor that initializes the transformation with a set of property items.
|
|
22
|
-
*
|
|
23
|
-
* Конструктор, который инициализирует преобразование набором элементов свойств.
|
|
24
|
-
* @param items data for processing / данные для обработки
|
|
25
|
-
*/
|
|
26
|
-
constructor(
|
|
27
|
-
protected items: PropertiesItems
|
|
28
|
-
) {
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Executes the full transformation pipeline: initialization followed by writing the output.
|
|
33
|
-
*
|
|
34
|
-
* Выполняет полный конвейер преобразования: инициализацию с последующей записью результата.
|
|
35
|
-
*/
|
|
36
|
-
to(): void {
|
|
37
|
-
this.init()
|
|
38
|
-
this.write()
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
protected abstract init(): void
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Saves intermediate data.
|
|
45
|
-
*
|
|
46
|
-
* Сохраняет промежуточные данные.
|
|
47
|
-
*/
|
|
48
|
-
protected write(): void {
|
|
49
|
-
this.items.write(this.FILE_CACHE)
|
|
50
|
-
}
|
|
51
|
-
}
|