@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,65 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { isObjectNotArray } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesToAbstract } from './PropertiesToAbstract'
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
type PropertyItem,
|
|
9
|
-
type PropertyItemsItem,
|
|
10
|
-
PropertyKey,
|
|
11
|
-
PropertyType
|
|
12
|
-
} from '../../../types/propertyTypes'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A class for transforming components.
|
|
16
|
-
*
|
|
17
|
-
* Класс для преобразования состояния.
|
|
18
|
-
*/
|
|
19
|
-
export class PropertiesToState extends PropertiesToAbstract {
|
|
20
|
-
protected readonly FILE_CACHE = '032-state'
|
|
21
|
-
|
|
22
|
-
protected init(): void {
|
|
23
|
-
this.items.findVariable([PropertyType.state]).forEach(({
|
|
24
|
-
name,
|
|
25
|
-
item,
|
|
26
|
-
parents
|
|
27
|
-
}) => {
|
|
28
|
-
item[PropertyKey.name] = this.getName(name, item, parents)
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Name transformation for the state type.
|
|
34
|
-
*
|
|
35
|
-
* Преобразование имени для типа state.
|
|
36
|
-
* @param name base property name/ базовое название свойства
|
|
37
|
-
* @param item current element/ текущий элемент
|
|
38
|
-
* @param parents current element/ текущий элемент
|
|
39
|
-
*/
|
|
40
|
-
private getName(
|
|
41
|
-
name: string,
|
|
42
|
-
item: PropertyItem,
|
|
43
|
-
parents: PropertyItemsItem['parents']
|
|
44
|
-
): string {
|
|
45
|
-
const newName = this.items.getReName(name, item)
|
|
46
|
-
|
|
47
|
-
if (item?.[PropertyKey.fullName]) {
|
|
48
|
-
return `&.${newName}`
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const value = parents?.[1]?.item.value
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
!item?.[PropertyKey.state]
|
|
55
|
-
&& parents.length > 2
|
|
56
|
-
&& isObjectNotArray(value)
|
|
57
|
-
&& value?.[name]
|
|
58
|
-
&& value[name][PropertyKey.variable] === PropertyType.state
|
|
59
|
-
) {
|
|
60
|
-
return `&.${parents?.[1]?.item[PropertyKey.name]}--${newName}`
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return `&--${newName}`
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { isObjectNotArray } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesToAbstract } from './PropertiesToAbstract'
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
PropertyKey,
|
|
9
|
-
PropertyType
|
|
10
|
-
} from '../../../types/propertyTypes'
|
|
11
|
-
|
|
12
|
-
import { UI_KEY_CUSTOM } from '../../../config'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A class for working with properties that support additional values.
|
|
16
|
-
*
|
|
17
|
-
* Класс для работы со свойствами с поддержкой дополнительных значений.
|
|
18
|
-
*/
|
|
19
|
-
export class PropertiesToStyle extends PropertiesToAbstract {
|
|
20
|
-
protected readonly FILE_CACHE = '016-style'
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Handling a style record.
|
|
24
|
-
*
|
|
25
|
-
* Обработка записи стиля.
|
|
26
|
-
*/
|
|
27
|
-
protected init(): void {
|
|
28
|
-
this.items.each(({
|
|
29
|
-
item,
|
|
30
|
-
name,
|
|
31
|
-
design,
|
|
32
|
-
component
|
|
33
|
-
}) => {
|
|
34
|
-
if (
|
|
35
|
-
item?.[PropertyKey.style]
|
|
36
|
-
&& isObjectNotArray(item.value)
|
|
37
|
-
&& !item.value?.[UI_KEY_CUSTOM]
|
|
38
|
-
) {
|
|
39
|
-
item[PropertyKey.variable] = PropertyType.state
|
|
40
|
-
item.value[UI_KEY_CUSTOM] = {
|
|
41
|
-
value: {
|
|
42
|
-
[name]: {
|
|
43
|
-
value: `{${design}.${component}.sys.${name}}`,
|
|
44
|
-
[PropertyKey.variable]: item?.[PropertyKey.varKey] ? PropertyType.var : PropertyType.property
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
[PropertyKey.variable]: PropertyType.state
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { PropertiesToAbstract } from './PropertiesToAbstract'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
type PropertyItem,
|
|
7
|
-
type PropertyItemsItem,
|
|
8
|
-
PropertyKey
|
|
9
|
-
} from '../../../types/propertyTypes'
|
|
10
|
-
|
|
11
|
-
const REG_SUB = /(?<={[^}]*?){([^{}]+)}/g
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Class for converting all properties with sub-values.
|
|
15
|
-
*
|
|
16
|
-
* Класс для преобразования всех свойств с под-значениями.
|
|
17
|
-
*/
|
|
18
|
-
export class PropertiesToSub extends PropertiesToAbstract {
|
|
19
|
-
protected readonly FILE_CACHE = '006-sub'
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Converting all elements.
|
|
23
|
-
*
|
|
24
|
-
* Преобразование всех элементов.
|
|
25
|
-
*/
|
|
26
|
-
protected init(): void {
|
|
27
|
-
this.items.each((property) => {
|
|
28
|
-
if (this.is(property.value)) {
|
|
29
|
-
this.read(property)
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Проверяет, если значения
|
|
36
|
-
* @param value current element/ текущий элемент
|
|
37
|
-
*/
|
|
38
|
-
private is(value: PropertyItem['value']): boolean {
|
|
39
|
-
return typeof value === 'string' && Boolean(value.match(REG_SUB))
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Converting all indices to values.
|
|
44
|
-
*
|
|
45
|
-
* Преобразование всех индексов в значения.
|
|
46
|
-
* @param design design name/ название дизайна
|
|
47
|
-
* @param component component name/ название компонента
|
|
48
|
-
* @param value values of properties from the value field/ значения свойств из поля value
|
|
49
|
-
*/
|
|
50
|
-
private getValue(
|
|
51
|
-
design: string,
|
|
52
|
-
component: string,
|
|
53
|
-
value: string
|
|
54
|
-
) {
|
|
55
|
-
let max = 24
|
|
56
|
-
let update = true
|
|
57
|
-
|
|
58
|
-
while (update && max-- > 0) {
|
|
59
|
-
update = false
|
|
60
|
-
value = value.replace(REG_SUB, (name, value) => {
|
|
61
|
-
update = true
|
|
62
|
-
|
|
63
|
-
return this.items.getItem(
|
|
64
|
-
this.items.getLink(design, component, name)
|
|
65
|
-
)?.value ?? value
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return value.trim()
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Converting all indices to values for a field of values.
|
|
74
|
-
*
|
|
75
|
-
* Преобразование всех индексов в значения для поля значения.
|
|
76
|
-
*/
|
|
77
|
-
private read(
|
|
78
|
-
{
|
|
79
|
-
design,
|
|
80
|
-
component,
|
|
81
|
-
item
|
|
82
|
-
}: PropertyItemsItem
|
|
83
|
-
): void {
|
|
84
|
-
if (
|
|
85
|
-
component
|
|
86
|
-
&& typeof item.value === 'string'
|
|
87
|
-
) {
|
|
88
|
-
item.value = this.getValue(design, component, item.value)
|
|
89
|
-
|
|
90
|
-
if (item?.[PropertyKey.fullValue]) {
|
|
91
|
-
item.value = item.value.replace(/[{}]/g, '')
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { PropertiesToAbstract } from './PropertiesToAbstract'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
type PropertyItem,
|
|
7
|
-
type PropertyItemsItem,
|
|
8
|
-
PropertyKey,
|
|
9
|
-
PropertyType
|
|
10
|
-
} from '../../../types/propertyTypes'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A class for transforming subclass.
|
|
14
|
-
*
|
|
15
|
-
* Класс для преобразования subclass.
|
|
16
|
-
*/
|
|
17
|
-
export class PropertiesToSubclass extends PropertiesToAbstract {
|
|
18
|
-
protected readonly FILE_CACHE = '036-subclass'
|
|
19
|
-
|
|
20
|
-
protected init(): void {
|
|
21
|
-
this.items.findVariable(PropertyType.subclass).forEach(({
|
|
22
|
-
name,
|
|
23
|
-
item,
|
|
24
|
-
parents
|
|
25
|
-
}) => {
|
|
26
|
-
const newName = this.items.getReName(name, item)
|
|
27
|
-
|
|
28
|
-
item[PropertyKey.name] = this.getName(newName, item, parents)
|
|
29
|
-
item[PropertyKey.nameIndex] = newName
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Checks if the top-level type is a state.
|
|
35
|
-
*
|
|
36
|
-
* Проверяет, является ли тип верхнего уровня - это state.
|
|
37
|
-
* @param parents array of all ancestor properties along the tree from the top level/
|
|
38
|
-
* массив со всеми свойствами предков по дереву от верхнего уровня
|
|
39
|
-
*/
|
|
40
|
-
private isParentState(parents: PropertyItemsItem['parents']): boolean {
|
|
41
|
-
const type = parents?.[parents.length - 1]?.item?.[PropertyKey.variable] ?? PropertyType.subclass
|
|
42
|
-
|
|
43
|
-
return [
|
|
44
|
-
PropertyType.component,
|
|
45
|
-
PropertyType.subclass,
|
|
46
|
-
PropertyType.classType
|
|
47
|
-
].indexOf(type) < 0
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Name transformation for the component type.
|
|
52
|
-
*
|
|
53
|
-
* Преобразование имени для типа component.
|
|
54
|
-
* @param name base property name/ базовое название свойства
|
|
55
|
-
* @param item current element/ текущий элемент
|
|
56
|
-
* @param parents array of all ancestor properties along the tree from the top level/
|
|
57
|
-
* массив со всеми свойствами предков по дереву от верхнего уровня
|
|
58
|
-
*/
|
|
59
|
-
private getName(
|
|
60
|
-
name: string,
|
|
61
|
-
item: PropertyItem,
|
|
62
|
-
parents: PropertyItemsItem['parents']
|
|
63
|
-
): string {
|
|
64
|
-
if (item?.[PropertyKey.fullName]) {
|
|
65
|
-
return `& .${name}`
|
|
66
|
-
} else if (this.isParentState(parents)) {
|
|
67
|
-
const parentsName = this.items.getParentsName(parents, [PropertyType.subclass])
|
|
68
|
-
.join('__')
|
|
69
|
-
.replace('__', '-')
|
|
70
|
-
|
|
71
|
-
return `& .${parentsName}__${name}`
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return `&__${name}`
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { isString, toCamelCase } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesToAbstract } from './PropertiesToAbstract'
|
|
6
|
-
import { PropertiesValues } from '../PropertiesValues'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
type PropertyItem,
|
|
10
|
-
type PropertyItemsItem,
|
|
11
|
-
type PropertyItemsParent,
|
|
12
|
-
PropertyKey,
|
|
13
|
-
PropertyType
|
|
14
|
-
} from '../../../types/propertyTypes'
|
|
15
|
-
|
|
16
|
-
const REG_VAR = /(?<!#)\{([^{}]+)}/ig
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A class for working with custom properties in CSS.
|
|
20
|
-
*
|
|
21
|
-
* Класс для работы с пользовательским свойством в CSS.
|
|
22
|
-
*/
|
|
23
|
-
export class PropertiesToVar extends PropertiesToAbstract {
|
|
24
|
-
protected FILE_CACHE = '020-var'
|
|
25
|
-
protected type = PropertyType.var
|
|
26
|
-
|
|
27
|
-
protected init(): void {
|
|
28
|
-
this.items.findVariable(this.type).forEach((property) => {
|
|
29
|
-
const {
|
|
30
|
-
design,
|
|
31
|
-
component,
|
|
32
|
-
value,
|
|
33
|
-
item,
|
|
34
|
-
parents
|
|
35
|
-
} = property
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
component
|
|
39
|
-
&& typeof value === 'string'
|
|
40
|
-
&& value !== ''
|
|
41
|
-
) {
|
|
42
|
-
const fullValue = item?.[PropertyKey.css] ?? this.items.getLinkToValue(design, component, value)
|
|
43
|
-
|
|
44
|
-
item[PropertyKey.name] = this.getName(property)
|
|
45
|
-
|
|
46
|
-
if (this.isNone(parents)) {
|
|
47
|
-
item[PropertyKey.css] = undefined
|
|
48
|
-
} else {
|
|
49
|
-
item[PropertyKey.css] = this.toValue(
|
|
50
|
-
this.toCalculator(fullValue, item?.[PropertyKey.fullValue]), item?.[PropertyKey.default]
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
!(PropertyKey.cssColorOpacity in item)
|
|
55
|
-
&& this.isColorWithOpacity(property)
|
|
56
|
-
) {
|
|
57
|
-
item[PropertyKey.cssColorOpacity] = true
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (item?.[PropertyKey.important]) {
|
|
61
|
-
item[PropertyKey.css] += ' !important'
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Name transformation for the var type.
|
|
70
|
-
*
|
|
71
|
-
* Преобразование имени для типа var.
|
|
72
|
-
* @param design design name/ название дизайна
|
|
73
|
-
* @param component component name/ название компонента
|
|
74
|
-
* @param name base property name/ базовое название свойства
|
|
75
|
-
* @param item current element/ текущий элемент
|
|
76
|
-
* @param parents array of all ancestor properties along the tree from the top level/
|
|
77
|
-
* массив со всеми свойствами предков по дереву от верхнего уровня
|
|
78
|
-
*/
|
|
79
|
-
protected getName({
|
|
80
|
-
design,
|
|
81
|
-
component,
|
|
82
|
-
name,
|
|
83
|
-
item,
|
|
84
|
-
parents
|
|
85
|
-
}: PropertyItemsItem): string {
|
|
86
|
-
if (component && item?.[PropertyKey.fullName]) {
|
|
87
|
-
return `--${this.items.getLink(design, component, item?.[PropertyKey.index] ?? name, '-')}`
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return `--${this.items.getParentsName(parents, [PropertyType.var]).join('-')}-${toCamelCase(name)}`
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Checks if the value has a mathematical expression.
|
|
95
|
-
*
|
|
96
|
-
* Проверяет, есть ли у значения математическое выражение.
|
|
97
|
-
* @param value values to process/ значения для преобразования
|
|
98
|
-
* @param full the expression is complete/ выражение является полным
|
|
99
|
-
*/
|
|
100
|
-
protected toCalculator(value: string, full?: boolean): string {
|
|
101
|
-
if (
|
|
102
|
-
!full
|
|
103
|
-
&& value.match(/([+*/]|(?<![\w-])-(?![\w-]))/ig)
|
|
104
|
-
&& value.match(/calc/ig) === null
|
|
105
|
-
) {
|
|
106
|
-
return `calc(${value})`
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return value
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Returns the transformed pointer.
|
|
114
|
-
*
|
|
115
|
-
* Возвращает преобразованный указатель.
|
|
116
|
-
* @param {string} value values to process/ значения для преобразования
|
|
117
|
-
*/
|
|
118
|
-
protected toLink(value: string): string {
|
|
119
|
-
return this.items.getKeys(value).join('-')
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Transformation to the CSS property.
|
|
124
|
-
*
|
|
125
|
-
* Преобразование в свойство CSS.
|
|
126
|
-
* @param value values to process/ значения для преобразования
|
|
127
|
-
* @param defaultValue default values/ значения по умолчанию
|
|
128
|
-
*/
|
|
129
|
-
protected toValue(value: string, defaultValue?: PropertyItem['_default']): string {
|
|
130
|
-
if (value.match('{')) {
|
|
131
|
-
return value.replace(REG_VAR, (...text) => {
|
|
132
|
-
if (defaultValue && typeof defaultValue === 'string') {
|
|
133
|
-
return `var(--${this.toLink(text[1])}, ${this.toValue(this.toCalculator(defaultValue))})`
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return `var(--${this.toLink(text[1])})`
|
|
137
|
-
})
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return value
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Checks if the values are hidden.
|
|
145
|
-
*
|
|
146
|
-
* Проверяет, являются ли значения скрытыми.
|
|
147
|
-
* @param parents list of ancestors/ список предков
|
|
148
|
-
*/
|
|
149
|
-
private isNone(parents: PropertyItemsParent[]): boolean {
|
|
150
|
-
for (const parent of parents) {
|
|
151
|
-
if (parent.item?.[PropertyKey.type] === PropertyType.none) {
|
|
152
|
-
return true
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return false
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Checks if the element has transparency.
|
|
161
|
-
*
|
|
162
|
-
* Проверяет, есть ли прозрачность у элемента.
|
|
163
|
-
* @param property property value/ значение свойства
|
|
164
|
-
*/
|
|
165
|
-
private isColorWithOpacity(property: PropertyItemsItem): boolean {
|
|
166
|
-
const {
|
|
167
|
-
design,
|
|
168
|
-
component,
|
|
169
|
-
value,
|
|
170
|
-
item
|
|
171
|
-
} = property
|
|
172
|
-
|
|
173
|
-
if (item?.[PropertyKey.cssColorOpacity]) {
|
|
174
|
-
return true
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (
|
|
178
|
-
component
|
|
179
|
-
&& isString(value)
|
|
180
|
-
) {
|
|
181
|
-
if (value.match(/^\{[^}]+}$/)) {
|
|
182
|
-
const link = this.items.getLink(design, component, value)
|
|
183
|
-
const data = this.items.getInfo(link)
|
|
184
|
-
if (data) {
|
|
185
|
-
return this.isColorWithOpacity(data)
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
return PropertiesValues.isColorWithOpacity(value)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return false
|
|
193
|
-
}
|
|
194
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { isFilled, isObjectNotArray, toKebabCase } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesToAbstract } from './PropertiesToAbstract'
|
|
6
|
-
import { PropertiesTypes } from '../PropertiesTypes'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
PropertyCategory,
|
|
10
|
-
type PropertyItem,
|
|
11
|
-
PropertyKey,
|
|
12
|
-
PropertyType
|
|
13
|
-
} from '../../../types/propertyTypes'
|
|
14
|
-
|
|
15
|
-
import { css } from '../../../media/properties/css'
|
|
16
|
-
import { cssSelector } from '../../../media/properties/cssSelector'
|
|
17
|
-
import { cssVirtual } from '../../../media/properties/cssVirtual'
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Class for performing data type conversions.
|
|
21
|
-
*
|
|
22
|
-
* Класс для выполнения преобразования типов данных.
|
|
23
|
-
*/
|
|
24
|
-
export class PropertiesToVariable extends PropertiesToAbstract {
|
|
25
|
-
protected readonly FILE_CACHE = '008-variable'
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Determine all properties and their property types in an object.
|
|
29
|
-
*
|
|
30
|
-
* Определяем все свойства и их типы свойств в объекте.
|
|
31
|
-
*/
|
|
32
|
-
protected init(): void {
|
|
33
|
-
this.items.each(({
|
|
34
|
-
design,
|
|
35
|
-
component,
|
|
36
|
-
name,
|
|
37
|
-
item,
|
|
38
|
-
parent
|
|
39
|
-
}) => {
|
|
40
|
-
item[PropertyKey.variable] = this.getByNone(item)
|
|
41
|
-
?? this.getByVarParent(parent)
|
|
42
|
-
?? item?.[PropertyKey.type]
|
|
43
|
-
?? this.getByCategory(item)
|
|
44
|
-
?? this.getByMain(design, component, name)
|
|
45
|
-
?? this.findType(name, item)
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* If there is a value of category, changes the property to the required one.
|
|
51
|
-
*
|
|
52
|
-
* Если есть значение категории, изменяет свойство на нужное.
|
|
53
|
-
* @param item current property/ текущее свойство
|
|
54
|
-
*/
|
|
55
|
-
private getByCategory(item: PropertyItem): PropertyType | undefined {
|
|
56
|
-
switch (item?.[PropertyKey.category]) {
|
|
57
|
-
case PropertyCategory.root:
|
|
58
|
-
return PropertyType.var
|
|
59
|
-
case PropertyCategory.theme:
|
|
60
|
-
return PropertyType.theme
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return undefined
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* If the name matches the name of the design or component.
|
|
68
|
-
*
|
|
69
|
-
* Если название совпадает с названием дизайна или компонента.
|
|
70
|
-
* @param design design name/ название дизайна
|
|
71
|
-
* @param component component name/ название компонента
|
|
72
|
-
* @param name key name/ название ключа
|
|
73
|
-
*/
|
|
74
|
-
private getByMain(
|
|
75
|
-
design: string,
|
|
76
|
-
component: string | undefined,
|
|
77
|
-
name: string
|
|
78
|
-
): PropertyType | undefined {
|
|
79
|
-
if (name === design) {
|
|
80
|
-
return PropertyType.design
|
|
81
|
-
} else if (name === component) {
|
|
82
|
-
return PropertyType.component
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return undefined
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* If the name of the property matches the name of the style in CSS.
|
|
90
|
-
*
|
|
91
|
-
* Если название свойства совпадает с названием стиля в CSS.
|
|
92
|
-
* @param name key name/ название ключа
|
|
93
|
-
*/
|
|
94
|
-
private getByProperty(name: string): PropertyType | undefined {
|
|
95
|
-
return css.indexOf(toKebabCase(name)) !== -1 ? PropertyType.property : undefined
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* If the name of the property matches the name of the pseudo-class.
|
|
100
|
-
*
|
|
101
|
-
* Если название свойства совпадает с названием псевдо-класса.
|
|
102
|
-
* @param name key name/ название ключа
|
|
103
|
-
*/
|
|
104
|
-
private getBySelector(name: string): PropertyType | undefined {
|
|
105
|
-
return cssSelector.indexOf(toKebabCase(name)) !== -1 ? PropertyType.selector : undefined
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* If the element has no properties and values.
|
|
110
|
-
*
|
|
111
|
-
* Если у элемента нет ни одного свойства и значения.
|
|
112
|
-
* @param item current property/ текущее свойство
|
|
113
|
-
*/
|
|
114
|
-
private getBySubclass(item: PropertyItem): PropertyType | undefined {
|
|
115
|
-
if (
|
|
116
|
-
Object.keys(item).length <= 1
|
|
117
|
-
&& !isFilled(item.value)
|
|
118
|
-
) {
|
|
119
|
-
return PropertyType.subclass
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return undefined
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* If the ancestor has type var.
|
|
127
|
-
*
|
|
128
|
-
* Если у предка тип var.
|
|
129
|
-
* @param parent object of ancestor/ объект предка
|
|
130
|
-
*/
|
|
131
|
-
private getByVarParent(parent?: PropertyItem): PropertyType | undefined {
|
|
132
|
-
return PropertiesTypes.isInType(parent?.[PropertyKey.variable], [PropertyType.var]) ? PropertyType.var : undefined
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Checks if the type is hidden.
|
|
137
|
-
*
|
|
138
|
-
* Проверяет, является ли тип скрытым.
|
|
139
|
-
* @param item current property/ текущее свойство
|
|
140
|
-
*/
|
|
141
|
-
private getByNone(item: PropertyItem): PropertyType | undefined {
|
|
142
|
-
return item?.[PropertyKey.type] === PropertyType.none ? PropertyType.none : undefined
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* If the type is a pseudo-element.
|
|
147
|
-
*
|
|
148
|
-
* Если тип псевдо-элемента.
|
|
149
|
-
* @param name key name/ название ключа
|
|
150
|
-
*/
|
|
151
|
-
private getByVirtual(name: string): PropertyType | undefined {
|
|
152
|
-
return cssVirtual.indexOf(toKebabCase(name)) !== -1 ? PropertyType.virtual : undefined
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Search for a suitable property by name.
|
|
157
|
-
*
|
|
158
|
-
* Поиск подходящего свойства по названию.
|
|
159
|
-
* @param name key name/ название ключа
|
|
160
|
-
* @param item current property/ текущее свойство
|
|
161
|
-
*/
|
|
162
|
-
private findType(name: string, item: PropertyItem): PropertyType {
|
|
163
|
-
const property = this.items.getName(name, item)
|
|
164
|
-
|
|
165
|
-
if (isObjectNotArray(item.value)) {
|
|
166
|
-
return this.getBySubclass(item)
|
|
167
|
-
|| this.getBySelector(property)
|
|
168
|
-
|| this.getByVirtual(property)
|
|
169
|
-
|| this.getByProperty(property)
|
|
170
|
-
|| PropertyType.state
|
|
171
|
-
} else {
|
|
172
|
-
return this.getByProperty(property)
|
|
173
|
-
|| PropertyType.var
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|