@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,143 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { toCamelCaseFirst, toKebabCase } from '@dxtmisha/functional-basic'
|
|
4
|
-
import { getPackageJson } from '../../functions/getPackageJson'
|
|
5
|
-
|
|
6
|
-
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
7
|
-
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
8
|
-
import { PropertiesCache } from '../Properties/PropertiesCache'
|
|
9
|
-
import { DesignComponent } from './DesignComponent'
|
|
10
|
-
import { LibraryItems } from '../Library/LibraryItems'
|
|
11
|
-
import { Styles } from '../Styles/Styles'
|
|
12
|
-
|
|
13
|
-
import { DesignWiki } from './DesignWiki'
|
|
14
|
-
|
|
15
|
-
import { LibraryAiWiki } from '../Library/LibraryAiWiki'
|
|
16
|
-
import { LibraryMedia } from '../Library/LibraryMedia'
|
|
17
|
-
import { LibraryList } from '../Library/LibraryList'
|
|
18
|
-
import { LibraryPlugin } from '../Library/LibraryPlugin'
|
|
19
|
-
import { LibraryTypes } from '../Library/LibraryTypes'
|
|
20
|
-
|
|
21
|
-
import { UI_FILE_PACKAGE, UI_FILE_STYLE_PROPERTIES } from '../../config'
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Orchestrator class for managing and initializing the Design System UI.
|
|
25
|
-
* It coordinates the generation of styles, documentation, component structures, and library-level exports (media, plugins, types).
|
|
26
|
-
*
|
|
27
|
-
* Класс-оркестратор для управления и инициализации пользовательского интерфейса дизайн-системы.
|
|
28
|
-
* Координирует генерацию стилей, документации, структур компонентов и экспортов на уровне библиотеки (медиа, плагины, типы).
|
|
29
|
-
*/
|
|
30
|
-
export class DesignUi {
|
|
31
|
-
protected readonly components: LibraryItems
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Constructor for DesignUi.
|
|
35
|
-
*
|
|
36
|
-
* Конструктор для DesignUi.
|
|
37
|
-
* @param name specific component name to initialize, or empty for all / название конкретного компонента для инициализации или пусто для всех
|
|
38
|
-
*/
|
|
39
|
-
constructor(
|
|
40
|
-
protected readonly name: string = ''
|
|
41
|
-
) {
|
|
42
|
-
this.components = new LibraryItems()
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Returns the component name by its name.
|
|
47
|
-
*
|
|
48
|
-
* Возвращает название компонента по имени.
|
|
49
|
-
*/
|
|
50
|
-
protected get component(): string {
|
|
51
|
-
return toKebabCase(this.name).trim()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Initialization of the component.
|
|
56
|
-
*
|
|
57
|
-
* Инициализация компоненты.
|
|
58
|
-
*/
|
|
59
|
-
make(): void {
|
|
60
|
-
PropertiesCache.clear()
|
|
61
|
-
|
|
62
|
-
new Styles().make()
|
|
63
|
-
new DesignWiki().make()
|
|
64
|
-
|
|
65
|
-
this.makeConstructorComponent()
|
|
66
|
-
.makePackage()
|
|
67
|
-
.makeUiProperties()
|
|
68
|
-
|
|
69
|
-
new LibraryMedia(this.components).make()
|
|
70
|
-
new LibraryList(this.components).make()
|
|
71
|
-
new LibraryPlugin(this.components).make()
|
|
72
|
-
new LibraryAiWiki(this.components).make()
|
|
73
|
-
new LibraryTypes(this.components).make()
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Creates or updates the list of components.
|
|
78
|
-
*
|
|
79
|
-
* Создает или обновляет список компонентов.
|
|
80
|
-
*/
|
|
81
|
-
protected makeConstructorComponent(): this {
|
|
82
|
-
const componentDef = this.component
|
|
83
|
-
|
|
84
|
-
if (componentDef !== '') {
|
|
85
|
-
new DesignComponent(componentDef).make()
|
|
86
|
-
} else {
|
|
87
|
-
this.components.getComponentList()
|
|
88
|
-
.forEach((component) => {
|
|
89
|
-
console.log(`Component update: ${component.alias}`)
|
|
90
|
-
|
|
91
|
-
new DesignComponent(component.name).make()
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return this
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Updates the package.json file by adding export paths for UI styles and saves the changes.
|
|
100
|
-
*
|
|
101
|
-
* Обновляет файл package.json, добавляя пути экспорта для стилей UI, и сохраняет изменения.
|
|
102
|
-
*/
|
|
103
|
-
protected makePackage(): this {
|
|
104
|
-
const packageJson = getPackageJson()
|
|
105
|
-
const projectName = toCamelCaseFirst(PropertiesConfig.getProjectName())
|
|
106
|
-
|
|
107
|
-
if (packageJson?.exports) {
|
|
108
|
-
packageJson.exports['.'] = {
|
|
109
|
-
types: './dist/library/types.d.ts',
|
|
110
|
-
default: './dist/types.js'
|
|
111
|
-
}
|
|
112
|
-
packageJson.exports['./plugin'] = {
|
|
113
|
-
types: './dist/library/plugin.d.ts',
|
|
114
|
-
default: './dist/plugin.js'
|
|
115
|
-
}
|
|
116
|
-
packageJson.exports['./media'] = {
|
|
117
|
-
types: './dist/library/media.d.ts',
|
|
118
|
-
default: './dist/media.js'
|
|
119
|
-
}
|
|
120
|
-
packageJson.exports['./style.css'] = './dist/style.css'
|
|
121
|
-
packageJson.exports['./style/ui.scss'] = `./src/styles/${projectName}/main.scss`
|
|
122
|
-
packageJson.exports['./ui-properties'] = {
|
|
123
|
-
sass: './ui-properties.scss',
|
|
124
|
-
default: './ui-properties.scss'
|
|
125
|
-
}
|
|
126
|
-
packageJson.exports['./types.d.ts'] = './dist/library/types.d.ts'
|
|
127
|
-
packageJson['web-types'] = './dist/web-types.json'
|
|
128
|
-
|
|
129
|
-
PropertiesFile.writeByPath(UI_FILE_PACKAGE, packageJson)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return this
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
protected makeUiProperties(): this {
|
|
136
|
-
PropertiesFile.writeByPath(
|
|
137
|
-
UI_FILE_STYLE_PROPERTIES,
|
|
138
|
-
'@forward "./src/styles/Ui/style.scss";'
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
return this
|
|
142
|
-
}
|
|
143
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// export:none
|
|
2
|
-
|
|
3
|
-
import { toCamelCaseFirst } from '@dxtmisha/functional-basic'
|
|
4
|
-
|
|
5
|
-
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
6
|
-
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
UI_DIRS_WIKI,
|
|
10
|
-
UI_FILE_NAME_WIKI
|
|
11
|
-
} from '../../config'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Utility for managing and generating the central wiki configuration for the design system.
|
|
15
|
-
* It ensures that the primary registry for storybook arguments and component descriptions is correctly initialized and synchronized with the project's design configuration.
|
|
16
|
-
*
|
|
17
|
-
* Утилита для управления и генерации центральной конфигурации вики для дизайн-системы.
|
|
18
|
-
* Гарантирует, что основной реестр аргументов Storybook и описаний компонентов правильно инициализирован и синхронизирован с конфигурацией дизайна проекта.
|
|
19
|
-
*/
|
|
20
|
-
export class DesignWiki {
|
|
21
|
-
/**
|
|
22
|
-
* Executes the initialization of the file with component descriptions for the wiki.
|
|
23
|
-
*
|
|
24
|
-
* Выполняет инициализацию файла с описанием компонентов для wiki.
|
|
25
|
-
*/
|
|
26
|
-
make(): void {
|
|
27
|
-
this.initWikiFile()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Creates a file with component descriptions for the wiki.
|
|
32
|
-
*
|
|
33
|
-
* Создает файл с описанием компонентов для wiki.
|
|
34
|
-
*/
|
|
35
|
-
protected initWikiFile(): void {
|
|
36
|
-
if (!PropertiesFile.is([...UI_DIRS_WIKI, `${UI_FILE_NAME_WIKI}.ts`])) {
|
|
37
|
-
const designName = PropertiesConfig.getDesignName()
|
|
38
|
-
|
|
39
|
-
PropertiesFile.write(
|
|
40
|
-
UI_DIRS_WIKI,
|
|
41
|
-
UI_FILE_NAME_WIKI,
|
|
42
|
-
[
|
|
43
|
-
'import type { StorybookArgsToList } from \'@dxtmisha/wiki\'',
|
|
44
|
-
'',
|
|
45
|
-
`export const wiki${toCamelCaseFirst(designName)}: StorybookArgsToList = {}`,
|
|
46
|
-
''
|
|
47
|
-
].join('\r\n'),
|
|
48
|
-
'ts'
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { ServerStorage, toCamelCaseFirst } from '@dxtmisha/functional-basic'
|
|
2
|
-
import { getPackageJson } from '../../functions/getPackageJson'
|
|
3
|
-
|
|
4
|
-
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
5
|
-
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
6
|
-
import { LibraryItems } from '../Library/LibraryItems'
|
|
7
|
-
import { DesignWikiStormItem } from './DesignWikiStormItem'
|
|
8
|
-
|
|
9
|
-
import type { WebTypesVueComponentItem, WebTypesVueJson } from '../../types/webTypes'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Engine for generating `web-types.json` to provide rich metadata and IDE support (IntelliSense) for the design system components in JetBrains editors (IntelliJ IDEA, WebStorm).
|
|
13
|
-
* It aggregates component tags, attributes, and events from the entire library and formats them into the standard Web-Types schema.
|
|
14
|
-
*
|
|
15
|
-
* Движок для генерации `web-types.json`, обеспечивающий расширенные метаданные и поддержку IDE (IntelliSense) для компонентов дизайн-системы в редакторах JetBrains (IntelliJ IDEA, WebStorm).
|
|
16
|
-
* Он агрегирует теги компонентов, атрибуты и события из всей библиотеки и форматирует их в стандартную схему Web-Types.
|
|
17
|
-
*/
|
|
18
|
-
export class DesignWikiStorm {
|
|
19
|
-
protected readonly components: LibraryItems
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Constructor for DesignWikiStorm.
|
|
23
|
-
*
|
|
24
|
-
* Конструктор для DesignWikiStorm.
|
|
25
|
-
* @param dir target directory for saving the `web-types.json` file / целевая директория для сохранения файла `web-types.json`
|
|
26
|
-
*/
|
|
27
|
-
constructor(
|
|
28
|
-
protected dir: string = 'dist'
|
|
29
|
-
) {
|
|
30
|
-
ServerStorage.setErrorStatus(true)
|
|
31
|
-
this.components = new LibraryItems()
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Generates the web-types.json file.
|
|
36
|
-
*
|
|
37
|
-
* Генерирует файл web-types.json.
|
|
38
|
-
*/
|
|
39
|
-
async make(): Promise<void> {
|
|
40
|
-
const packageFile = getPackageJson()
|
|
41
|
-
|
|
42
|
-
console.log('[DesignWikiStorm] make')
|
|
43
|
-
|
|
44
|
-
if (packageFile) {
|
|
45
|
-
const data: WebTypesVueJson = {
|
|
46
|
-
'$schema': 'https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json',
|
|
47
|
-
'framework': 'vue',
|
|
48
|
-
'name': toCamelCaseFirst(PropertiesConfig.getDesignName()),
|
|
49
|
-
'version': packageFile.version,
|
|
50
|
-
'js-types-syntax': 'typescript',
|
|
51
|
-
'contributions': {
|
|
52
|
-
html: {
|
|
53
|
-
'description-markup': 'markdown',
|
|
54
|
-
'vue-components': await this.getComponents()
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
PropertiesFile.writeByPath(
|
|
60
|
-
[this.dir, 'web-types.json'],
|
|
61
|
-
data
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Creates or updates the list of components.
|
|
68
|
-
*
|
|
69
|
-
* Создает или обновляет список компонентов.
|
|
70
|
-
*/
|
|
71
|
-
protected async getComponents(): Promise<WebTypesVueComponentItem[]> {
|
|
72
|
-
const packageFile = getPackageJson()
|
|
73
|
-
const tags: WebTypesVueComponentItem[] = []
|
|
74
|
-
|
|
75
|
-
if (packageFile) {
|
|
76
|
-
for (const component of this.components.getComponentList()) {
|
|
77
|
-
const item = new DesignWikiStormItem(
|
|
78
|
-
packageFile.name,
|
|
79
|
-
this.components.getComponentsPath(),
|
|
80
|
-
component
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
await item.init()
|
|
84
|
-
|
|
85
|
-
const tag = await item.get()
|
|
86
|
-
|
|
87
|
-
if (tag) {
|
|
88
|
-
tags.push(tag as any)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return tags
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { toCamelCaseFirst } from '@dxtmisha/functional'
|
|
2
|
-
import { type WikiDataItem, WikiStorybook, WikiStorybookProp } from '@dxtmisha/wiki'
|
|
3
|
-
import { wiki, wikiDescriptions } from '@dxtmisha/wiki/media'
|
|
4
|
-
|
|
5
|
-
import { PropertiesConfig } from '../Properties/PropertiesConfig'
|
|
6
|
-
import { PropertiesFile } from '../Properties/PropertiesFile'
|
|
7
|
-
|
|
8
|
-
import type { LibraryData } from '../../types/libraryTypes'
|
|
9
|
-
import type { WebTypesVueComponentItem, WebTypesPropItem, WebTypesSlots, WebTypesEventItem, WebTypesProperty } from '../../types/webTypes'
|
|
10
|
-
import { forEach } from '@dxtmisha/functional-basic'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* List of basic types that do not need to be wrapped in quotes for web-types/
|
|
14
|
-
* Список базовых типов, которые не нужно оборачивать в кавычки для web-types
|
|
15
|
-
*/
|
|
16
|
-
const BASE_TYPES = /^(boolean|number|string|null|any|void|object|unknown|never)$/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Resolver for extracting and formatting IDE metadata for a specific component.
|
|
20
|
-
* It coordinates the transformation of Storybook-specific wiki data into JetBrains Web-Types tag and attribute definitions.
|
|
21
|
-
*
|
|
22
|
-
* Резолвер для извлечения и форматирования метаданных IDE для конкретного компонента.
|
|
23
|
-
* Координирует преобразование данных вики для Storybook в определения тегов и атрибутов JetBrains Web-Types.
|
|
24
|
-
*/
|
|
25
|
-
export class DesignWikiStormItem {
|
|
26
|
-
protected wiki?: WikiStorybook
|
|
27
|
-
protected dataComponent?: WikiDataItem
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Constructor for DesignWikiStormItem.
|
|
31
|
-
*
|
|
32
|
-
* Конструктор для DesignWikiStormItem.
|
|
33
|
-
* @param project name of the project for module mapping / имя проекта для маппинга модулей
|
|
34
|
-
* @param path array of directory path segments to the component / массив сегментов пути к директории компонента
|
|
35
|
-
* @param data component metadata from the library / метаданные компонента из библиотеки
|
|
36
|
-
*/
|
|
37
|
-
constructor(
|
|
38
|
-
protected readonly project: string,
|
|
39
|
-
protected readonly path: string[],
|
|
40
|
-
protected readonly data: LibraryData
|
|
41
|
-
) {
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Returns the tag definition for web-types.
|
|
46
|
-
*
|
|
47
|
-
* Возвращает определение тега для web-types.
|
|
48
|
-
*/
|
|
49
|
-
async get(): Promise<WebTypesVueComponentItem | undefined> {
|
|
50
|
-
if (this.wiki) {
|
|
51
|
-
const name = `${toCamelCaseFirst(PropertiesConfig.getDesignName())}${this.wiki.getName()}`
|
|
52
|
-
|
|
53
|
-
const component: WebTypesVueComponentItem = {
|
|
54
|
-
name,
|
|
55
|
-
description: this.wiki.getDescription(),
|
|
56
|
-
source: {
|
|
57
|
-
module: `${this.project}/${name}`,
|
|
58
|
-
symbol: name
|
|
59
|
-
},
|
|
60
|
-
props: this.getProps()
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const slots = await this.getSlots()
|
|
64
|
-
|
|
65
|
-
if (slots) {
|
|
66
|
-
component.slots = slots
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const events = await this.getEvents()
|
|
70
|
-
|
|
71
|
-
if (events && events.length > 0) {
|
|
72
|
-
component.js = {
|
|
73
|
-
events
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return component
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return undefined
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Returns the prop definition.
|
|
85
|
-
*
|
|
86
|
-
* Возвращает определение свойства.
|
|
87
|
-
* @param item prop item / элемент свойства
|
|
88
|
-
*/
|
|
89
|
-
getProp(item: WikiStorybookProp): WebTypesPropItem {
|
|
90
|
-
const type = this.prepareType(item.getType())
|
|
91
|
-
const cleaned = type ? this.cleanType(type) : undefined
|
|
92
|
-
return {
|
|
93
|
-
name: item.getName(),
|
|
94
|
-
description: item.getDescription(),
|
|
95
|
-
default: item.getDefaultValue() ?? undefined,
|
|
96
|
-
type: cleaned
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Returns a list of props.
|
|
102
|
-
*
|
|
103
|
-
* Возвращает список свойств.
|
|
104
|
-
*/
|
|
105
|
-
getProps(): WebTypesPropItem[] {
|
|
106
|
-
const props: WebTypesPropItem[] = []
|
|
107
|
-
|
|
108
|
-
if (this.wiki) {
|
|
109
|
-
this.wiki.getWikiObject()
|
|
110
|
-
.forEach(
|
|
111
|
-
item => props.push(this.getProp(item))
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return props
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Returns a list of slots.
|
|
120
|
-
*
|
|
121
|
-
* Возвращает список слотов.
|
|
122
|
-
*/
|
|
123
|
-
async getSlots(): Promise<WebTypesSlots | undefined> {
|
|
124
|
-
const data = await this.getData()
|
|
125
|
-
|
|
126
|
-
if (data && data.slots) {
|
|
127
|
-
const slots: WebTypesSlots = []
|
|
128
|
-
|
|
129
|
-
data.slots.forEach(
|
|
130
|
-
(slot) => {
|
|
131
|
-
const vueProperties: WebTypesProperty[] = (slot.properties ?? []).map(p => ({
|
|
132
|
-
name: p.name,
|
|
133
|
-
type: p.type ? this.cleanType(p.type) : undefined,
|
|
134
|
-
description: p.description
|
|
135
|
-
}))
|
|
136
|
-
|
|
137
|
-
slots.push({
|
|
138
|
-
'name': slot.name,
|
|
139
|
-
'description': slot.description,
|
|
140
|
-
'vue-properties': vueProperties
|
|
141
|
-
})
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
return slots
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return undefined
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Returns a list of events.
|
|
153
|
-
*
|
|
154
|
-
* Возвращает список событий.
|
|
155
|
-
*/
|
|
156
|
-
async getEvents(): Promise<WebTypesEventItem[] | undefined> {
|
|
157
|
-
const data = await this.getData()
|
|
158
|
-
|
|
159
|
-
if (data && data.events) {
|
|
160
|
-
const events: WebTypesEventItem[] = []
|
|
161
|
-
|
|
162
|
-
data.events.forEach(
|
|
163
|
-
(event) => {
|
|
164
|
-
let typeString = '() => void'
|
|
165
|
-
if (event.properties && event.properties.length > 0) {
|
|
166
|
-
const args = event.properties
|
|
167
|
-
.map(p => `${p.name}: ${p.type ? this.cleanType(p.type) : 'any'}`)
|
|
168
|
-
.join(', ')
|
|
169
|
-
typeString = `(${args}) => void`
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
events.push({
|
|
173
|
-
name: event.name,
|
|
174
|
-
description: event.description,
|
|
175
|
-
type: typeString
|
|
176
|
-
})
|
|
177
|
-
}
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
return events
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return undefined
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Returns the directory name.
|
|
188
|
-
*
|
|
189
|
-
* Возвращает имя директории.
|
|
190
|
-
*/
|
|
191
|
-
getDirName() {
|
|
192
|
-
return this.data.dir
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Initializes the class.
|
|
197
|
-
*
|
|
198
|
-
* Инициализирует класс.
|
|
199
|
-
*/
|
|
200
|
-
async init(): Promise<this> {
|
|
201
|
-
this.wiki = await this.initWiki()
|
|
202
|
-
return this
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Gets data from wikiData.ts.
|
|
207
|
-
*
|
|
208
|
-
* Получает данные из wikiData.ts.
|
|
209
|
-
*/
|
|
210
|
-
protected async getData(): Promise<WikiDataItem | undefined> {
|
|
211
|
-
if (!this.dataComponent) {
|
|
212
|
-
const filePath = this.getPaths(['wikiData.ts'])
|
|
213
|
-
|
|
214
|
-
if (PropertiesFile.is(filePath)) {
|
|
215
|
-
try {
|
|
216
|
-
const wiki: Record<string, any> = await import(filePath.join('/'))
|
|
217
|
-
this.dataComponent = Object.values(wiki).find(item => 'component' in item)
|
|
218
|
-
} catch (error) {
|
|
219
|
-
console.error(filePath, error)
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return this.dataComponent
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Returns the list of directories.
|
|
229
|
-
*
|
|
230
|
-
* Возвращает список директорий.
|
|
231
|
-
*/
|
|
232
|
-
protected getDirs(): string[] {
|
|
233
|
-
return [
|
|
234
|
-
'.',
|
|
235
|
-
...this.path,
|
|
236
|
-
this.getDirName()
|
|
237
|
-
]
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Returns the full path to the file.
|
|
242
|
-
*
|
|
243
|
-
* Возвращает полный путь к файлу.
|
|
244
|
-
* @param paths path segments / сегменты пути
|
|
245
|
-
*/
|
|
246
|
-
protected getPaths(paths: string[]): string[] {
|
|
247
|
-
return [
|
|
248
|
-
...this.getDirs(),
|
|
249
|
-
...paths
|
|
250
|
-
]
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Formats a type string for web-types.
|
|
255
|
-
*
|
|
256
|
-
* Форматирует строку типа для web-types.
|
|
257
|
-
* @param type original type string / исходная строка типа
|
|
258
|
-
*/
|
|
259
|
-
protected prepareType(type?: string): string | undefined {
|
|
260
|
-
if (type) {
|
|
261
|
-
return forEach(
|
|
262
|
-
type.split('|'),
|
|
263
|
-
(item) => {
|
|
264
|
-
const trimmed = item.trim()
|
|
265
|
-
|
|
266
|
-
if (trimmed === 'undefined') {
|
|
267
|
-
return undefined
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (BASE_TYPES.test(trimmed)) {
|
|
271
|
-
return trimmed
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return `'${trimmed}'`
|
|
275
|
-
}
|
|
276
|
-
)
|
|
277
|
-
.join(' | ')
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return type
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Cleans a type string by removing redundant parentheses, e.g., (CellClassesSub) | undefined -> CellClassesSub | undefined
|
|
285
|
-
*
|
|
286
|
-
* Очищает строку типа, удаляя лишние скобки, например: (CellClassesSub) | undefined -> CellClassesSub | undefined
|
|
287
|
-
*/
|
|
288
|
-
protected cleanType(type: string): string {
|
|
289
|
-
return type
|
|
290
|
-
.replace(/^\(([^()]+)\)$/, '$1')
|
|
291
|
-
.replace(/^\(([^()]+)\)\s*\|\s*undefined$/, '$1 | undefined')
|
|
292
|
-
.trim()
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Initializes the wiki object.
|
|
297
|
-
*
|
|
298
|
-
* Инициализирует объект wiki.
|
|
299
|
-
*/
|
|
300
|
-
protected async initWiki(): Promise<WikiStorybook | undefined> {
|
|
301
|
-
const data = await this.getData()
|
|
302
|
-
|
|
303
|
-
if (data) {
|
|
304
|
-
return new WikiStorybook(
|
|
305
|
-
data.component,
|
|
306
|
-
data.props,
|
|
307
|
-
data.defaults,
|
|
308
|
-
data.wikiDesign,
|
|
309
|
-
wiki,
|
|
310
|
-
wikiDescriptions
|
|
311
|
-
)
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return undefined
|
|
315
|
-
}
|
|
316
|
-
}
|