@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
|
@@ -0,0 +1,3760 @@
|
|
|
1
|
+
import { n as e, t } from "./PropertiesConfig-ChizwW5y.js";
|
|
2
|
+
import { UI_DIRS_COMPONENTS as n, UI_DIRS_CONSTRUCTOR as r, UI_DIRS_ICONS as i, UI_DIRS_LIBRARY as a, UI_DIRS_STYLES as o, UI_DIRS_TOKENS as s, UI_DIRS_WIKI as c, UI_DIR_COMPONENTS as l, UI_DIR_CONSTRUCTOR as u, UI_DIR_DIST as d, UI_DIR_STRUCTURE as f, UI_EXTENSION_STYLE as p, UI_FILE_NAME_DESIGN as ee, UI_FILE_NAME_MEDIA as te, UI_FILE_NAME_PLUGIN as ne, UI_FILE_NAME_STYLE as re, UI_FILE_NAME_WIKI as ie, UI_FILE_PACKAGE as ae, UI_FILE_PROPERTY as oe, UI_FILE_STYLE_PROPERTIES as se, UI_FILE_STYLE_SCSS as ce, UI_KEY_CUSTOM as le, UI_PROJECT_CONSTRUCTOR_FULL_NAME as ue, UI_PROJECT_CONSTRUCTOR_NAME as m, UI_PROPERTY_FOR_PROPS as de, UI_STRUCTURE_CLASSES as fe } from "./config.js";
|
|
3
|
+
import { a as h, i as pe, n as g, r as _, t as v } from "./propertyTypes-DflziKuR.js";
|
|
4
|
+
import { ServerStorage as me, copyObject as he, forEach as y, getColumn as b, isFilled as x, isNull as ge, isObject as _e, isObjectNotArray as S, isSelected as C, isString as ve, replaceComponentName as ye, replaceRecursive as w, splice as be, strFill as xe, toArray as T, toCamelCase as E, toCamelCaseFirst as D, toKebabCase as O, uniqueArray as Se } from "@dxtmisha/functional-basic";
|
|
5
|
+
import k from "typescript";
|
|
6
|
+
import * as Ce from "sass";
|
|
7
|
+
//#region src/functions/getComponentPaths.ts
|
|
8
|
+
function A(e) {
|
|
9
|
+
return [...n, e];
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/media/templates/componentDocTemplates.ts
|
|
13
|
+
var we = {
|
|
14
|
+
"ComponentDoc.vue": "<script setup lang=\"ts\">\nimport {\n ComponentDocDefaults,\n type ComponentDocEmits,\n type ComponentDocProps,\n type ComponentDocSlots\n} from './types'\n\ndefineOptions({\n name: 'ComponentDoc'\n})\n\nwithDefaults(defineProps<ComponentDocProps>(), ComponentDocDefaults)\ndefineEmits<ComponentDocEmits>()\ndefineSlots<ComponentDocSlots>()\n<\/script>\n\n<template>\n <div class=\"component-doc\"></div>\n</template>\n\n<style lang=\"scss\">\n.component-doc {\n // Your styles here\n}\n</style>\n",
|
|
15
|
+
"index.ts": "import type { DefineSetupFnComponent, ShortEmitsToObject, SlotsType } from 'vue'\nimport type { ComponentDocEmits, ComponentDocProps, ComponentDocSlots } from './types'\n\nimport item from './ComponentDoc.vue'\n\nexport type * from './types'\n\nexport const ComponentDoc: DefineSetupFnComponent<\n ComponentDocProps,\n ShortEmitsToObject<ComponentDocEmits>,\n SlotsType<ComponentDocSlots>\n> = item\n",
|
|
16
|
+
"types.ts": "export type ComponentDocEmits = {\n // click: [value: string]\n}\n\nexport interface ComponentDocSlots {\n // default? (props: any): any\n}\n\nexport interface ComponentDocProps {\n // value?: string\n}\n\nexport const ComponentDocDefaults: ComponentDocProps = {\n // value: 'value'\n}\n",
|
|
17
|
+
"materials/prompt.md": "# AI Prompt: Component Implementation & Development (Materials)\n\nYou **MUST** read, study, and strictly follow the implementation rules, architectural constraints, and folder structures specified in:\n- `node_modules/@dxtmisha/scripts/ai-resources/componentMaterials.md`\n\n---\nCRITICAL PRIORITY OVERRIDE:\nEverything below this line has the absolute highest priority and overrides any previous constraints.\n",
|
|
18
|
+
"subcomponents/_.gitignore.txt": "",
|
|
19
|
+
"wiki/ComponentDoc.mdx": "import {Meta} from '@storybook/addon-docs/blocks'\nimport {StorybookMain} from '@dxtmisha/wiki/storybook'\n\nimport * as Component from './ComponentDoc.stories'\n\n<Meta of={Component}/>\n<StorybookMain\n name={'ComponentDoc'}\n description={'[description]'}\n story={Component.Component}\n/>\n\n[doc]\n",
|
|
20
|
+
"wiki/ComponentDoc.stories.ts": "import type { Meta, StoryObj } from '@storybook/vue3-vite'\n\nimport ComponentDoc from './../ComponentDoc.vue'\n\nconst meta = {\n title: '[project]/ComponentDoc',\n component: ComponentDoc\n} satisfies Meta<typeof ComponentDoc>\n\nexport default meta\n\ntype Story = StoryObj<typeof meta>\n\nexport const Component: Story = {\n render: args => ({\n components: { ComponentDoc },\n setup() {\n return { args }\n },\n template: `<div>\n <ComponentDoc v-bind=\"args\" />\n </div>`\n })\n}\n",
|
|
21
|
+
"wiki/prompt.md": "# AI Prompt: Component Documentation & Development\n\nYou **MUST** read, study, and strictly follow the documentation rules, output locations, and Storybook constraints specified in:\n- `node_modules/@dxtmisha/scripts/ai-resources/componentWiki.md`\n\n---\nCRITICAL PRIORITY RULE:\nEverything below this line has a higher priority than the text above it.\n"
|
|
22
|
+
}, Te = class {
|
|
23
|
+
path;
|
|
24
|
+
sample = we;
|
|
25
|
+
constructor(e) {
|
|
26
|
+
this.path = e;
|
|
27
|
+
}
|
|
28
|
+
make() {
|
|
29
|
+
console.info("Component create:", this.getName()), console.info("path:", this.path), this.getFilesSample().forEach((e) => {
|
|
30
|
+
this.writeFile(e, this.replacement(this.readSample(e)));
|
|
31
|
+
}), console.info("end");
|
|
32
|
+
}
|
|
33
|
+
getFilePath(e) {
|
|
34
|
+
return [...A(this.path), this.replacement(e)];
|
|
35
|
+
}
|
|
36
|
+
getFilesSample() {
|
|
37
|
+
return Object.keys(this.sample);
|
|
38
|
+
}
|
|
39
|
+
getName() {
|
|
40
|
+
let t = e.splitForDir(this.path);
|
|
41
|
+
return String(t[t.length - 1]);
|
|
42
|
+
}
|
|
43
|
+
getProjectName() {
|
|
44
|
+
return this.readPackage()?.name ?? "Project";
|
|
45
|
+
}
|
|
46
|
+
readPackage() {
|
|
47
|
+
return e.readFile("package.json") ?? {};
|
|
48
|
+
}
|
|
49
|
+
readSample(e) {
|
|
50
|
+
return this.sample?.[e] ?? "";
|
|
51
|
+
}
|
|
52
|
+
replacement(t) {
|
|
53
|
+
return t.replace("_.gitignore.txt", ".gitignore").replace(/ComponentDoc/g, this.getName()).replace(/component-doc/g, O(this.getName())).replace(/\[project]/g, this.getProjectName()).replace(/\[path]/g, e.splitForDir(this.path).join("/"));
|
|
54
|
+
}
|
|
55
|
+
writeFile(t, n) {
|
|
56
|
+
let r = this.getFilePath(t);
|
|
57
|
+
e.writeByPath(r, n), e.chmod(r);
|
|
58
|
+
}
|
|
59
|
+
}, Ee = class {
|
|
60
|
+
constructor() {}
|
|
61
|
+
make() {
|
|
62
|
+
this.getDirs().forEach((e) => new Te(e).make());
|
|
63
|
+
}
|
|
64
|
+
getDirs() {
|
|
65
|
+
return e.readDirOnlyRecursive(n).filter((t) => e.readDir(A(t)).length === 0);
|
|
66
|
+
}
|
|
67
|
+
}, De = [".cache"], Oe = ["step"], j = "system", M = class {
|
|
68
|
+
static time = 0;
|
|
69
|
+
static files = {};
|
|
70
|
+
static sizes = {};
|
|
71
|
+
static listenerName = ["global"];
|
|
72
|
+
static get(e, t, n, r = "json") {
|
|
73
|
+
if (this.is(e, t, r) && this.isBySystem(t)) return this.readFile(e, t, r);
|
|
74
|
+
this.listenerName.push(t);
|
|
75
|
+
let i = n();
|
|
76
|
+
return this.writeFile(e, t, i, r), this.listenerName.pop(), this.writeSystem(), i;
|
|
77
|
+
}
|
|
78
|
+
static read(t) {
|
|
79
|
+
if (e.is(t)) {
|
|
80
|
+
let n = e.joinPath(t);
|
|
81
|
+
this.listenerName.forEach((e) => {
|
|
82
|
+
e in this.files ? this.files?.[e]?.indexOf(n) === -1 && this.files[e].push(n) : this.files[e] = [n];
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return e.readFile(t);
|
|
86
|
+
}
|
|
87
|
+
static write(e, t) {
|
|
88
|
+
this.writeFile(Oe, e, t);
|
|
89
|
+
}
|
|
90
|
+
static clear() {
|
|
91
|
+
e.removeDir(this.getPath([]));
|
|
92
|
+
}
|
|
93
|
+
static is(t, n, r = "json") {
|
|
94
|
+
return e.is(this.getPathName(t, n, r));
|
|
95
|
+
}
|
|
96
|
+
static isBySystem(t = "global") {
|
|
97
|
+
let n = !0;
|
|
98
|
+
return t in this.files && this.files?.[t]?.forEach((r) => {
|
|
99
|
+
let i = e.stat(r);
|
|
100
|
+
i && i.mtimeMs > this.time && (n = !1, this.console(`Modified file: ${t}, ${r}`));
|
|
101
|
+
}), n;
|
|
102
|
+
}
|
|
103
|
+
static getPath(t) {
|
|
104
|
+
return [
|
|
105
|
+
e.getRoot(),
|
|
106
|
+
...De,
|
|
107
|
+
...T(t)
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
static getPathName(t, n, r = "json") {
|
|
111
|
+
return e.getPathFile(this.getPath(t), n, r);
|
|
112
|
+
}
|
|
113
|
+
static readFile(t, n, r = "json") {
|
|
114
|
+
return e.readFile(this.getPathName(t, n, r));
|
|
115
|
+
}
|
|
116
|
+
static writeFile(t, n, r, i = "json") {
|
|
117
|
+
e.write(this.getPath(t), n, r, i);
|
|
118
|
+
}
|
|
119
|
+
static writeSystem() {
|
|
120
|
+
if (this.listenerName.length < 2) {
|
|
121
|
+
this.time = (/* @__PURE__ */ new Date()).getTime();
|
|
122
|
+
let e = {
|
|
123
|
+
time: this.time,
|
|
124
|
+
files: this.files,
|
|
125
|
+
sizes: this.sizes
|
|
126
|
+
};
|
|
127
|
+
this.writeFile([], j, e), this.console("Writes the system data");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
static console(e) {
|
|
131
|
+
console.info("[Cache]", e);
|
|
132
|
+
}
|
|
133
|
+
static {
|
|
134
|
+
let e = this.readFile([], j);
|
|
135
|
+
e && (this.time = e.time, Object.assign(this.files, e.files), Object.assign(this.sizes, e.sizes));
|
|
136
|
+
}
|
|
137
|
+
}, ke = {
|
|
138
|
+
ref: {
|
|
139
|
+
transitionDuration: {
|
|
140
|
+
1: "45ms",
|
|
141
|
+
2: "75ms",
|
|
142
|
+
3: "100ms",
|
|
143
|
+
4: "150ms",
|
|
144
|
+
5: "200ms",
|
|
145
|
+
6: "250ms",
|
|
146
|
+
7: "280ms",
|
|
147
|
+
8: "300ms"
|
|
148
|
+
},
|
|
149
|
+
transitionFunction: {
|
|
150
|
+
linear: "linear",
|
|
151
|
+
e0i80: "cubic-bezier(0.0, 0.0, 0.2, 1)",
|
|
152
|
+
e40i0: "cubic-bezier(0.4, 0.0, 1, 1)",
|
|
153
|
+
e40i80: "cubic-bezier(0.4, 0.0, 0.2, 1)",
|
|
154
|
+
e40i40: "cubic-bezier(0.4, 0.0, 0.6, 1)"
|
|
155
|
+
},
|
|
156
|
+
_type: "var",
|
|
157
|
+
_category: "root"
|
|
158
|
+
},
|
|
159
|
+
sys: {
|
|
160
|
+
transitionDuration: {
|
|
161
|
+
standard: "{ref.transitionDuration.4}",
|
|
162
|
+
xs: "{ref.transitionDuration.1}",
|
|
163
|
+
sm: "{ref.transitionDuration.3}",
|
|
164
|
+
md: {
|
|
165
|
+
open: "{ref.transitionDuration.6}",
|
|
166
|
+
close: "{ref.transitionDuration.5}"
|
|
167
|
+
},
|
|
168
|
+
lg: {
|
|
169
|
+
open: "{ref.transitionDuration.8}",
|
|
170
|
+
close: "{ref.transitionDuration.6}"
|
|
171
|
+
},
|
|
172
|
+
axis: "{ref.transitionDuration.8}",
|
|
173
|
+
container: {
|
|
174
|
+
open: "{ref.transitionDuration.8}",
|
|
175
|
+
close: "{ref.transitionDuration.6}"
|
|
176
|
+
},
|
|
177
|
+
fade: {
|
|
178
|
+
enter: "{ref.transitionDuration.4}",
|
|
179
|
+
exit: "{ref.transitionDuration.2}",
|
|
180
|
+
through: "{ref.transitionDuration.8}"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
transitionFunction: {
|
|
184
|
+
linear: "linear",
|
|
185
|
+
standard: "{ref.transitionFunction.e40i80}",
|
|
186
|
+
emphasized: "{ref.transitionFunction.e40i40}",
|
|
187
|
+
acceleration: "{ref.transitionFunction.e40i0}",
|
|
188
|
+
deceleration: "{ref.transitionFunction.e0i80}"
|
|
189
|
+
},
|
|
190
|
+
_type: "var",
|
|
191
|
+
_category: "root"
|
|
192
|
+
}
|
|
193
|
+
}, N = class e {
|
|
194
|
+
static isConstructor(e) {
|
|
195
|
+
return e === "d";
|
|
196
|
+
}
|
|
197
|
+
static getDesigns() {
|
|
198
|
+
return ["d", t.getDesignName()];
|
|
199
|
+
}
|
|
200
|
+
static getComponentName(e, t) {
|
|
201
|
+
return `${e}${t ? `-${E(t)}` : ""}`;
|
|
202
|
+
}
|
|
203
|
+
static getClassName(e, t) {
|
|
204
|
+
return `.${this.getComponentName(e, t)}`;
|
|
205
|
+
}
|
|
206
|
+
static readFile(t, n) {
|
|
207
|
+
if (e.isConstructor(t)) return he(ke);
|
|
208
|
+
if (n) return M.read([...n, oe]);
|
|
209
|
+
}
|
|
210
|
+
}, Ae = "read", je = class {
|
|
211
|
+
designs;
|
|
212
|
+
paths;
|
|
213
|
+
constructorType = !1;
|
|
214
|
+
constructor(e) {
|
|
215
|
+
this.designs = e, this.paths = [], e.forEach((e) => {
|
|
216
|
+
this.paths.push({
|
|
217
|
+
design: O(e),
|
|
218
|
+
paths: this.getDir(e),
|
|
219
|
+
pathsComponent: this.getDirComponents(e)
|
|
220
|
+
});
|
|
221
|
+
}), this.paths?.[1] && N.isConstructor(this.paths?.[1].design) && (delete this.paths[1], this.constructorType = !0);
|
|
222
|
+
}
|
|
223
|
+
isConstructor() {
|
|
224
|
+
return this.constructorType;
|
|
225
|
+
}
|
|
226
|
+
getDesigns() {
|
|
227
|
+
return this.designs;
|
|
228
|
+
}
|
|
229
|
+
getPath(e) {
|
|
230
|
+
return this.paths.find((t) => t.design === e);
|
|
231
|
+
}
|
|
232
|
+
getPaths() {
|
|
233
|
+
return this.paths;
|
|
234
|
+
}
|
|
235
|
+
to(e, t, n) {
|
|
236
|
+
return M.get([Ae, e], `${e}-${t}`, () => {
|
|
237
|
+
let e = {}, r = this.getPath(t);
|
|
238
|
+
return r && (e = w(e, n(r.paths, r.pathsComponent, t))), e;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
toAll(e, t) {
|
|
242
|
+
return M.get([Ae], e, () => {
|
|
243
|
+
let n = {};
|
|
244
|
+
return this.designs.forEach((r) => {
|
|
245
|
+
n = w(n, this.to(e, r, t));
|
|
246
|
+
}), n;
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
getDir(t) {
|
|
250
|
+
if (!N.isConstructor(t)) return [e.getRoot(), ...s];
|
|
251
|
+
}
|
|
252
|
+
getDirComponents(r) {
|
|
253
|
+
if (!N.isConstructor(r)) return [
|
|
254
|
+
e.getRoot(),
|
|
255
|
+
...n,
|
|
256
|
+
t.getProjectName()
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
}, Me = [
|
|
260
|
+
_.design,
|
|
261
|
+
_.component,
|
|
262
|
+
_.classType
|
|
263
|
+
], P = class {
|
|
264
|
+
properties;
|
|
265
|
+
focusDesign;
|
|
266
|
+
constructor(e) {
|
|
267
|
+
this.properties = e;
|
|
268
|
+
}
|
|
269
|
+
isFocusDesign(e, t) {
|
|
270
|
+
return !!(t || ge(this.focusDesign) || e === this.focusDesign || e === "d");
|
|
271
|
+
}
|
|
272
|
+
get() {
|
|
273
|
+
if (this.focusDesign) {
|
|
274
|
+
let e = {};
|
|
275
|
+
return y(this.properties, (t, n) => {
|
|
276
|
+
(n === "d" || n === this.focusDesign) && (e[n] = t);
|
|
277
|
+
}), e;
|
|
278
|
+
}
|
|
279
|
+
return this.properties;
|
|
280
|
+
}
|
|
281
|
+
getDesigns() {
|
|
282
|
+
return Object.keys(this.properties);
|
|
283
|
+
}
|
|
284
|
+
getItem(e) {
|
|
285
|
+
let t = this.getInfo(e)?.item;
|
|
286
|
+
return t || console.error("[Items]", `No record: ${e}`), t;
|
|
287
|
+
}
|
|
288
|
+
getInfo(e) {
|
|
289
|
+
let t = this.getKeys(e), n = t.shift(), r = t.shift(), i = this.properties?.[n]?.value, a = [{
|
|
290
|
+
name: n,
|
|
291
|
+
item: this.properties?.[n] ?? { value: "" }
|
|
292
|
+
}];
|
|
293
|
+
if (S(i)) {
|
|
294
|
+
let e = r, o = i?.[r], s = a?.[0]?.item;
|
|
295
|
+
if (o) {
|
|
296
|
+
for (let n of t) if (a.push({
|
|
297
|
+
name: n,
|
|
298
|
+
item: o
|
|
299
|
+
}), s = o, e = n, o = S(o.value) ? o.value?.[n] : void 0, !o) break;
|
|
300
|
+
}
|
|
301
|
+
if (o) return {
|
|
302
|
+
design: n,
|
|
303
|
+
component: r,
|
|
304
|
+
name: e,
|
|
305
|
+
index: this.getIndex(a),
|
|
306
|
+
value: o.value,
|
|
307
|
+
item: o,
|
|
308
|
+
parent: s,
|
|
309
|
+
parents: a
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
getKeys(e) {
|
|
314
|
+
let t = e.replace(/^\{|}$/gi, "").split(".");
|
|
315
|
+
return y(t, (e) => e.match(/^&/) ? e : E(e));
|
|
316
|
+
}
|
|
317
|
+
getName(e, t) {
|
|
318
|
+
return this.getReName(e, t).replace(/\(.*?$/, "");
|
|
319
|
+
}
|
|
320
|
+
getReName(e, t) {
|
|
321
|
+
return t?.[g.name] ?? t?.[g.rename] ?? e;
|
|
322
|
+
}
|
|
323
|
+
getParentsName(e, t) {
|
|
324
|
+
return y(e, ({ name: e, item: n }) => {
|
|
325
|
+
if (!t || typeof n?.[g.variable] == "string" && (t.indexOf(n[g.variable]) !== -1 || Me.indexOf(n[g.variable]) !== -1)) return E(e);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
getMedia() {
|
|
329
|
+
let e = {};
|
|
330
|
+
return this.findCategory(v.media).forEach(({ design: t, item: n }) => {
|
|
331
|
+
S(n.value) && Object.assign(e, { [t]: n.value });
|
|
332
|
+
}), e;
|
|
333
|
+
}
|
|
334
|
+
getLink(e, t, n, r = ".") {
|
|
335
|
+
return n.match(/\?/) ? n.replace(/\?\?(?![ _-])/g, `${e}${r}${t}${r}`).replace(/\?\?(?=[ _-])/g, `${e}${r}${t}`).replace(/\?/g, `${e}${r}`) : this.getLinkByDesign(e, n);
|
|
336
|
+
}
|
|
337
|
+
getLinkToName(e, t, n) {
|
|
338
|
+
return this.getLink(e, t, n, "-").replace(/[a-zA-Z]+/gi, (e) => E(e));
|
|
339
|
+
}
|
|
340
|
+
getLinkToValue(e, t, n) {
|
|
341
|
+
return this.getLink(e, t, n).replace(/(?<=(?<!#)\{.*?)[a-zA-Z]+(?=.*?})/gi, (e) => E(e));
|
|
342
|
+
}
|
|
343
|
+
getLinkForName(e, t, n) {
|
|
344
|
+
return this.getLink(e, t, n, "-");
|
|
345
|
+
}
|
|
346
|
+
getLinkByDesign(e, t) {
|
|
347
|
+
return t.match("{") ? t?.replace(/(?<=(?<!#)\{)[^.{}]+/g, (t) => this.getDesigns().indexOf(t) === -1 ? `${e}.${t}` : t) : t;
|
|
348
|
+
}
|
|
349
|
+
each(e, t) {
|
|
350
|
+
return t ? S(t.item.value) ? this.read(e, !0, t.design, t.component, t.item.value, t.item, t.parents) : [] : this.read(e);
|
|
351
|
+
}
|
|
352
|
+
eachMainOnly(e, t) {
|
|
353
|
+
return t ? S(t.item.value) ? this.read(e, !1, t.design, t.component, t.item.value, t.item, t.parents) : [] : this.read(e, !1);
|
|
354
|
+
}
|
|
355
|
+
find(e) {
|
|
356
|
+
let t = [];
|
|
357
|
+
return this.each((n) => {
|
|
358
|
+
e(n) && t.push(n);
|
|
359
|
+
}), t;
|
|
360
|
+
}
|
|
361
|
+
findCategory(e) {
|
|
362
|
+
let t = [];
|
|
363
|
+
return this.each((n) => {
|
|
364
|
+
C(n.item?.[g.category], e) && t.push(n);
|
|
365
|
+
}), t;
|
|
366
|
+
}
|
|
367
|
+
findVariable(e) {
|
|
368
|
+
let t = [];
|
|
369
|
+
return this.each((n) => {
|
|
370
|
+
C(n.item?.[g.variable], e) && t.push(n);
|
|
371
|
+
}), t;
|
|
372
|
+
}
|
|
373
|
+
setFocusDesign(e) {
|
|
374
|
+
return this.focusDesign = e, this;
|
|
375
|
+
}
|
|
376
|
+
write(e) {
|
|
377
|
+
M.write(`${this.getDesigns().join("-")}-${e}`, this.properties);
|
|
378
|
+
}
|
|
379
|
+
getIndex(e) {
|
|
380
|
+
return `${b(e, "name").join(".")}`;
|
|
381
|
+
}
|
|
382
|
+
read(e, t = !0, n, r, i = this.properties, a, o = []) {
|
|
383
|
+
let s = [], c;
|
|
384
|
+
return y(i, (i, l) => {
|
|
385
|
+
if (this.isFocusDesign(l, n)) {
|
|
386
|
+
let u = n ?? l, d = n && (r ?? l), f = [...o, {
|
|
387
|
+
name: l,
|
|
388
|
+
item: i
|
|
389
|
+
}], p = e({
|
|
390
|
+
design: u,
|
|
391
|
+
component: d,
|
|
392
|
+
name: l,
|
|
393
|
+
index: this.getIndex(f),
|
|
394
|
+
value: i.value,
|
|
395
|
+
item: i,
|
|
396
|
+
previous: c,
|
|
397
|
+
parent: a,
|
|
398
|
+
parents: o
|
|
399
|
+
});
|
|
400
|
+
p !== void 0 && s.push(p), t && S(i.value) && s.push(...this.read(e, t, u, d, i.value, i, f)), c = i;
|
|
401
|
+
}
|
|
402
|
+
}), s;
|
|
403
|
+
}
|
|
404
|
+
}, Ne = (t) => {
|
|
405
|
+
let n = {};
|
|
406
|
+
try {
|
|
407
|
+
let i = e.getRoot(), a = e.getRootProject(), o = [
|
|
408
|
+
[i, ...r],
|
|
409
|
+
[
|
|
410
|
+
i,
|
|
411
|
+
"..",
|
|
412
|
+
m,
|
|
413
|
+
...r
|
|
414
|
+
],
|
|
415
|
+
...a ? [[
|
|
416
|
+
a,
|
|
417
|
+
m,
|
|
418
|
+
...r
|
|
419
|
+
]] : []
|
|
420
|
+
].find((t) => e.is(t));
|
|
421
|
+
o && y(t, (t) => {
|
|
422
|
+
let r = e.readFile([
|
|
423
|
+
...o,
|
|
424
|
+
t,
|
|
425
|
+
oe
|
|
426
|
+
]);
|
|
427
|
+
r && (n[t] = r);
|
|
428
|
+
});
|
|
429
|
+
} catch (e) {
|
|
430
|
+
console.error("getConstructorProperties", e);
|
|
431
|
+
}
|
|
432
|
+
return n;
|
|
433
|
+
}, F = class {
|
|
434
|
+
static SYMBOLS = {
|
|
435
|
+
$: _.var,
|
|
436
|
+
"::": _.virtual,
|
|
437
|
+
":": _.selector,
|
|
438
|
+
"~": _.state,
|
|
439
|
+
"#": _.subclass,
|
|
440
|
+
"@@": _.linkClass,
|
|
441
|
+
"@": _.link,
|
|
442
|
+
"&&": _.root,
|
|
443
|
+
"&": _.scss,
|
|
444
|
+
"--": _.none
|
|
445
|
+
};
|
|
446
|
+
static isInType(e, t) {
|
|
447
|
+
return x(e) && x(t) ? !!C(e, t) : !1;
|
|
448
|
+
}
|
|
449
|
+
static isTypeInName(e) {
|
|
450
|
+
return !!e.match(this.getExpSymbols());
|
|
451
|
+
}
|
|
452
|
+
static isMedia(e) {
|
|
453
|
+
return this.isInType(e, [_.media, _.mediaMax]);
|
|
454
|
+
}
|
|
455
|
+
static isContainer(e) {
|
|
456
|
+
return this.isInType(e, [_.container, _.containerMax]);
|
|
457
|
+
}
|
|
458
|
+
static isScss(e) {
|
|
459
|
+
return e === _.scss || !!e.match(/^&(?!&)/);
|
|
460
|
+
}
|
|
461
|
+
static isRoot(e) {
|
|
462
|
+
return e === _.root || !!e.match(/^&&/);
|
|
463
|
+
}
|
|
464
|
+
static getTypeInName(e) {
|
|
465
|
+
if (this.isTypeInName(e)) {
|
|
466
|
+
let t = e.replace(this.getExpSymbols(), "$1");
|
|
467
|
+
return t in this.SYMBOLS ? this.SYMBOLS[t] : O(t);
|
|
468
|
+
}
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
static getBySymbol(e) {
|
|
472
|
+
return this.SYMBOLS?.[e];
|
|
473
|
+
}
|
|
474
|
+
static getExpSymbols() {
|
|
475
|
+
return RegExp(`^(${this.symbolsToString()}|[\\w-]+(?=[|]))(.*?)$`);
|
|
476
|
+
}
|
|
477
|
+
static symbolsToString() {
|
|
478
|
+
return Object.keys(this.SYMBOLS).join("|");
|
|
479
|
+
}
|
|
480
|
+
}, I = class {
|
|
481
|
+
static isSpecialKey(e) {
|
|
482
|
+
return typeof e == "string" && ([
|
|
483
|
+
"value",
|
|
484
|
+
"type",
|
|
485
|
+
"description"
|
|
486
|
+
].indexOf(e) !== -1 || !!e.match(/^_/));
|
|
487
|
+
}
|
|
488
|
+
static isFull(e) {
|
|
489
|
+
return !!e.match(/^=|\|=/);
|
|
490
|
+
}
|
|
491
|
+
static isSeparator(e) {
|
|
492
|
+
return !!e.match(t.getSeparator());
|
|
493
|
+
}
|
|
494
|
+
static getName(e, t = !0) {
|
|
495
|
+
let n = e.replace(F.getExpSymbols(), "$2").replace(/^[|]/, "");
|
|
496
|
+
return this.isSeparator(n) || !t ? n : E(n);
|
|
497
|
+
}
|
|
498
|
+
static reKey(e, t) {
|
|
499
|
+
let n = this.getName(e);
|
|
500
|
+
if (t) {
|
|
501
|
+
if (F.isMedia(t) && !n.match(/^media[A-Z]/) || F.isContainer(t) && !n.match(/^container[A-Z]/)) return E(`${t}-${n}`);
|
|
502
|
+
if (F.isScss(t)) return `&${this.getName(e, !1)}`;
|
|
503
|
+
if (F.isRoot(t)) return this.getName(e, !1);
|
|
504
|
+
}
|
|
505
|
+
return n;
|
|
506
|
+
}
|
|
507
|
+
}, L = class {
|
|
508
|
+
static isFull(e) {
|
|
509
|
+
return typeof e == "string" && !!e.match(this.getExpFull());
|
|
510
|
+
}
|
|
511
|
+
static isColor(e) {
|
|
512
|
+
return !!(typeof e == "string" && e.match(/^#/i));
|
|
513
|
+
}
|
|
514
|
+
static isColorWithOpacity(e) {
|
|
515
|
+
return !!(typeof e == "string" && e.match(/^#[a-z0-9]{8}/i));
|
|
516
|
+
}
|
|
517
|
+
static reValue(e) {
|
|
518
|
+
return this.isFull(e) ? e.replace(this.getExpFull(), "") : typeof e == "number" ? e.toString() : e;
|
|
519
|
+
}
|
|
520
|
+
static getExpFull() {
|
|
521
|
+
return /^=/;
|
|
522
|
+
}
|
|
523
|
+
}, R = class {
|
|
524
|
+
static to(e) {
|
|
525
|
+
let t = {};
|
|
526
|
+
return y(e, (e, n) => {
|
|
527
|
+
let r = this.getItem(n, e), i = I.reKey(n, r?.[g.type]);
|
|
528
|
+
S(r.value) && (r.value = this.to(r.value)), this.addValue(r), r[g.index] = n.replace(/^=/, ""), i in r ? t[i] = w(t[i] ?? {}, r) : t[i] = r;
|
|
529
|
+
}), t;
|
|
530
|
+
}
|
|
531
|
+
static getItem(e, t) {
|
|
532
|
+
let n = this.toItem(t);
|
|
533
|
+
return this.addType(e, n), this.addFull(e, n), n;
|
|
534
|
+
}
|
|
535
|
+
static getValueAndSpecial(e) {
|
|
536
|
+
let t = { value: e?.value || {} };
|
|
537
|
+
return y(e, (e, n) => {
|
|
538
|
+
I.isSpecialKey(n) ? t[n] = e : t.value[n] = e;
|
|
539
|
+
}), t;
|
|
540
|
+
}
|
|
541
|
+
static addType(e, t) {
|
|
542
|
+
if (!(g.type in t)) {
|
|
543
|
+
let n = F.getTypeInName(e);
|
|
544
|
+
n && (t[g.type] = n);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
static addFull(e, t) {
|
|
548
|
+
I.isFull(e) && (t[g.fullName] = !0), typeof t.value == "string" && (L.isFull(t.value) || e.match(/aspect/i)) && (t[g.fullValue] = !0);
|
|
549
|
+
}
|
|
550
|
+
static addValue(e) {
|
|
551
|
+
e.value = L.reValue(e.value);
|
|
552
|
+
}
|
|
553
|
+
static toItem(e) {
|
|
554
|
+
return typeof e != "object" || Array.isArray(e) ? { value: e } : x(e) ? !("value" in e) || S(e.value) ? this.getValueAndSpecial(e) : e : { value: {} };
|
|
555
|
+
}
|
|
556
|
+
}, Pe = "settings", Fe = class {
|
|
557
|
+
path;
|
|
558
|
+
constructor(e) {
|
|
559
|
+
this.path = e;
|
|
560
|
+
}
|
|
561
|
+
get() {
|
|
562
|
+
return {
|
|
563
|
+
...this.getComponents(),
|
|
564
|
+
...this.getConstructors()
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
getComponentList() {
|
|
568
|
+
let i = [], a = [...n, t.getProjectName()];
|
|
569
|
+
return this.path.isConstructor() && (a = [...r]), e.readDir(a).forEach((e) => i.push(e)), i;
|
|
570
|
+
}
|
|
571
|
+
getComponents() {
|
|
572
|
+
return this.path.toAll(Pe, (t, n, r) => {
|
|
573
|
+
let i = {};
|
|
574
|
+
return n && e.readDir(n).forEach((e) => {
|
|
575
|
+
let t = N.readFile(r, [...n, e]);
|
|
576
|
+
x(t) && (i = w(i, R.to({ [r]: { [O(e)]: t } })));
|
|
577
|
+
}), i;
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
getConstructors() {
|
|
581
|
+
return R.to({ d: Ne(this.getComponentList()) });
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region src/classes/Properties/convector/convectorColor.ts
|
|
586
|
+
function Ie(e) {
|
|
587
|
+
let t = e?.$extensions?.["studio.tokens"]?.modify?.type, n = e?.$extensions?.["studio.tokens"]?.modify?.value;
|
|
588
|
+
if (t) switch (t) {
|
|
589
|
+
case "alpha": e[g.cssColorOpacity] = n?.toString() ?? "1";
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region src/classes/Properties/convector/convectorShadow.ts
|
|
594
|
+
function Le(e) {
|
|
595
|
+
let t = e?.value;
|
|
596
|
+
if (_e(t)) {
|
|
597
|
+
let n = [];
|
|
598
|
+
T(t).forEach((e) => {
|
|
599
|
+
let t = [], { type: r, color: i, x: a, y: o, blur: s, spread: c } = e, l = i.match(/^{/) ? `@ui.toCustomVarRgb(${i})` : i;
|
|
600
|
+
r === "innerShadow" && t.push("inset"), t.push(a && a !== "0" && a.match(/^[0-9]+$/) ? `${a}px` : a ?? "0", o && o !== "0" && o.match(/^[0-9]+$/) ? `${o}px` : o ?? "0", s && s !== "0" && s.match(/^[0-9]+$/) ? `${s}px` : s ?? "0", c && c !== "0" && c.match(/^-?[0-9]+$/) ? `${c}px` : c ?? "0", l ?? "rgba(0, 0, 0, 1)"), n.push(t.join(" ").trim());
|
|
601
|
+
}), e.value = n.join(", ");
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region src/classes/Properties/convector/convectorFontFamilies.ts
|
|
606
|
+
function Re(e) {
|
|
607
|
+
typeof e?.value == "string" && !e.value.match(/[{}]/) && (e.value = `'${e.value}', sans-serif`);
|
|
608
|
+
}
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/classes/Properties/convector/convectorTypography.ts
|
|
611
|
+
function ze(e) {
|
|
612
|
+
ve(e?.value) && (e.value = { basic: e.value });
|
|
613
|
+
}
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region src/classes/Properties/PropertiesConvector.ts
|
|
616
|
+
var z = {
|
|
617
|
+
boxShadow: Le,
|
|
618
|
+
color: Ie,
|
|
619
|
+
fontFamilies: Re,
|
|
620
|
+
typography: ze
|
|
621
|
+
}, B = class {
|
|
622
|
+
static to(e) {
|
|
623
|
+
y(e, (e) => {
|
|
624
|
+
e?.type && e.type in z ? z[e.type]?.(e) : e?.value && S(e.value) ? this.to(e.value) : S(e) && this.to(e);
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
}, Be = class {
|
|
628
|
+
properties;
|
|
629
|
+
root;
|
|
630
|
+
constructor(e, t) {
|
|
631
|
+
this.properties = e, this.root = t;
|
|
632
|
+
}
|
|
633
|
+
to(t = this.properties, n = this.root) {
|
|
634
|
+
let r = {};
|
|
635
|
+
return y(t, (t, i) => {
|
|
636
|
+
if (typeof t.value == "string" && F.isInType(t[g.type], [_.file])) {
|
|
637
|
+
let { path: i, link: a } = this.initLink(n, t.value), o = this.readByLink(this.read(i), a);
|
|
638
|
+
x(o) && (B.to(o), r = w(r, this.to(R.to(o), [e.getPathDir(i)])));
|
|
639
|
+
} else r = S(t.value) ? w(r, { [i]: {
|
|
640
|
+
...t,
|
|
641
|
+
value: this.to(t.value, n)
|
|
642
|
+
} }) : w(r, { [i]: t });
|
|
643
|
+
}), r;
|
|
644
|
+
}
|
|
645
|
+
getPath(e, t) {
|
|
646
|
+
return [...e, ...t.split("/")];
|
|
647
|
+
}
|
|
648
|
+
initLink(e, t) {
|
|
649
|
+
let n = t.split("#", 2);
|
|
650
|
+
return {
|
|
651
|
+
path: this.getPath(e, n[0]),
|
|
652
|
+
link: n?.[1]
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
read(t) {
|
|
656
|
+
return e.isDir(t) ? this.readByDir(t) : M.read(t) ?? {};
|
|
657
|
+
}
|
|
658
|
+
readByLink(e, t) {
|
|
659
|
+
let n = e;
|
|
660
|
+
if (t) for (let e of t.split(".")) if (n && e in n) n = n[e];
|
|
661
|
+
else return;
|
|
662
|
+
return n;
|
|
663
|
+
}
|
|
664
|
+
readByDir(t) {
|
|
665
|
+
let n = e.readDir(t), r = {};
|
|
666
|
+
return n?.sort(), n?.forEach((n) => {
|
|
667
|
+
let i = e.parse(n);
|
|
668
|
+
i.ext === ".json" && (r[i.name] = M.read([...t, n]) ?? {});
|
|
669
|
+
}), r;
|
|
670
|
+
}
|
|
671
|
+
}, V = class {
|
|
672
|
+
static is(e, n = t.getSeparatorLimit()) {
|
|
673
|
+
if (n > 0) for (let t in e) {
|
|
674
|
+
if (I.isSeparator(t)) return !0;
|
|
675
|
+
let r = e?.[t]?.value;
|
|
676
|
+
if (r && S(r) && this.is(r, n - 1)) return !0;
|
|
677
|
+
}
|
|
678
|
+
return !1;
|
|
679
|
+
}
|
|
680
|
+
static to(e) {
|
|
681
|
+
let t = {};
|
|
682
|
+
return y(e, (e, n) => {
|
|
683
|
+
let r = {
|
|
684
|
+
...e,
|
|
685
|
+
value: S(e.value) ? this.to(e.value) : e.value
|
|
686
|
+
};
|
|
687
|
+
t = I.isSeparator(n) ? w(t, this.wrap(r, this.removeBasicName(n))) : w(t, { [n]: r });
|
|
688
|
+
}), t;
|
|
689
|
+
}
|
|
690
|
+
static removeBasicName(e) {
|
|
691
|
+
let n = t.getSeparator(), r = t.getSeparatorBasicName();
|
|
692
|
+
return e.replace(RegExp(`${n}${r}`, "g"), "").replace(RegExp(`${n}$`), "").split(n);
|
|
693
|
+
}
|
|
694
|
+
static wrap(e, t) {
|
|
695
|
+
let n = e;
|
|
696
|
+
return [...t].reverse().forEach((e) => {
|
|
697
|
+
n = { value: { [e]: {
|
|
698
|
+
...n,
|
|
699
|
+
[g.wrap]: !0
|
|
700
|
+
} } };
|
|
701
|
+
}), n.value;
|
|
702
|
+
}
|
|
703
|
+
}, Ve = class {
|
|
704
|
+
static to(e) {
|
|
705
|
+
y(e, (e) => {
|
|
706
|
+
if (S(e.value) && (this.to(e.value), e?.[g.wrap])) {
|
|
707
|
+
let t = e.value, n = this.getSelectors(t);
|
|
708
|
+
n.quantity > 1 && y(n.properties, (e, r) => {
|
|
709
|
+
if (r in t) {
|
|
710
|
+
let n = t[r]?.value;
|
|
711
|
+
typeof n == "string" && this.removeProperties(r, e?.values?.[n]);
|
|
712
|
+
} else if (e.quantity === n.quantity) {
|
|
713
|
+
let n = this.getMaxRepeat(e.values);
|
|
714
|
+
n && (t[r] = {
|
|
715
|
+
...n.item[0]?.[r],
|
|
716
|
+
value: n.value
|
|
717
|
+
}, this.removeProperties(r, n.item));
|
|
718
|
+
}
|
|
719
|
+
}), delete e[g.wrap];
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
static getSelector(e, t) {
|
|
724
|
+
return t in e || (e[t] = {
|
|
725
|
+
values: {},
|
|
726
|
+
quantity: 0
|
|
727
|
+
}), e[t];
|
|
728
|
+
}
|
|
729
|
+
static getSelectors(e) {
|
|
730
|
+
let t = {
|
|
731
|
+
properties: {},
|
|
732
|
+
quantity: 0
|
|
733
|
+
};
|
|
734
|
+
return y(e, (e) => {
|
|
735
|
+
S(e.value) && (t.quantity++, this.addItem(t.properties, e.value));
|
|
736
|
+
}), t;
|
|
737
|
+
}
|
|
738
|
+
static getMaxRepeat(e) {
|
|
739
|
+
let t = 0, n;
|
|
740
|
+
return y(e, (e, r) => {
|
|
741
|
+
e.length > 1 && (e.length > t || n === void 0) && (t = e.length, n = {
|
|
742
|
+
value: r,
|
|
743
|
+
item: e
|
|
744
|
+
});
|
|
745
|
+
}), n;
|
|
746
|
+
}
|
|
747
|
+
static getValue(e, t) {
|
|
748
|
+
return t in e.values || (e.values[t] = []), e.values[t];
|
|
749
|
+
}
|
|
750
|
+
static addItem(e, t) {
|
|
751
|
+
y(t, (n, r) => {
|
|
752
|
+
let i = this.getSelector(e, r), a = this.getValue(i, n.value);
|
|
753
|
+
i.quantity++, a.push(t);
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
static removeProperties(e, t) {
|
|
757
|
+
t?.forEach((t) => delete t[e]);
|
|
758
|
+
}
|
|
759
|
+
}, He = "main", Ue = class {
|
|
760
|
+
path;
|
|
761
|
+
constructor(e) {
|
|
762
|
+
this.path = e;
|
|
763
|
+
}
|
|
764
|
+
get() {
|
|
765
|
+
return this.path.toAll(He, (e, t, n) => {
|
|
766
|
+
let r = N.readFile(n, e);
|
|
767
|
+
return x(r) && (B.to(r), r = R.to({ [n]: r }), e && (r = new Be(r, e).to()), V.is(r) && (r = V.to(r), Ve.to(r))), r ?? {};
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
getBySettings(e) {
|
|
771
|
+
let t = this.get();
|
|
772
|
+
return y(e, (e, n) => {
|
|
773
|
+
let r = t?.[n]?.value;
|
|
774
|
+
r && S(r) && S(e.value) && y(e.value, (e, t) => {
|
|
775
|
+
let n = r?.[t]?.value;
|
|
776
|
+
n && S(n) && S(e.value) && y(e.value, (e, t) => {
|
|
777
|
+
this.copySettings(e, n?.[t]);
|
|
778
|
+
});
|
|
779
|
+
});
|
|
780
|
+
}), t;
|
|
781
|
+
}
|
|
782
|
+
copySettings(e, t) {
|
|
783
|
+
return t && y(e, (e, n) => {
|
|
784
|
+
n.match(/^_/) && n in t && t[n] !== e && (t[n] = e);
|
|
785
|
+
}), this;
|
|
786
|
+
}
|
|
787
|
+
}, H = class {
|
|
788
|
+
items;
|
|
789
|
+
constructor(e) {
|
|
790
|
+
this.items = e;
|
|
791
|
+
}
|
|
792
|
+
to() {
|
|
793
|
+
this.init(), this.write();
|
|
794
|
+
}
|
|
795
|
+
write() {
|
|
796
|
+
this.items.write(this.FILE_CACHE);
|
|
797
|
+
}
|
|
798
|
+
}, We = class extends H {
|
|
799
|
+
FILE_CACHE = "001-replace";
|
|
800
|
+
init() {
|
|
801
|
+
this.items.each(({ item: e }) => {
|
|
802
|
+
e?.[g.replace] && typeof e.value == "string" && (e.value = this.getValue(this.getInfo(e[g.replace]), e.value), delete e[g.replace]);
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
getInfo(e) {
|
|
806
|
+
return typeof e == "object" ? {
|
|
807
|
+
pattern: e?.pattern,
|
|
808
|
+
flags: e?.flags || "i",
|
|
809
|
+
replace: e?.replace || "$1"
|
|
810
|
+
} : {
|
|
811
|
+
pattern: e || void 0,
|
|
812
|
+
flags: "i",
|
|
813
|
+
replace: "$1"
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
getValue(e, t) {
|
|
817
|
+
return e?.pattern ? t.replace(new RegExp(e.pattern, e.flags), e.replace) : t;
|
|
818
|
+
}
|
|
819
|
+
}, Ge = "basic", U = "palette", Ke = class extends H {
|
|
820
|
+
items;
|
|
821
|
+
FILE_CACHE = "002-palette";
|
|
822
|
+
palette;
|
|
823
|
+
constructor(e) {
|
|
824
|
+
super(e), this.items = e, this.palette = this.items.findCategory(v.palette);
|
|
825
|
+
}
|
|
826
|
+
init() {
|
|
827
|
+
this.read(), this.items.findCategory(v.theme).forEach(({ design: e, name: t, item: n }) => n?.value && S(n.value) && this.read(n.value, t, e));
|
|
828
|
+
}
|
|
829
|
+
getParent(e, t) {
|
|
830
|
+
return U in t || (t[U] = {
|
|
831
|
+
value: {},
|
|
832
|
+
[g.type]: e === v.colors ? _.classType : _.component,
|
|
833
|
+
[g.category]: e
|
|
834
|
+
}), t[U].value;
|
|
835
|
+
}
|
|
836
|
+
getClass(e, t) {
|
|
837
|
+
return e?.[t] || (e[t] = {
|
|
838
|
+
value: {},
|
|
839
|
+
[g.type]: _.state
|
|
840
|
+
}), e[t].value;
|
|
841
|
+
}
|
|
842
|
+
getName(e, t) {
|
|
843
|
+
return `${e}-${t}`;
|
|
844
|
+
}
|
|
845
|
+
getValue(e, t) {
|
|
846
|
+
return `{${e}.${t}}`;
|
|
847
|
+
}
|
|
848
|
+
getValueDefault(e, t) {
|
|
849
|
+
let n = e?.[g.default];
|
|
850
|
+
return x(n) ? _e(n) ? n?.[t] : n : "default";
|
|
851
|
+
}
|
|
852
|
+
read(e, t = Ge, n) {
|
|
853
|
+
this.palette.forEach(({ design: r, item: i, parents: a, index: o }) => {
|
|
854
|
+
if (!n || n === r) {
|
|
855
|
+
let n = i?.[g.theme];
|
|
856
|
+
if (!n || n === t) {
|
|
857
|
+
let n = this.getParent(e ? v.colors : v.class, e ?? a?.[0]?.item.value);
|
|
858
|
+
n && S(i.value) && y(i.value, (e, r) => {
|
|
859
|
+
let a = this.getClass(n, r);
|
|
860
|
+
S(e.value) && e?.[g.category] !== v.paletteNone && this.addItem(a, `${o}.${r}`, t, e.value), this.addDefault(a, t, i);
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
addItem(e, t, n, r) {
|
|
867
|
+
y(r, (r, i) => {
|
|
868
|
+
r && (e[this.getName(n, i)] = {
|
|
869
|
+
value: this.getValue(t, i),
|
|
870
|
+
[g.type]: _.var,
|
|
871
|
+
[g.category]: v.color
|
|
872
|
+
});
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
addDefault(e, t, n) {
|
|
876
|
+
let r = this.getValueDefault(n, t), i = this.getName(t, r);
|
|
877
|
+
e?.[i] && (e["sys-palette"] = {
|
|
878
|
+
...e[i],
|
|
879
|
+
[g.fullName]: !0
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
}, qe = 32, Je = 24, Ye = [
|
|
883
|
+
_.link,
|
|
884
|
+
_.var,
|
|
885
|
+
_.property,
|
|
886
|
+
_.selector,
|
|
887
|
+
_.virtual,
|
|
888
|
+
_.scss
|
|
889
|
+
], Xe = class extends H {
|
|
890
|
+
FILE_CACHE = "004-link";
|
|
891
|
+
update = 1;
|
|
892
|
+
ignore = [];
|
|
893
|
+
links = [];
|
|
894
|
+
init() {
|
|
895
|
+
let e = qe;
|
|
896
|
+
for (; this.update > 0 && e-- > 0;) this.update = 0, this.read();
|
|
897
|
+
}
|
|
898
|
+
read(e, t, n = this.items.get(), r = []) {
|
|
899
|
+
let i = [], a = !1;
|
|
900
|
+
if (r.length > Je) return a;
|
|
901
|
+
for (let [o, s] of Object.entries(n)) {
|
|
902
|
+
let c = [...r, o];
|
|
903
|
+
if (e && t && this.isType(s) && this.isValue(s.value) && !this.isIgnore(s.value)) {
|
|
904
|
+
let r = this.items.getLink(e, t, s.value), l = this.items.getInfo(r);
|
|
905
|
+
if (l) {
|
|
906
|
+
if (this.isData(l.value)) {
|
|
907
|
+
if (!this.isLink(r) && this.read(l.design, l.component, l.value, c)) {
|
|
908
|
+
a = !0;
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
911
|
+
this.addLink(r), this.update++, i.push({
|
|
912
|
+
name: o,
|
|
913
|
+
data: l.value,
|
|
914
|
+
properties: n
|
|
915
|
+
});
|
|
916
|
+
break;
|
|
917
|
+
}
|
|
918
|
+
typeof l.value == "string" && this.addIgnore(l.value);
|
|
919
|
+
}
|
|
920
|
+
} else S(s.value) && this.read(e ?? o, e && (t ?? o), s.value, c) && (a = !0);
|
|
921
|
+
}
|
|
922
|
+
return i.length > 0 && this.add(r, i), a;
|
|
923
|
+
}
|
|
924
|
+
isType(e) {
|
|
925
|
+
return !e?.[g.type] || F.isInType(e[g.type], Ye);
|
|
926
|
+
}
|
|
927
|
+
isValue(e) {
|
|
928
|
+
return typeof e == "string" && !!e.match(/^{[^{}]+}$/) && !e.match(/[{?.]sys/);
|
|
929
|
+
}
|
|
930
|
+
isIgnore(e) {
|
|
931
|
+
return this.ignore.indexOf(e) !== -1;
|
|
932
|
+
}
|
|
933
|
+
isLink(e) {
|
|
934
|
+
return this.links.indexOf(e) !== -1;
|
|
935
|
+
}
|
|
936
|
+
isData(e) {
|
|
937
|
+
return S(e) && Object.keys(e).length > 0;
|
|
938
|
+
}
|
|
939
|
+
add(e, t) {
|
|
940
|
+
let n = this.items.getInfo(`{${e.join(".")}}`);
|
|
941
|
+
n && t.forEach(({ name: e, data: t, properties: r }) => {
|
|
942
|
+
n.item.value = be(r, t, e);
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
addIgnore(e) {
|
|
946
|
+
this.ignore.push(e);
|
|
947
|
+
}
|
|
948
|
+
addLink(e) {
|
|
949
|
+
this.links.push(e);
|
|
950
|
+
}
|
|
951
|
+
}, W = /(?<={[^}]*?){([^{}]+)}/g, Ze = class extends H {
|
|
952
|
+
FILE_CACHE = "006-sub";
|
|
953
|
+
init() {
|
|
954
|
+
this.items.each((e) => {
|
|
955
|
+
this.is(e.value) && this.read(e);
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
is(e) {
|
|
959
|
+
return typeof e == "string" && !!e.match(W);
|
|
960
|
+
}
|
|
961
|
+
getValue(e, t, n) {
|
|
962
|
+
let r = 24, i = !0;
|
|
963
|
+
for (; i && r-- > 0;) i = !1, n = n.replace(W, (n, r) => (i = !0, this.items.getItem(this.items.getLink(e, t, n))?.value ?? r));
|
|
964
|
+
return n.trim();
|
|
965
|
+
}
|
|
966
|
+
read({ design: e, component: t, item: n }) {
|
|
967
|
+
t && typeof n.value == "string" && (n.value = this.getValue(e, t, n.value), n?.[g.fullValue] && (n.value = n.value.replace(/[{}]/g, "")));
|
|
968
|
+
}
|
|
969
|
+
}, Qe = [g.value, g.settingClone], $e = [_.var, _.property], et = class extends H {
|
|
970
|
+
FILE_CACHE = "007-01-clone";
|
|
971
|
+
init() {
|
|
972
|
+
this.items.each(({ name: e, item: t, parent: n }) => {
|
|
973
|
+
n && t?.[g.settingClone] && this.update(t, this.findItem(n, e));
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
findItem(e, t) {
|
|
977
|
+
let n = [];
|
|
978
|
+
return S(e.value) && y(e.value, (e, r) => {
|
|
979
|
+
r === t && $e.indexOf(e?.type ?? "") < 0 && n.push(e), n.push(...this.findItem(e, t));
|
|
980
|
+
}), n;
|
|
981
|
+
}
|
|
982
|
+
update(e, t) {
|
|
983
|
+
let n = e.value;
|
|
984
|
+
t.forEach((t) => {
|
|
985
|
+
y(e, (e, n) => {
|
|
986
|
+
n && !(n in t) && Qe.indexOf(n) < 0 && (t[n] = e);
|
|
987
|
+
}), S(n) && S(t.value) && y(t.value, (e, t) => {
|
|
988
|
+
n?.[t] && this.update(n[t], [e]);
|
|
989
|
+
});
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
}, tt = class extends H {
|
|
993
|
+
FILE_CACHE = "007-03-drag";
|
|
994
|
+
init() {
|
|
995
|
+
this.read();
|
|
996
|
+
}
|
|
997
|
+
getDragSetting(e) {
|
|
998
|
+
let { design: t, component: n, item: r } = e;
|
|
999
|
+
if (n && r?.[g.dragSetting]) {
|
|
1000
|
+
let e = r?.[g.dragSetting], i = typeof e == "object" ? e : { _all: e }, a = {};
|
|
1001
|
+
if (y(i, (e, r) => {
|
|
1002
|
+
let i = this.items.getItem(this.items.getLink(t, n, e));
|
|
1003
|
+
i && (a[r] = {
|
|
1004
|
+
...i,
|
|
1005
|
+
value: {}
|
|
1006
|
+
});
|
|
1007
|
+
}), Object.keys(a).length > 0) return a;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
read(e) {
|
|
1011
|
+
this.items.eachMainOnly((e) => {
|
|
1012
|
+
let { name: t, item: n, parent: r, parents: i } = e, a = [...i, {
|
|
1013
|
+
name: t,
|
|
1014
|
+
item: n
|
|
1015
|
+
}];
|
|
1016
|
+
if (this.read({
|
|
1017
|
+
...e,
|
|
1018
|
+
parents: a
|
|
1019
|
+
}), n?.[g.drag]) {
|
|
1020
|
+
let i = this.getDragSetting(e), o = this.drag(a, n, i ?? {});
|
|
1021
|
+
r && S(r.value) && o && this.toGo(n, o) && delete r.value[t];
|
|
1022
|
+
}
|
|
1023
|
+
}, e);
|
|
1024
|
+
}
|
|
1025
|
+
drag(e, n, r) {
|
|
1026
|
+
let i = n?.[g.drag]?.split(t.getSeparator()) ?? [];
|
|
1027
|
+
if (e.length > 0) {
|
|
1028
|
+
let t = e.length - 1, a = e[t].item, o = !1;
|
|
1029
|
+
if (i.forEach((n) => {
|
|
1030
|
+
switch (n) {
|
|
1031
|
+
case ".":
|
|
1032
|
+
o || (t = 0, a = e[t].item);
|
|
1033
|
+
break;
|
|
1034
|
+
case "..":
|
|
1035
|
+
o || (--t < 0 && (t = 0), a = e[t].item);
|
|
1036
|
+
break;
|
|
1037
|
+
default: a && S(a.value) && (n in a.value || (a.value[n] = r?.[n] ?? r._all ?? { value: {} }), o = !0, a = a.value[n]);
|
|
1038
|
+
}
|
|
1039
|
+
}), a !== n) return a;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
toGo(e, t) {
|
|
1043
|
+
let n = t.value;
|
|
1044
|
+
if (S(n)) {
|
|
1045
|
+
if (S(e.value)) y(e.value, (e, t) => {
|
|
1046
|
+
n?.[t] ? x(n[t].value) || (n[t].value = e.value) : n[t] = e;
|
|
1047
|
+
});
|
|
1048
|
+
else {
|
|
1049
|
+
let t = e?.[g.index];
|
|
1050
|
+
t && (n?.[t] ? x(n[t].value) || (n[t].value = e.value) : n[t] = e);
|
|
1051
|
+
}
|
|
1052
|
+
return !0;
|
|
1053
|
+
}
|
|
1054
|
+
return !1;
|
|
1055
|
+
}
|
|
1056
|
+
}, nt = class extends H {
|
|
1057
|
+
FILE_CACHE = "007-02-remove";
|
|
1058
|
+
init() {
|
|
1059
|
+
this.items.find(({ item: e }) => e?.[g.remove] ?? !1).forEach(({ name: e, parent: t, parents: n }) => {
|
|
1060
|
+
t && S(t.value) && (console.warn("[Remove]", `{${b(n, "name").join(".")}.${e}}`), delete t.value[e]);
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
}, G = /* @__PURE__ */ "direction.unicode-bidi.appearance.aspect-ratio.aspect-ratio-width.aspect-ratio-height.position.absolute.absolute-bottom.absolute-top.absolute-after.z-index.inset.inset-block.inset-block-start.inset-block-end.inset-inline.inset-inline-start.inset-inline-end.top.right.bottom.left.display.visibility.clear.contain.overflow.overflow-x.overflow-y.overflow-block.overflow-inline.overflow-wrap.overflow-clip-margin.overflow-anchor.float.shape-outside.shape-margin.shape-image-threshold.min-zoom.max-zoom".split("."), K = /* @__PURE__ */ "flex.flex-position.flex-flow.flex-basis.flex-direction.flex-grow.flex-shrink.flex-wrap.flex-dynamic.grid.grid-area.grid-auto-flow.grid-auto-columns.grid-auto-rows.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.grid-column.grid-column-start.grid-column-end.grid-row.grid-row-start.grid-row-end.align-content.align-items.align-self.align-tracks.justify-content.justify-items.justify-self.justify-tracks.place-content.place-items.place-self.gap.row-gap.order.masonry-auto-flow".split("."), q = [
|
|
1064
|
+
"columns",
|
|
1065
|
+
"column-count",
|
|
1066
|
+
"column-width",
|
|
1067
|
+
"column-fill",
|
|
1068
|
+
"column-gap",
|
|
1069
|
+
"column-rule",
|
|
1070
|
+
"column-rule-width",
|
|
1071
|
+
"column-rule-color",
|
|
1072
|
+
"column-rule-style",
|
|
1073
|
+
"column-span"
|
|
1074
|
+
], rt = /* @__PURE__ */ "margin.margin-top.margin-right.margin-bottom.margin-left.margin-x.margin-y.margin-block.margin-block-start.margin-block-end.margin-inline.margin-inline-start.margin-inline-end.margin-trim.padding.padding-top.padding-right.padding-bottom.padding-left.padding-x.padding-y.padding-block.padding-block-start.padding-block-end.padding-inline.padding-inline-start.padding-inline-end".split("."), it = [
|
|
1075
|
+
"box-sizing",
|
|
1076
|
+
"squared",
|
|
1077
|
+
"circle",
|
|
1078
|
+
"width",
|
|
1079
|
+
"min-width",
|
|
1080
|
+
"max-width",
|
|
1081
|
+
"width-basis",
|
|
1082
|
+
"height",
|
|
1083
|
+
"min-height",
|
|
1084
|
+
"max-height",
|
|
1085
|
+
"height-basis",
|
|
1086
|
+
"block-size",
|
|
1087
|
+
"min-block-size",
|
|
1088
|
+
"max-block-size",
|
|
1089
|
+
"inline-size",
|
|
1090
|
+
"min-inline-size",
|
|
1091
|
+
"max-inline-size",
|
|
1092
|
+
"tab-size",
|
|
1093
|
+
"field-sizing"
|
|
1094
|
+
], at = [
|
|
1095
|
+
"content",
|
|
1096
|
+
"content-visibility",
|
|
1097
|
+
"quotes",
|
|
1098
|
+
"hanging-punctuation",
|
|
1099
|
+
"line-break",
|
|
1100
|
+
"counter-set",
|
|
1101
|
+
"counter-reset",
|
|
1102
|
+
"counter-increment",
|
|
1103
|
+
"hyphens",
|
|
1104
|
+
"hyphenate-character",
|
|
1105
|
+
"hyphenate-limit-chars"
|
|
1106
|
+
], ot = /* @__PURE__ */ "font.font-family.font-size.font-weight.font-style.font-variant.font-size-adjust.font-stretch.font-synthesis.line-height.line-height-step.letter-spacing.word-spacing.text-align.text-align-all.text-align-last.text-justify.vertical-align.white-space.text-overflow.text-rendering.font-optical-sizing.font-variation-settings.box-decoration-break.widows.orphans.text-transform.text-case.text-indent.text-decoration.text-decoration-thickness.text-decoration-color.text-decoration-style.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-underline-offset.text-underline-position.font-feature-settings.font-kerning.font-language-override.font-variant-caps.font-variant-position.font-variant-ligatures.font-variant-alternates.font-variant-east-asian.font-variant-numeric.font-variant-emoji.text-orientation.text-combine-upright.writing-mode.word-break.word-wrap.text-emphasis.text-emphasis-color.text-emphasis-style.text-emphasis-position.ruby-align.ruby-position.list-style.list-style-position.list-style-type.list-style-image.paragraph-spacing".split("."), st = [
|
|
1107
|
+
"math-depth",
|
|
1108
|
+
"math-shift",
|
|
1109
|
+
"math-style"
|
|
1110
|
+
], ct = [
|
|
1111
|
+
"palette",
|
|
1112
|
+
"palette-var",
|
|
1113
|
+
"opacity",
|
|
1114
|
+
"color",
|
|
1115
|
+
"color-opacity",
|
|
1116
|
+
"color-scheme",
|
|
1117
|
+
"palette-color",
|
|
1118
|
+
"accent-color",
|
|
1119
|
+
"forced-color-adjust"
|
|
1120
|
+
], lt = /* @__PURE__ */ "background.background-color.background-opacity.palette-background.background-image.gradient.gradient-opacity.palette-gradient.outline.outline-opacity.background-repeat.background-attachment.background-position.background-position-x.background-position-y.background-clip.background-origin.background-size.mask.mask-type.mask-mode.mask-composite.mask-image.mask-repeat.mask-position.mask-clip.mask-origin.mask-size.image-rendering.image-resolution.image-orientation.object-fit.object-position".split("."), ut = /* @__PURE__ */ "border-radius.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.border-start-start-radius.border-start-end-radius.border-end-start-radius.border-end-end-radius.border.border-width.border-style.border-color.border-opacity.palette-border.border-top.border-top-width.border-top-style.border-top-color.border-right.border-right-width.border-right-style.border-right-color.border-bottom.border-bottom-width.border-bottom-style.border-bottom-color.border-left.border-left-width.border-left-style.border-left-color.border-image.border-image-source.border-image-slice.border-image-repeat.border-image-width.border-image-outset.border-block.border-block-width.border-block-color.border-block-style.border-block-start.border-block-start-width.border-block-start-color.border-block-start-style.border-block-end.border-block-end-width.border-block-end-color.border-block-end-style.border-inline.border-inline-width.border-inline-color.border-inline-style.border-inline-end.border-inline-end-width.border-inline-end-color.border-inline-end-style.border-inline-start.border-inline-start-width.border-inline-start-color.border-inline-start-style.mask-border.mask-border-mode.mask-border-source.mask-border-slice.mask-border-repeat.mask-border-width.mask-border-outset.outline.outline-width.outline-style.outline-color.outline-opacity.outline-offset".split("."), dt = [
|
|
1121
|
+
"box-shadow",
|
|
1122
|
+
"text-shadow",
|
|
1123
|
+
"filter",
|
|
1124
|
+
"backdrop-filter",
|
|
1125
|
+
"backface-visibility",
|
|
1126
|
+
"color-interpolation-filters",
|
|
1127
|
+
"mix-blend-mode",
|
|
1128
|
+
"background-blend-mode",
|
|
1129
|
+
"isolation"
|
|
1130
|
+
], ft = [
|
|
1131
|
+
"transform",
|
|
1132
|
+
"transform-box",
|
|
1133
|
+
"transform-style",
|
|
1134
|
+
"transform-origin",
|
|
1135
|
+
"translate-x",
|
|
1136
|
+
"translate-y",
|
|
1137
|
+
"scale",
|
|
1138
|
+
"rotate",
|
|
1139
|
+
"clip-path",
|
|
1140
|
+
"clip-rule",
|
|
1141
|
+
"perspective",
|
|
1142
|
+
"perspective-origin"
|
|
1143
|
+
], pt = [
|
|
1144
|
+
"table-layout",
|
|
1145
|
+
"empty-cells",
|
|
1146
|
+
"border-collapse",
|
|
1147
|
+
"border-spacing",
|
|
1148
|
+
"caption-side"
|
|
1149
|
+
], mt = [
|
|
1150
|
+
"transition",
|
|
1151
|
+
"transition-delay",
|
|
1152
|
+
"transition-timing-function",
|
|
1153
|
+
"transition-duration",
|
|
1154
|
+
"transition-property",
|
|
1155
|
+
"animation",
|
|
1156
|
+
"animation-name",
|
|
1157
|
+
"animation-delay",
|
|
1158
|
+
"animation-timing-function",
|
|
1159
|
+
"animation-duration",
|
|
1160
|
+
"animation-direction",
|
|
1161
|
+
"animation-iteration-count",
|
|
1162
|
+
"animation-fill-mode",
|
|
1163
|
+
"animation-play-state",
|
|
1164
|
+
"animation-timeline",
|
|
1165
|
+
"pause",
|
|
1166
|
+
"pause-before",
|
|
1167
|
+
"pause-after",
|
|
1168
|
+
"offset",
|
|
1169
|
+
"offset-path",
|
|
1170
|
+
"offset-anchor",
|
|
1171
|
+
"offset-rotate",
|
|
1172
|
+
"offset-distance",
|
|
1173
|
+
"offset-position",
|
|
1174
|
+
"will-change"
|
|
1175
|
+
], ht = [
|
|
1176
|
+
"cursor",
|
|
1177
|
+
"pointer-events",
|
|
1178
|
+
"user-select",
|
|
1179
|
+
"text-select-none",
|
|
1180
|
+
"caret-color",
|
|
1181
|
+
"resize",
|
|
1182
|
+
"touch-action",
|
|
1183
|
+
"touch-callout"
|
|
1184
|
+
], gt = /* @__PURE__ */ "overscroll-behavior.overscroll-behavior-x.overscroll-behavior-y.overscroll-behavior-block.overscroll-behavior-inline.scroll-behavior.scroll-margin.scroll-margin-top.scroll-margin-right.scroll-margin-bottom.scroll-margin-left.scroll-margin-block.scroll-margin-block-start.scroll-margin-block-end.scroll-margin-inline.scroll-margin-inline-start.scroll-margin-inline-end.scroll-padding.scroll-padding-top.scroll-padding-right.scroll-padding-bottom.scroll-padding-left.scroll-padding-block.scroll-padding-block-start.scroll-padding-block-end.scroll-padding-inline.scroll-padding-inline-start.scroll-padding-inline-end.scroll-snap-type.scroll-snap-align.scroll-snap-stop.scrollbar-gutter.scrollbar-width.scrollbar-color".split("."), _t = [
|
|
1185
|
+
"fill",
|
|
1186
|
+
"paint-order",
|
|
1187
|
+
"stroke",
|
|
1188
|
+
"stroke-width",
|
|
1189
|
+
"stroke-opacity",
|
|
1190
|
+
"stroke-dasharray",
|
|
1191
|
+
"stroke-dashoffset",
|
|
1192
|
+
"stroke-linecap",
|
|
1193
|
+
"flood-color",
|
|
1194
|
+
"flood-opacity",
|
|
1195
|
+
"lighting-color"
|
|
1196
|
+
], vt = [
|
|
1197
|
+
"break-inside",
|
|
1198
|
+
"break-before",
|
|
1199
|
+
"break-after",
|
|
1200
|
+
"print-color-adjust"
|
|
1201
|
+
], yt = [
|
|
1202
|
+
"speak",
|
|
1203
|
+
"speak-as",
|
|
1204
|
+
"speak-header",
|
|
1205
|
+
"speak-numeral",
|
|
1206
|
+
"speak-punctuation",
|
|
1207
|
+
"speech-rate",
|
|
1208
|
+
"voice-balance",
|
|
1209
|
+
"voice-duration",
|
|
1210
|
+
"voice-family",
|
|
1211
|
+
"voice-pitch",
|
|
1212
|
+
"voice-range",
|
|
1213
|
+
"voice-rate",
|
|
1214
|
+
"voice-stress",
|
|
1215
|
+
"voice-volume"
|
|
1216
|
+
], bt = [], xt = [
|
|
1217
|
+
"all",
|
|
1218
|
+
"clamp",
|
|
1219
|
+
"cue",
|
|
1220
|
+
"cue-after",
|
|
1221
|
+
"cue-before",
|
|
1222
|
+
"globalcompositeoperation",
|
|
1223
|
+
"horizon",
|
|
1224
|
+
"inherit",
|
|
1225
|
+
"initial",
|
|
1226
|
+
"initial-letter",
|
|
1227
|
+
"initial-letter-align",
|
|
1228
|
+
"initial-value",
|
|
1229
|
+
"pitch",
|
|
1230
|
+
"pitch-range",
|
|
1231
|
+
"play-during",
|
|
1232
|
+
"rest",
|
|
1233
|
+
"rest-after",
|
|
1234
|
+
"rest-before",
|
|
1235
|
+
"unset",
|
|
1236
|
+
"vertically"
|
|
1237
|
+
], St = [
|
|
1238
|
+
"glyph-orientation-vertical",
|
|
1239
|
+
"grid-gap",
|
|
1240
|
+
"grid-column-gap",
|
|
1241
|
+
"grid-row-gap",
|
|
1242
|
+
"page-break-after",
|
|
1243
|
+
"page-break-before",
|
|
1244
|
+
"page-break-inside",
|
|
1245
|
+
"richness",
|
|
1246
|
+
"stress",
|
|
1247
|
+
"volume"
|
|
1248
|
+
], Ct = [
|
|
1249
|
+
...G,
|
|
1250
|
+
...K,
|
|
1251
|
+
...q,
|
|
1252
|
+
...rt,
|
|
1253
|
+
...it,
|
|
1254
|
+
...at,
|
|
1255
|
+
...ot,
|
|
1256
|
+
...st,
|
|
1257
|
+
...ct,
|
|
1258
|
+
...lt,
|
|
1259
|
+
...ut,
|
|
1260
|
+
...dt,
|
|
1261
|
+
...ft,
|
|
1262
|
+
...pt,
|
|
1263
|
+
...mt,
|
|
1264
|
+
...ht,
|
|
1265
|
+
...gt,
|
|
1266
|
+
..._t,
|
|
1267
|
+
...vt,
|
|
1268
|
+
...yt,
|
|
1269
|
+
...bt,
|
|
1270
|
+
...xt,
|
|
1271
|
+
...St
|
|
1272
|
+
], wt = /* @__PURE__ */ "root.dir.blank.empty.is.has.where.not.first-child.first-of-type.last-child.last-of-type.only-child.only-of-type.nth-child.nth-of-type.nth-col.nth-last-child.nth-last-of-type.nth-last-col.lang.target.defined.current.future.host.host-context.placeholder-shown.autofill.default.read-only.read-write.required.optional.indeterminate.checked.in-range.out-of-range.valid.invalid.any-link.link.local-link.visited.fullscreen.focus.focus-visible.focus-within.hover.active.enabled.disabled".split("."), Tt = [
|
|
1273
|
+
"before",
|
|
1274
|
+
"after",
|
|
1275
|
+
"placeholder",
|
|
1276
|
+
"marker",
|
|
1277
|
+
"first-letter",
|
|
1278
|
+
"first-line",
|
|
1279
|
+
"selection"
|
|
1280
|
+
], Et = class extends H {
|
|
1281
|
+
FILE_CACHE = "008-variable";
|
|
1282
|
+
init() {
|
|
1283
|
+
this.items.each(({ design: e, component: t, name: n, item: r, parent: i }) => {
|
|
1284
|
+
r[g.variable] = this.getByNone(r) ?? this.getByVarParent(i) ?? r?.[g.type] ?? this.getByCategory(r) ?? this.getByMain(e, t, n) ?? this.findType(n, r);
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
getByCategory(e) {
|
|
1288
|
+
switch (e?.[g.category]) {
|
|
1289
|
+
case v.root: return _.var;
|
|
1290
|
+
case v.theme: return _.theme;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
getByMain(e, t, n) {
|
|
1294
|
+
if (n === e) return _.design;
|
|
1295
|
+
if (n === t) return _.component;
|
|
1296
|
+
}
|
|
1297
|
+
getByProperty(e) {
|
|
1298
|
+
return Ct.indexOf(O(e)) === -1 ? void 0 : _.property;
|
|
1299
|
+
}
|
|
1300
|
+
getBySelector(e) {
|
|
1301
|
+
return wt.indexOf(O(e)) === -1 ? void 0 : _.selector;
|
|
1302
|
+
}
|
|
1303
|
+
getBySubclass(e) {
|
|
1304
|
+
if (Object.keys(e).length <= 1 && !x(e.value)) return _.subclass;
|
|
1305
|
+
}
|
|
1306
|
+
getByVarParent(e) {
|
|
1307
|
+
return F.isInType(e?.[g.variable], [_.var]) ? _.var : void 0;
|
|
1308
|
+
}
|
|
1309
|
+
getByNone(e) {
|
|
1310
|
+
return e?.[g.type] === _.none ? _.none : void 0;
|
|
1311
|
+
}
|
|
1312
|
+
getByVirtual(e) {
|
|
1313
|
+
return Tt.indexOf(O(e)) === -1 ? void 0 : _.virtual;
|
|
1314
|
+
}
|
|
1315
|
+
findType(e, t) {
|
|
1316
|
+
let n = this.items.getName(e, t);
|
|
1317
|
+
return S(t.value) ? this.getBySubclass(t) || this.getBySelector(n) || this.getByVirtual(n) || this.getByProperty(n) || _.state : this.getByProperty(n) || _.var;
|
|
1318
|
+
}
|
|
1319
|
+
}, Dt = [_.var, _.property], Ot = [_.classType, _.subclass], kt = class extends H {
|
|
1320
|
+
FILE_CACHE = "010-similar";
|
|
1321
|
+
init() {
|
|
1322
|
+
this.items.each(({ item: e, name: t, parents: n }) => {
|
|
1323
|
+
let r = this.getParent(t, e, n);
|
|
1324
|
+
r && (e[g.rename] = this.items.getReName(t, r), e[g.variable] = r?.[g.variable]);
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
getParent(e, t, n) {
|
|
1328
|
+
let r = [...n].reverse();
|
|
1329
|
+
if (!t?.[g.type] && !t?.[g.rename] && !this.isException(t) && !this.isException(r?.[0]?.item)) {
|
|
1330
|
+
r.shift();
|
|
1331
|
+
for (let { item: t } of r) if (S(t.value)) {
|
|
1332
|
+
let n = t.value?.[e];
|
|
1333
|
+
if (this.isException(t)) break;
|
|
1334
|
+
if (n && this.is(n) && (n?.[g.type] || n?.[g.rename])) return n;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
is(e) {
|
|
1339
|
+
return e?.[g.variable] ? Dt.indexOf(e?.[g.variable]) !== -1 : !1;
|
|
1340
|
+
}
|
|
1341
|
+
isException(e) {
|
|
1342
|
+
return e && e?.[g.variable] ? Ot.indexOf(e[g.variable]) !== -1 : !1;
|
|
1343
|
+
}
|
|
1344
|
+
}, At = [_.var, _.state], jt = class extends H {
|
|
1345
|
+
FILE_CACHE = "012-multi";
|
|
1346
|
+
init() {
|
|
1347
|
+
this.getList().forEach(({ item: e, name: t, value: n }) => {
|
|
1348
|
+
this.read(this.items.getReName(t, e), n, e?.[g.varKey] ?? !1), e[g.variable] = _.state;
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
getList() {
|
|
1352
|
+
return this.items.each((e) => {
|
|
1353
|
+
let { item: t, value: n } = e;
|
|
1354
|
+
if (t?.[g.variable] === _.property && x(n) && S(n)) return e;
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
read(e, t, n) {
|
|
1358
|
+
y(t, (t) => {
|
|
1359
|
+
typeof t.value == "string" && t?.[g.variable] && At.indexOf(t[g.variable]) !== -1 && (t[g.variable] = _.state, t.value = { [e]: {
|
|
1360
|
+
value: t.value,
|
|
1361
|
+
[g.variable]: n ? _.var : _.property
|
|
1362
|
+
} });
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
}, Mt = class extends H {
|
|
1366
|
+
FILE_CACHE = "016-style";
|
|
1367
|
+
init() {
|
|
1368
|
+
this.items.each(({ item: e, name: t, design: n, component: r }) => {
|
|
1369
|
+
e?.[g.style] && S(e.value) && !e.value?.custom && (e[g.variable] = _.state, e.value[le] = {
|
|
1370
|
+
value: { [t]: {
|
|
1371
|
+
value: `{${n}.${r}.sys.${t}}`,
|
|
1372
|
+
[g.variable]: e?.[g.varKey] ? _.var : _.property
|
|
1373
|
+
} },
|
|
1374
|
+
[g.variable]: _.state
|
|
1375
|
+
});
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
}, Nt = class extends H {
|
|
1379
|
+
FILE_CACHE = "018-full";
|
|
1380
|
+
init() {
|
|
1381
|
+
this.items.each(({ design: e, component: t, name: n, value: r, item: i }) => {
|
|
1382
|
+
t && (i[g.name] = this.items.getLinkToName(e, t, this.items.getReName(n, i)), typeof r == "string" && (i[g.css] = this.items.getLinkToValue(e, t, r)));
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
}, Pt = /(?<!#)\{([^{}]+)}/gi, Ft = class extends H {
|
|
1386
|
+
FILE_CACHE = "020-var";
|
|
1387
|
+
type = _.var;
|
|
1388
|
+
init() {
|
|
1389
|
+
this.items.findVariable(this.type).forEach((e) => {
|
|
1390
|
+
let { design: t, component: n, value: r, item: i, parents: a } = e;
|
|
1391
|
+
if (n && typeof r == "string" && r !== "") {
|
|
1392
|
+
let o = i?.[g.css] ?? this.items.getLinkToValue(t, n, r);
|
|
1393
|
+
i[g.name] = this.getName(e), this.isNone(a) ? i[g.css] = void 0 : (i[g.css] = this.toValue(this.toCalculator(o, i?.[g.fullValue]), i?.[g.default]), !(g.cssColorOpacity in i) && this.isColorWithOpacity(e) && (i[g.cssColorOpacity] = !0), i?.[g.important] && (i[g.css] += " !important"));
|
|
1394
|
+
}
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
getName({ design: e, component: t, name: n, item: r, parents: i }) {
|
|
1398
|
+
return t && r?.[g.fullName] ? `--${this.items.getLink(e, t, r?.[g.index] ?? n, "-")}` : `--${this.items.getParentsName(i, [_.var]).join("-")}-${E(n)}`;
|
|
1399
|
+
}
|
|
1400
|
+
toCalculator(e, t) {
|
|
1401
|
+
return !t && e.match(/([+*/]|(?<![\w-])-(?![\w-]))/gi) && e.match(/calc/gi) === null ? `calc(${e})` : e;
|
|
1402
|
+
}
|
|
1403
|
+
toLink(e) {
|
|
1404
|
+
return this.items.getKeys(e).join("-");
|
|
1405
|
+
}
|
|
1406
|
+
toValue(e, t) {
|
|
1407
|
+
return e.match("{") ? e.replace(Pt, (...e) => t && typeof t == "string" ? `var(--${this.toLink(e[1])}, ${this.toValue(this.toCalculator(t))})` : `var(--${this.toLink(e[1])})`) : e;
|
|
1408
|
+
}
|
|
1409
|
+
isNone(e) {
|
|
1410
|
+
for (let t of e) if (t.item?.[g.type] === _.none) return !0;
|
|
1411
|
+
return !1;
|
|
1412
|
+
}
|
|
1413
|
+
isColorWithOpacity(e) {
|
|
1414
|
+
let { design: t, component: n, value: r, item: i } = e;
|
|
1415
|
+
if (i?.[g.cssColorOpacity]) return !0;
|
|
1416
|
+
if (n && ve(r)) {
|
|
1417
|
+
if (r.match(/^\{[^}]+}$/)) {
|
|
1418
|
+
let e = this.items.getLink(t, n, r), i = this.items.getInfo(e);
|
|
1419
|
+
if (i) return this.isColorWithOpacity(i);
|
|
1420
|
+
} else return L.isColorWithOpacity(r);
|
|
1421
|
+
}
|
|
1422
|
+
return !1;
|
|
1423
|
+
}
|
|
1424
|
+
}, It = class extends Ft {
|
|
1425
|
+
FILE_CACHE = "024-property";
|
|
1426
|
+
type = _.property;
|
|
1427
|
+
getName({ name: e, item: t }) {
|
|
1428
|
+
return O(this.items.getReName(e, t));
|
|
1429
|
+
}
|
|
1430
|
+
}, Lt = class extends H {
|
|
1431
|
+
FILE_CACHE = "028-component";
|
|
1432
|
+
init() {
|
|
1433
|
+
this.items.findVariable([_.component, _.theme]).forEach(({ name: e, item: t, parents: n }) => {
|
|
1434
|
+
t[g.name] = this.getName(this.items.getReName(e, t), t, n);
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
getName(e, t, n) {
|
|
1438
|
+
let r = this.items.getReName(e, t);
|
|
1439
|
+
return t?.[g.fullName] ? `${r}` : `${this.items.getParentsName(n).join("-")}-${r}`;
|
|
1440
|
+
}
|
|
1441
|
+
}, Rt = class extends H {
|
|
1442
|
+
FILE_CACHE = "030-class";
|
|
1443
|
+
init() {
|
|
1444
|
+
this.items.findVariable(_.classType).forEach(({ name: e, item: t, parents: n }) => {
|
|
1445
|
+
t[g.name] = this.getName(e, t, n);
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
getName(e, t, n) {
|
|
1449
|
+
let r = this.items.getReName(e, t);
|
|
1450
|
+
return t?.[g.fullName] ? `& .${r}` : `& .${n?.[0]?.name}-${r}`;
|
|
1451
|
+
}
|
|
1452
|
+
}, zt = class extends H {
|
|
1453
|
+
FILE_CACHE = "032-state";
|
|
1454
|
+
init() {
|
|
1455
|
+
this.items.findVariable([_.state]).forEach(({ name: e, item: t, parents: n }) => {
|
|
1456
|
+
t[g.name] = this.getName(e, t, n);
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
getName(e, t, n) {
|
|
1460
|
+
let r = this.items.getReName(e, t);
|
|
1461
|
+
if (t?.[g.fullName]) return `&.${r}`;
|
|
1462
|
+
let i = n?.[1]?.item.value;
|
|
1463
|
+
return !t?.[g.state] && n.length > 2 && S(i) && i?.[e] && i[e][g.variable] === _.state ? `&.${n?.[1]?.item[g.name]}--${r}` : `&--${r}`;
|
|
1464
|
+
}
|
|
1465
|
+
}, Bt = class extends H {
|
|
1466
|
+
FILE_CACHE = "036-subclass";
|
|
1467
|
+
init() {
|
|
1468
|
+
this.items.findVariable(_.subclass).forEach(({ name: e, item: t, parents: n }) => {
|
|
1469
|
+
let r = this.items.getReName(e, t);
|
|
1470
|
+
t[g.name] = this.getName(r, t, n), t[g.nameIndex] = r;
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
isParentState(e) {
|
|
1474
|
+
let t = e?.[e.length - 1]?.item?.[g.variable] ?? _.subclass;
|
|
1475
|
+
return [
|
|
1476
|
+
_.component,
|
|
1477
|
+
_.subclass,
|
|
1478
|
+
_.classType
|
|
1479
|
+
].indexOf(t) < 0;
|
|
1480
|
+
}
|
|
1481
|
+
getName(e, t, n) {
|
|
1482
|
+
return t?.[g.fullName] ? `& .${e}` : this.isParentState(n) ? `& .${this.items.getParentsName(n, [_.subclass]).join("__").replace("__", "-")}__${e}` : `&__${e}`;
|
|
1483
|
+
}
|
|
1484
|
+
}, Vt = class extends H {
|
|
1485
|
+
FILE_CACHE = "038-root";
|
|
1486
|
+
init() {
|
|
1487
|
+
this.items.findVariable(_.root).forEach(({ design: e, component: t, name: n, item: r }) => {
|
|
1488
|
+
t && (r[g.name] = this.getName(e, t, this.items.getReName(n, r)));
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
getName(e, t, n) {
|
|
1492
|
+
return `${this.items.getLink(e, t, n)} &`;
|
|
1493
|
+
}
|
|
1494
|
+
}, Ht = class extends H {
|
|
1495
|
+
items;
|
|
1496
|
+
FILE_CACHE = "040-media";
|
|
1497
|
+
media;
|
|
1498
|
+
constructor(e) {
|
|
1499
|
+
super(e), this.items = e, this.media = this.items.getMedia();
|
|
1500
|
+
}
|
|
1501
|
+
init() {
|
|
1502
|
+
this.items.findVariable([
|
|
1503
|
+
_.mediaGroup,
|
|
1504
|
+
_.mediaMaxGroup,
|
|
1505
|
+
_.containerGroup,
|
|
1506
|
+
_.containerMaxGroup
|
|
1507
|
+
]).forEach(({ design: e, name: t, item: n, parent: r }) => {
|
|
1508
|
+
r?.value && S(r.value) && (t in r.value && delete r.value[t], Object.assign(r.value, this.toValueGroup(e, t, n, this.getTypeByGroup(n))));
|
|
1509
|
+
}), this.items.findVariable([
|
|
1510
|
+
_.media,
|
|
1511
|
+
_.mediaMax,
|
|
1512
|
+
_.container,
|
|
1513
|
+
_.containerMax
|
|
1514
|
+
]).forEach(({ design: e, name: t, item: n }) => {
|
|
1515
|
+
n[g.name] = this.getName(e, t, n);
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
getName(e, t, n) {
|
|
1519
|
+
let r = this.toValueForMedia(e, this.items.getReName(t, n).split(","));
|
|
1520
|
+
return r.length > 1 ? `(min-width: ${r?.[0] || "0px"}) and (max-width: calc(${r?.[1] || "1980px"} - 1px))` : n?.[g.variable] === _.mediaMax || n?.[g.variable] === _.containerMax ? `(max-width: calc(${r?.[0] || "1980px"} - 1px))` : `(min-width: ${r?.[0] || "0px"})`;
|
|
1521
|
+
}
|
|
1522
|
+
getTypeByGroup(e) {
|
|
1523
|
+
switch (e?.[g.variable]) {
|
|
1524
|
+
case _.containerGroup: return _.container;
|
|
1525
|
+
case _.containerMaxGroup: return _.containerMax;
|
|
1526
|
+
case _.mediaMaxGroup: return _.mediaMax;
|
|
1527
|
+
default: return _.media;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
toValueForMedia(e, t) {
|
|
1531
|
+
return y(t, (t) => {
|
|
1532
|
+
let n = E(t.replace(/^mediaMax|media|containerMax|container/, "")), r = this.media?.[e]?.[n]?.value;
|
|
1533
|
+
return typeof r == "string" && r || n;
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
toValueGroup(e, t, n, r) {
|
|
1537
|
+
let i = this.media?.[e];
|
|
1538
|
+
if (i) {
|
|
1539
|
+
let e = {};
|
|
1540
|
+
return Object.keys(i).forEach((i) => {
|
|
1541
|
+
let a = E(`${t}-${i}`), o = E(`${r}-${i}`);
|
|
1542
|
+
e[a] = {
|
|
1543
|
+
value: { [o]: {
|
|
1544
|
+
value: n.value,
|
|
1545
|
+
__i: `${r}|sm`,
|
|
1546
|
+
__v: r,
|
|
1547
|
+
__n: o
|
|
1548
|
+
} },
|
|
1549
|
+
__i: a,
|
|
1550
|
+
__v: _.state,
|
|
1551
|
+
__n: `&--${a}`
|
|
1552
|
+
};
|
|
1553
|
+
}), e;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}, Ut = class extends H {
|
|
1557
|
+
FILE_CACHE = "044-animate";
|
|
1558
|
+
init() {
|
|
1559
|
+
this.items.findVariable(_.animate).forEach(({ name: e, value: t, item: n, parents: r }) => {
|
|
1560
|
+
n[g.name] = this.getName(this.items.getReName(e, n), n, r), S(t) && y(t, (e, t) => {
|
|
1561
|
+
e[g.variable] = _.animateFrame, e[g.name] = e?.[g.index] ?? t;
|
|
1562
|
+
});
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
getName(e, t, n) {
|
|
1566
|
+
return t?.[g.fullName] ? e : `${this.items.getParentsName(n).join("-")}-${e}`;
|
|
1567
|
+
}
|
|
1568
|
+
}, Wt = [
|
|
1569
|
+
{
|
|
1570
|
+
index: _.var,
|
|
1571
|
+
value: []
|
|
1572
|
+
},
|
|
1573
|
+
{
|
|
1574
|
+
index: _.property,
|
|
1575
|
+
value: [
|
|
1576
|
+
G,
|
|
1577
|
+
K,
|
|
1578
|
+
q,
|
|
1579
|
+
rt,
|
|
1580
|
+
it,
|
|
1581
|
+
at,
|
|
1582
|
+
ot,
|
|
1583
|
+
st,
|
|
1584
|
+
ct,
|
|
1585
|
+
lt,
|
|
1586
|
+
ut,
|
|
1587
|
+
dt,
|
|
1588
|
+
ft,
|
|
1589
|
+
pt,
|
|
1590
|
+
mt,
|
|
1591
|
+
ht,
|
|
1592
|
+
gt,
|
|
1593
|
+
_t,
|
|
1594
|
+
vt,
|
|
1595
|
+
yt,
|
|
1596
|
+
bt,
|
|
1597
|
+
xt,
|
|
1598
|
+
St
|
|
1599
|
+
]
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
index: _.virtual,
|
|
1603
|
+
value: [Tt]
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
index: _.subclass,
|
|
1607
|
+
value: []
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
index: _.selector,
|
|
1611
|
+
value: [wt]
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
index: _.state,
|
|
1615
|
+
value: []
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
index: `category-${v.theme}`,
|
|
1619
|
+
value: []
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
index: `category-${v.class}`,
|
|
1623
|
+
value: []
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
index: _.classType,
|
|
1627
|
+
value: []
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
index: _.component,
|
|
1631
|
+
value: []
|
|
1632
|
+
},
|
|
1633
|
+
{
|
|
1634
|
+
index: _.scss,
|
|
1635
|
+
value: []
|
|
1636
|
+
},
|
|
1637
|
+
{
|
|
1638
|
+
index: _.other,
|
|
1639
|
+
value: []
|
|
1640
|
+
}
|
|
1641
|
+
], Gt = class extends H {
|
|
1642
|
+
FILE_CACHE = "048-sort";
|
|
1643
|
+
init() {
|
|
1644
|
+
this.read();
|
|
1645
|
+
}
|
|
1646
|
+
read(e) {
|
|
1647
|
+
let t = [];
|
|
1648
|
+
return this.items.eachMainOnly((e) => {
|
|
1649
|
+
let { name: n, value: r, item: i } = e, a = this.getKeys(i);
|
|
1650
|
+
S(r) && (i.value = this.read(e)), i[g.sort] = a.index, t.push({
|
|
1651
|
+
name: n,
|
|
1652
|
+
item: i,
|
|
1653
|
+
order: a.value
|
|
1654
|
+
});
|
|
1655
|
+
}, e), this.join(t);
|
|
1656
|
+
}
|
|
1657
|
+
getCategoryName(e) {
|
|
1658
|
+
return `category-${e?.[g.category]}`;
|
|
1659
|
+
}
|
|
1660
|
+
getKeys(e) {
|
|
1661
|
+
let t = this.getCategoryName(e), n = e?.[g.variable], r = Wt.findIndex(({ index: e }) => e === t || e === n);
|
|
1662
|
+
if (r !== -1) {
|
|
1663
|
+
let t = Wt[r];
|
|
1664
|
+
if (t) {
|
|
1665
|
+
let n = t.value.findIndex((t) => t.indexOf(e?.[g.name] ?? "") !== -1), i = (r + 1) * 1e6;
|
|
1666
|
+
if (n !== -1) {
|
|
1667
|
+
let r = t.value[n]?.findIndex((t) => t === e?.[g.name]) ?? -1;
|
|
1668
|
+
i += n * 1e3, i += r === -1 ? 999 : r;
|
|
1669
|
+
} else i += 999999;
|
|
1670
|
+
return {
|
|
1671
|
+
index: `${t.index}${n > 0 ? `@${n}` : ""}`,
|
|
1672
|
+
value: i
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
return {
|
|
1677
|
+
index: _.other,
|
|
1678
|
+
value: 99999999
|
|
1679
|
+
};
|
|
1680
|
+
}
|
|
1681
|
+
join(e) {
|
|
1682
|
+
let t = {};
|
|
1683
|
+
return e.sort((e, t) => e.order - t.order), y(e, ({ name: e, item: n }) => {
|
|
1684
|
+
t[e] = n;
|
|
1685
|
+
}), t;
|
|
1686
|
+
}
|
|
1687
|
+
}, Kt = [_.var, _.property], qt = class extends H {
|
|
1688
|
+
FILE_CACHE = "900-none";
|
|
1689
|
+
init() {
|
|
1690
|
+
this.items.findVariable(Kt).forEach(({ name: e, value: t, parent: n, parents: r }) => {
|
|
1691
|
+
n && !x(t) && S(t) && S(n.value) && (console.error("[None]", `{${b(r, "name").join(".")}.${e}}`), delete n.value[e]);
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
}, Jt = class extends H {
|
|
1695
|
+
FILE_CACHE = "910-duplicate";
|
|
1696
|
+
init() {
|
|
1697
|
+
let e = this.initList(), t = this.initDuplicate(e);
|
|
1698
|
+
y(t, (e) => {
|
|
1699
|
+
let t = this.getName(e.properties);
|
|
1700
|
+
Object.values(e.properties).forEach((e) => {
|
|
1701
|
+
e.property.item[g.duplicate] = t;
|
|
1702
|
+
});
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
getName(e) {
|
|
1706
|
+
let n = {}, r = [];
|
|
1707
|
+
return Object.keys(e).forEach((e) => {
|
|
1708
|
+
let r = "main";
|
|
1709
|
+
e.split(t.getSeparator()).forEach((e) => {
|
|
1710
|
+
r in n ? n[r]?.push(e) : n[r] = [e], r = e;
|
|
1711
|
+
});
|
|
1712
|
+
}), Object.values(n).forEach((e) => {
|
|
1713
|
+
e.forEach((e) => {
|
|
1714
|
+
r.indexOf(e) === -1 && r.push(e);
|
|
1715
|
+
});
|
|
1716
|
+
}), E(r.join("-"));
|
|
1717
|
+
}
|
|
1718
|
+
findDuplicate(e, t) {
|
|
1719
|
+
let n = {};
|
|
1720
|
+
return y(e, (e, r) => {
|
|
1721
|
+
let { value: i } = e;
|
|
1722
|
+
i === t && (n[r] = e);
|
|
1723
|
+
}), n;
|
|
1724
|
+
}
|
|
1725
|
+
initList() {
|
|
1726
|
+
let e = {}, n = t.getSeparator();
|
|
1727
|
+
return this.items.each((t) => {
|
|
1728
|
+
if (t?.design && t?.component && S(t.value) && Object.keys(t.value).length >= 5) {
|
|
1729
|
+
let r = b(t.parents, "name").join(n);
|
|
1730
|
+
e[`${r}${n}${t.name}`] = {
|
|
1731
|
+
value: `${t.design}::${t.component}::${JSON.stringify(t.value)}`,
|
|
1732
|
+
property: t
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
}), e;
|
|
1736
|
+
}
|
|
1737
|
+
initDuplicate(e) {
|
|
1738
|
+
let t = [], n = [];
|
|
1739
|
+
return y(e, ({ value: r }, i) => {
|
|
1740
|
+
if (t.indexOf(i) === -1) {
|
|
1741
|
+
let i = this.findDuplicate(e, r), a = Object.keys(i);
|
|
1742
|
+
a.length > 1 && n.push({
|
|
1743
|
+
value: r,
|
|
1744
|
+
properties: i
|
|
1745
|
+
}), t.push(...a);
|
|
1746
|
+
}
|
|
1747
|
+
}), n;
|
|
1748
|
+
}
|
|
1749
|
+
}, Yt = class {
|
|
1750
|
+
items;
|
|
1751
|
+
constructor(e) {
|
|
1752
|
+
this.items = e;
|
|
1753
|
+
}
|
|
1754
|
+
getShade() {
|
|
1755
|
+
return y(this.items.findCategory(v.shade), ({ design: e, value: t }) => {
|
|
1756
|
+
if (S(t)) return {
|
|
1757
|
+
design: e,
|
|
1758
|
+
value: b(t, "value")
|
|
1759
|
+
};
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
getUsed() {
|
|
1763
|
+
let e = this.getList(), t = [];
|
|
1764
|
+
return this.items.each(({ design: n, component: r, value: i, item: a, parents: o }) => {
|
|
1765
|
+
if (r && typeof i == "string" && a?.[g.variable] === _.var && a?.[g.category] !== v.color && a?.[g.name]) {
|
|
1766
|
+
let s = this.getFocusUsed(e, n, r, i);
|
|
1767
|
+
if (s) {
|
|
1768
|
+
let e = a[g.name], r = t.find((t) => t.name === e), i = o.find((e) => e.item[g.category] === "theme")?.name || "basic", c = `--${n}-palette-${E(`${i}-${s.match(/\.([^.{}]+)}/)?.[1]}`)}`;
|
|
1769
|
+
r ? r.value.push(c) : t.push({
|
|
1770
|
+
name: e,
|
|
1771
|
+
value: [c]
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}), t;
|
|
1776
|
+
}
|
|
1777
|
+
getFocusUsed(e, t, n, r) {
|
|
1778
|
+
let i = this.items.getLink(t, n, r);
|
|
1779
|
+
if (e.indexOf(i) !== -1) return r;
|
|
1780
|
+
let a = this.items.getInfo(i);
|
|
1781
|
+
if (a && a.design === t && typeof a.component == "string" && typeof a.value == "string") return this.getFocusUsed(e, a.design, a.component, a.value);
|
|
1782
|
+
}
|
|
1783
|
+
getList() {
|
|
1784
|
+
return y(this.items.findCategory(v.color), ({ value: e }) => e);
|
|
1785
|
+
}
|
|
1786
|
+
}, Xt = "setDesignsDesigns", Zt = "setDesignsRoot", Qt = "setDesignsMedia", $t = "setDesignsClasses", en = "setDesignsPalette", tn = "setDesignShade", nn = "setDesignsProperties", rn = class {
|
|
1787
|
+
items;
|
|
1788
|
+
constructor(e) {
|
|
1789
|
+
this.items = e;
|
|
1790
|
+
}
|
|
1791
|
+
get() {
|
|
1792
|
+
let e = "@use \"@dxtmisha/styles\" as variables;\r\n\r\n";
|
|
1793
|
+
return e += `${this.getDesigns()}\r\n`, e += `${this.getRoot()}\r\n`, e += `${this.getMedia()}\r\n`, e += `${this.getClasses()}\r\n`, e += `${this.getPalette()}\r\n`, e += `${this.getShade()}\r\n`, e += `${this.getProperties()}\r\n`, e;
|
|
1794
|
+
}
|
|
1795
|
+
getDesigns() {
|
|
1796
|
+
let e = y(this.items.getDesigns(), (e) => `\r\n '${e}',`);
|
|
1797
|
+
return this.getPropertiesValue(Xt, e.join(""));
|
|
1798
|
+
}
|
|
1799
|
+
getRoot() {
|
|
1800
|
+
return this.getPropertiesValue(Zt, this.getByCategory(v.root));
|
|
1801
|
+
}
|
|
1802
|
+
getMedia() {
|
|
1803
|
+
let e = "";
|
|
1804
|
+
return y(this.items.getMedia(), (t, n) => {
|
|
1805
|
+
S(t) && y(t, (t, r) => {
|
|
1806
|
+
e += `\r\n '${n}-${r}': ${this.getValueItem(t)},`;
|
|
1807
|
+
});
|
|
1808
|
+
}), this.getPropertiesValue(Qt, e);
|
|
1809
|
+
}
|
|
1810
|
+
getClasses() {
|
|
1811
|
+
return this.getPropertiesValue($t, this.getByCategory(["class", "theme"]));
|
|
1812
|
+
}
|
|
1813
|
+
getPalette() {
|
|
1814
|
+
let e = "";
|
|
1815
|
+
return new Yt(this.items).getUsed().forEach(({ name: t, value: n }) => {
|
|
1816
|
+
e += `\r\n '${t}': ('${n.join("', '")}'),`;
|
|
1817
|
+
}), this.getPropertiesValue(en, e);
|
|
1818
|
+
}
|
|
1819
|
+
getShade() {
|
|
1820
|
+
let e = "";
|
|
1821
|
+
return new Yt(this.items).getShade().forEach(({ design: t, value: n }) => {
|
|
1822
|
+
e += `\r\n '${t}': (${n.join(",")}),`;
|
|
1823
|
+
}), this.getPropertiesValue(tn, e);
|
|
1824
|
+
}
|
|
1825
|
+
getProperties() {
|
|
1826
|
+
return this.getPropertiesValue(nn, this.to());
|
|
1827
|
+
}
|
|
1828
|
+
getByCategory(e) {
|
|
1829
|
+
let t = [];
|
|
1830
|
+
return this.items.findCategory(e).forEach((e) => t.push(`\r\n '${e.index}',`)), t.join("");
|
|
1831
|
+
}
|
|
1832
|
+
getValue(e, t) {
|
|
1833
|
+
return S(e.value) ? `value: (${this.to(e.value, `${t} `)}\r\n${t} ),` : Array.isArray(e.value) ? `value: (${e.value.join(", ")}),` : `value: ${this.getValueItem(e)},`;
|
|
1834
|
+
}
|
|
1835
|
+
getValueItem(e) {
|
|
1836
|
+
let t = e?.[g.css] || e.value;
|
|
1837
|
+
return typeof t == "string" ? t.match(/^#[a-zA-Z0-9]+$/) || t.match(/^([0-9]+|([0-9]+\.[0-9]+))(px|em|rem|vw|vh|%|)$/) ? `${t}` : `'${t}'` : "";
|
|
1838
|
+
}
|
|
1839
|
+
getPropertiesValue(e, t) {
|
|
1840
|
+
return `@include variables.${e}((${t}));`;
|
|
1841
|
+
}
|
|
1842
|
+
to(e = this.items.get(), t = " ") {
|
|
1843
|
+
let n = "";
|
|
1844
|
+
return y(e, (e, r) => {
|
|
1845
|
+
e?.value && e?.[g.variable] !== "none" && (n += `\r\n${t}'${r}':(`, n += `\r\n${t} index: '${r}',`, n += `\r\n${t} name: '${e?.[g.name] || r}',`, n += `\r\n${t} type: '${e?.[g.variable]}',`, (e?.[g.category] || e?.[g.variable] !== _.component) && (n += `\r\n${t} ${this.getValue(e, t)}`), e?.[g.modification] === !1 && (n += `\r\n${t} modification: false,`), e?.[g.varKey] === !0 && (n += `\r\n${t} var: true,`), n += `\r\n${t}),`);
|
|
1846
|
+
}), n;
|
|
1847
|
+
}
|
|
1848
|
+
}, an = "properties", on = class {
|
|
1849
|
+
designs;
|
|
1850
|
+
items;
|
|
1851
|
+
constructor() {
|
|
1852
|
+
this.designs = N.getDesigns(), this.items = new P(this.read());
|
|
1853
|
+
}
|
|
1854
|
+
get() {
|
|
1855
|
+
return this.items;
|
|
1856
|
+
}
|
|
1857
|
+
getScss() {
|
|
1858
|
+
return M.get([], this.getPathName(), () => {
|
|
1859
|
+
let e = new rn(this.items).get();
|
|
1860
|
+
return console.info("[Scss]", "init"), e;
|
|
1861
|
+
}, "scss");
|
|
1862
|
+
}
|
|
1863
|
+
read() {
|
|
1864
|
+
return M.get([], this.getPathName(), () => {
|
|
1865
|
+
console.info("[Properties]", "start");
|
|
1866
|
+
let e = this.readFiles();
|
|
1867
|
+
return this.toBasic(e), new kt(e).to(), new jt(e).to(), new Mt(e).to(), new Nt(e).to(), new Ft(e).to(), new It(e).to(), new Lt(e).to(), new Rt(e).to(), new zt(e).to(), new Bt(e).to(), new Vt(e).to(), new Ht(e).to(), new Ut(e).to(), new Gt(e).to(), new qt(e).to(), new Jt(e).to(), console.info("[Properties]", "init"), e.get();
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
getPathName() {
|
|
1871
|
+
return `${this.designs.join("-")}-${an}`;
|
|
1872
|
+
}
|
|
1873
|
+
readFiles() {
|
|
1874
|
+
let e = new je(this.designs), t = new Fe(e).get();
|
|
1875
|
+
return new P(w(t, new Ue(e).getBySettings(t)));
|
|
1876
|
+
}
|
|
1877
|
+
toBasic(e) {
|
|
1878
|
+
new We(e).to(), new Ke(e).to(), new Xe(e).to(), new Ze(e).to(), new et(e).to(), new nt(e).to(), new tt(e).to(), new Et(e).to();
|
|
1879
|
+
}
|
|
1880
|
+
}, J = class {
|
|
1881
|
+
component;
|
|
1882
|
+
properties;
|
|
1883
|
+
items;
|
|
1884
|
+
constructor(e) {
|
|
1885
|
+
this.component = e, this.properties = new on(), this.items = this.properties.get().getInfo(this.getLink());
|
|
1886
|
+
}
|
|
1887
|
+
get() {
|
|
1888
|
+
return this.data;
|
|
1889
|
+
}
|
|
1890
|
+
getLink() {
|
|
1891
|
+
return `{${t.getDesignName()}.${this.component}}`;
|
|
1892
|
+
}
|
|
1893
|
+
}, sn = class extends J {
|
|
1894
|
+
states;
|
|
1895
|
+
data = {};
|
|
1896
|
+
constructor(e) {
|
|
1897
|
+
super(e), this.states = this.makeState(this.items?.value), this.makeMain(), this.makeValue(), this.makeValueAll(), this.makeValueUnique();
|
|
1898
|
+
}
|
|
1899
|
+
getStates() {
|
|
1900
|
+
return this.states;
|
|
1901
|
+
}
|
|
1902
|
+
isProps(e) {
|
|
1903
|
+
let t = e?.[g.prop];
|
|
1904
|
+
return t !== !1 && (x(t) || e?.[g.variable] === _.state || de.indexOf(e?.[g.name]) !== -1);
|
|
1905
|
+
}
|
|
1906
|
+
isLinkClass(e) {
|
|
1907
|
+
return typeof e.value == "string" && e?.[g.variable] === _.linkClass;
|
|
1908
|
+
}
|
|
1909
|
+
getClass(e) {
|
|
1910
|
+
return this.properties.get().getKeys(e).join(".").replace(".", "-").replace(/\./g, "--");
|
|
1911
|
+
}
|
|
1912
|
+
getClassState(e) {
|
|
1913
|
+
return this.properties.get().getItem(e);
|
|
1914
|
+
}
|
|
1915
|
+
makeState(e) {
|
|
1916
|
+
let t = [];
|
|
1917
|
+
return x(e) && S(e) && y(e, (e, n) => {
|
|
1918
|
+
if (this.isProps(e) && t.push({
|
|
1919
|
+
index: n,
|
|
1920
|
+
type: _.property,
|
|
1921
|
+
item: e,
|
|
1922
|
+
className: void 0,
|
|
1923
|
+
state: this.makeState(e.value)
|
|
1924
|
+
}), this.isLinkClass(e)) {
|
|
1925
|
+
let r = e?.[g.css] || e.value;
|
|
1926
|
+
if (typeof r == "string") {
|
|
1927
|
+
let e = this.getClassState(r);
|
|
1928
|
+
e && t.push({
|
|
1929
|
+
index: n,
|
|
1930
|
+
type: _.linkClass,
|
|
1931
|
+
item: e,
|
|
1932
|
+
className: this.getClass(r),
|
|
1933
|
+
state: this.makeState(e.value)
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}), t;
|
|
1938
|
+
}
|
|
1939
|
+
makeMain() {
|
|
1940
|
+
return this.states?.forEach(({ index: e, type: t, item: n, className: r }) => {
|
|
1941
|
+
this.data[e] = {
|
|
1942
|
+
name: this.toName(n, e),
|
|
1943
|
+
index: e,
|
|
1944
|
+
type: t,
|
|
1945
|
+
className: r,
|
|
1946
|
+
value: [],
|
|
1947
|
+
valueAll: [],
|
|
1948
|
+
state: [],
|
|
1949
|
+
style: !!n?.[g.style],
|
|
1950
|
+
default: n?.[g.default],
|
|
1951
|
+
category: n?.[g.category]
|
|
1952
|
+
};
|
|
1953
|
+
}), this;
|
|
1954
|
+
}
|
|
1955
|
+
makeValue() {
|
|
1956
|
+
return this.states?.forEach(({ index: e, item: t }) => {
|
|
1957
|
+
this.data?.[e]?.value.push(...this.toValue(t?.value));
|
|
1958
|
+
}), this;
|
|
1959
|
+
}
|
|
1960
|
+
makeValueAll(e = this.states) {
|
|
1961
|
+
return e?.forEach(({ index: e, item: t, state: n }) => {
|
|
1962
|
+
if (e in this.data) {
|
|
1963
|
+
let r = this.toValue(t?.value);
|
|
1964
|
+
this.data?.[e]?.valueAll.push(...r), n && r.indexOf(!0) !== -1 && this.makeValueAll(n);
|
|
1965
|
+
}
|
|
1966
|
+
}), this;
|
|
1967
|
+
}
|
|
1968
|
+
makeValueUnique() {
|
|
1969
|
+
return y(this.data, (e) => {
|
|
1970
|
+
e.valueAll = Se(e.valueAll), x(e.value) || (e.value = [!0]), x(e.valueAll) || (e.valueAll = [!0]);
|
|
1971
|
+
}), this;
|
|
1972
|
+
}
|
|
1973
|
+
makeValueState(e = this.states, t) {
|
|
1974
|
+
return e?.forEach(({ index: e, item: n, state: r }) => {
|
|
1975
|
+
let i = this.data[e];
|
|
1976
|
+
if (i) {
|
|
1977
|
+
if (t) {
|
|
1978
|
+
let a = {
|
|
1979
|
+
name: i.name,
|
|
1980
|
+
index: e,
|
|
1981
|
+
value: this.toValue(n.value),
|
|
1982
|
+
state: []
|
|
1983
|
+
};
|
|
1984
|
+
t.push(a), this.makeValueState(r, a.state), a.state.length > 0 && a.value.length === 0 && a.value.push(!0);
|
|
1985
|
+
} else this.makeValueState(r, this.data[e]?.state);
|
|
1986
|
+
}
|
|
1987
|
+
}), this;
|
|
1988
|
+
}
|
|
1989
|
+
toName(e, t) {
|
|
1990
|
+
let n = e?.[g.prop];
|
|
1991
|
+
return E(typeof n == "string" && n || e?.[g.rename] || e?.[g.index] || t);
|
|
1992
|
+
}
|
|
1993
|
+
toValue(e) {
|
|
1994
|
+
if (x(e) && S(e)) {
|
|
1995
|
+
let t = [], n = !1;
|
|
1996
|
+
return y(e, (e, r) => {
|
|
1997
|
+
(!(r in this.data) || e?.[g.prop]) && (e?.[g.variable] === _.state ? t.push(r) : n = !0);
|
|
1998
|
+
}), n && t.push(!0), t;
|
|
1999
|
+
}
|
|
2000
|
+
return [!0];
|
|
2001
|
+
}
|
|
2002
|
+
}, cn = class extends J {
|
|
2003
|
+
data = [];
|
|
2004
|
+
constructor(e) {
|
|
2005
|
+
super(e), this.data = this.make(this.items?.value);
|
|
2006
|
+
}
|
|
2007
|
+
make(e, t = []) {
|
|
2008
|
+
let n = [];
|
|
2009
|
+
return x(e) && S(e) && y(e, (e) => {
|
|
2010
|
+
if (this.isClasses(e)) {
|
|
2011
|
+
let r = this.getNames(e, t);
|
|
2012
|
+
n.push({
|
|
2013
|
+
index: E(r.join("-")),
|
|
2014
|
+
full: e?.[g.fullName] ?? !1,
|
|
2015
|
+
className: r.join("__")
|
|
2016
|
+
}, ...this.make(e?.value, r));
|
|
2017
|
+
}
|
|
2018
|
+
}), n;
|
|
2019
|
+
}
|
|
2020
|
+
isClasses(e) {
|
|
2021
|
+
return !!(e?.[g.variable] === _.subclass || e?.[g.subclass]);
|
|
2022
|
+
}
|
|
2023
|
+
getNames(e, t) {
|
|
2024
|
+
let n = e?.[g.nameIndex] ?? e?.[g.index] ?? "";
|
|
2025
|
+
return e?.[g.fullName] ? [n] : [...t, n];
|
|
2026
|
+
}
|
|
2027
|
+
}, Y = " ", X = class {
|
|
2028
|
+
static getDir() {
|
|
2029
|
+
return [...o, t.getProjectName()];
|
|
2030
|
+
}
|
|
2031
|
+
static getSpace() {
|
|
2032
|
+
return Y;
|
|
2033
|
+
}
|
|
2034
|
+
static addSpace(e) {
|
|
2035
|
+
return xe(Y, e);
|
|
2036
|
+
}
|
|
2037
|
+
static addImport(e) {
|
|
2038
|
+
return `@import "${e}";`;
|
|
2039
|
+
}
|
|
2040
|
+
static addUse(e) {
|
|
2041
|
+
return `@use "${e}";`;
|
|
2042
|
+
}
|
|
2043
|
+
static addForward(e) {
|
|
2044
|
+
return `@forward "${e}";`;
|
|
2045
|
+
}
|
|
2046
|
+
static addImportProperties() {
|
|
2047
|
+
return "@use \"@dxtmisha/styles\" as ui;";
|
|
2048
|
+
}
|
|
2049
|
+
static join(e) {
|
|
2050
|
+
return e.join("\r\n");
|
|
2051
|
+
}
|
|
2052
|
+
static increaseSpace(e) {
|
|
2053
|
+
return `${e}${Y}`;
|
|
2054
|
+
}
|
|
2055
|
+
static toFunctionCss(e) {
|
|
2056
|
+
return e.match(/@[a-zA-Z0-9.]+\(.*?\)( |,|$)/) ? e.replace(/@([a-zA-Z0-9.]+\(.*?\))( |,|$)/g, "#{$1}$2") : e;
|
|
2057
|
+
}
|
|
2058
|
+
}, Z = class {
|
|
2059
|
+
property;
|
|
2060
|
+
space;
|
|
2061
|
+
content;
|
|
2062
|
+
first;
|
|
2063
|
+
item;
|
|
2064
|
+
constructor(e, t, n = () => [], r = !0) {
|
|
2065
|
+
this.property = e, this.space = t, this.content = n, this.first = r, this.item = e.item;
|
|
2066
|
+
}
|
|
2067
|
+
make() {
|
|
2068
|
+
return this.addSpace(this.treatment());
|
|
2069
|
+
}
|
|
2070
|
+
getName() {
|
|
2071
|
+
return this.item?.[g.name] ?? "";
|
|
2072
|
+
}
|
|
2073
|
+
getValue() {
|
|
2074
|
+
let e = this.item?.[g.css];
|
|
2075
|
+
if (e) return e.replace(/\\#/g, "#");
|
|
2076
|
+
}
|
|
2077
|
+
addSpace(e) {
|
|
2078
|
+
return y(e, (e) => `${this.space}${e}`);
|
|
2079
|
+
}
|
|
2080
|
+
addEmptyString() {
|
|
2081
|
+
return this.first ? [""] : [];
|
|
2082
|
+
}
|
|
2083
|
+
}, ln = class extends Z {
|
|
2084
|
+
treatment() {
|
|
2085
|
+
return this.content().length > 0 ? [
|
|
2086
|
+
...this.addEmptyString(),
|
|
2087
|
+
`${this.getName()} {`,
|
|
2088
|
+
...this.content(),
|
|
2089
|
+
"}"
|
|
2090
|
+
] : [];
|
|
2091
|
+
}
|
|
2092
|
+
}, un = class extends Z {
|
|
2093
|
+
treatment() {
|
|
2094
|
+
return [
|
|
2095
|
+
...this.addEmptyString(),
|
|
2096
|
+
`${this.getName()} {`,
|
|
2097
|
+
...this.content(),
|
|
2098
|
+
"}"
|
|
2099
|
+
];
|
|
2100
|
+
}
|
|
2101
|
+
}, dn = class extends Z {
|
|
2102
|
+
treatment() {
|
|
2103
|
+
let { value: e } = this.property;
|
|
2104
|
+
if (S(e)) {
|
|
2105
|
+
let t = [];
|
|
2106
|
+
return new P(e).each(({ item: e }) => {
|
|
2107
|
+
e?.[g.variable] === _.var && e?.[g.css] && (t.push(this.getCode(e)), e?.[g.cssColorOpacity] && t.push(this.getCodeColorOpacity(e)));
|
|
2108
|
+
}), t;
|
|
2109
|
+
}
|
|
2110
|
+
let { item: t } = this.property;
|
|
2111
|
+
return t?.[g.cssColorOpacity] ? [this.getCode(), this.getCodeColorOpacity()] : [this.getCode()];
|
|
2112
|
+
}
|
|
2113
|
+
getCode(e = this.item) {
|
|
2114
|
+
let t = e?.[g.css];
|
|
2115
|
+
return t = typeof t != "string" || t === "" ? "unset" : L.isColor(t) ? `#{ui.toColorRbg(${t})}` : t.replace(/\\#/g, "#"), `${e?.[g.name]}: ${X.toFunctionCss(t)};`;
|
|
2116
|
+
}
|
|
2117
|
+
getCodeColorOpacity(e = this.item) {
|
|
2118
|
+
let t = e?.[g.css], n = e?.[g.cssColorOpacity];
|
|
2119
|
+
return n && typeof n != "boolean" ? `${e?.[g.name]}-opacity: ${n};` : `${e?.[g.name]}-opacity: #{ui.toColorOpacity(${t})};`;
|
|
2120
|
+
}
|
|
2121
|
+
}, fn = /* @__PURE__ */ "flex-position.flex-dynamic.justify-content.inset.horizon.vertically.left.right.absolute.absolute-top.absolute-bottom.absolute-after.padding-x.padding-y.padding-left.padding-right.margin-x.margin-y.margin-left.margin-right.width.height.width-basis.height-basis.aspect-ratio.aspect-ratio-width.aspect-ratio-height.squared.circle.font-size.line-height.text-align.text-overflow.clamp.text-select-none.text-case.paragraph-spacing.palette.palette-var.palette-color.palette-stroke.palette-background.palette-fill.palette-gradient.palette-border.color.color-opacity.stroke.stroke-opacity.background-color.background-opacity.background-size.fill.fill-opacity.gradient.gradient-opacity.border-color.border-opacity.outline-color.outline-opacity.translate-x.translate-y.scale.rotate".split("."), pn = class extends Z {
|
|
2122
|
+
treatment() {
|
|
2123
|
+
let e = [];
|
|
2124
|
+
return this.property?.previous && this.property.previous?.[g.sort] !== this.item?.[g.sort] && e.push(""), this.item?.[g.varKey] && e.push(this.getVar()), e.push(this.getPropertyValue()), e;
|
|
2125
|
+
}
|
|
2126
|
+
getVar() {
|
|
2127
|
+
let { design: e, component: t } = this.property, n = this.getName(), r = this.getValue();
|
|
2128
|
+
return `--${N.getComponentName(e, t)}-${n}: ${r};`;
|
|
2129
|
+
}
|
|
2130
|
+
getPropertyValue() {
|
|
2131
|
+
let e = this.getName(), t = this.getValue() ?? "unset";
|
|
2132
|
+
if (this.item?.[g.modification] !== !1 && fn.indexOf(e) !== -1) return `@include ui.${E(e)}(#{${t}});${this.initAuxiliaryValue()}`;
|
|
2133
|
+
let n = `${e}: ${X.toFunctionCss(t)}`;
|
|
2134
|
+
return e === "font-family" ? `${n}, sans-serif;` : `${n};`;
|
|
2135
|
+
}
|
|
2136
|
+
initAuxiliaryValue() {
|
|
2137
|
+
let e = this.getName(), t = this.property.parent?.value;
|
|
2138
|
+
if (S(t)) switch (e) {
|
|
2139
|
+
case "color-opacity":
|
|
2140
|
+
if (!("color" in t)) return " @include ui.color('init');";
|
|
2141
|
+
break;
|
|
2142
|
+
case "background-opacity":
|
|
2143
|
+
if (!("backgroundColor" in t)) return " @include ui.backgroundColor('init');";
|
|
2144
|
+
break;
|
|
2145
|
+
case "gradient-opacity":
|
|
2146
|
+
if (!("gradient" in t)) return " @include ui.gradient('init');";
|
|
2147
|
+
break;
|
|
2148
|
+
case "border-opacity": if (!("borderColor" in t)) return " @include ui.borderColor('init');";
|
|
2149
|
+
}
|
|
2150
|
+
return "";
|
|
2151
|
+
}
|
|
2152
|
+
}, mn = class extends Z {
|
|
2153
|
+
treatment() {
|
|
2154
|
+
return this.content().length > 0 ? [
|
|
2155
|
+
...this.addEmptyString(),
|
|
2156
|
+
`${this.getSelector()} {`,
|
|
2157
|
+
...this.content(),
|
|
2158
|
+
"}"
|
|
2159
|
+
] : [];
|
|
2160
|
+
}
|
|
2161
|
+
getClassName() {
|
|
2162
|
+
let { design: e, component: t } = this.property;
|
|
2163
|
+
return `'${N.getClassName(e, t)}'`;
|
|
2164
|
+
}
|
|
2165
|
+
getSelector() {
|
|
2166
|
+
let e = this.getName(), t = this.getClassName(), n = t === `'.${this.property.parent?.[g.name]}'`;
|
|
2167
|
+
switch (e) {
|
|
2168
|
+
case "hover":
|
|
2169
|
+
case "active":
|
|
2170
|
+
case "focus":
|
|
2171
|
+
case "disabled":
|
|
2172
|
+
case "readonly": return `@include ui.${e}${n ? "" : `(${t})`}`;
|
|
2173
|
+
default: return `&:${O(e)}`;
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
}, hn = class extends Z {
|
|
2177
|
+
contentType = ["after", "before"];
|
|
2178
|
+
treatment() {
|
|
2179
|
+
let e = this.getName(), t = [...this.addEmptyString(), `&::${e} {`];
|
|
2180
|
+
return this.contentType.indexOf(e) !== -1 && t.push(`${X.getSpace()}content: ' ';`), t.push(...this.content()), t.push("}"), t;
|
|
2181
|
+
}
|
|
2182
|
+
}, gn = class extends Z {
|
|
2183
|
+
treatment() {
|
|
2184
|
+
return [
|
|
2185
|
+
...this.addEmptyString(),
|
|
2186
|
+
`@media screen and ${this.getName()} {`,
|
|
2187
|
+
...this.content(),
|
|
2188
|
+
"}"
|
|
2189
|
+
];
|
|
2190
|
+
}
|
|
2191
|
+
}, _n = class extends Z {
|
|
2192
|
+
treatment() {
|
|
2193
|
+
return [
|
|
2194
|
+
...this.addEmptyString(),
|
|
2195
|
+
`@container ${this.getName()} {`,
|
|
2196
|
+
...this.content(),
|
|
2197
|
+
"}"
|
|
2198
|
+
];
|
|
2199
|
+
}
|
|
2200
|
+
}, vn = class extends Z {
|
|
2201
|
+
treatment() {
|
|
2202
|
+
return [
|
|
2203
|
+
...this.addEmptyString(),
|
|
2204
|
+
`@keyframes ${this.getName()} {`,
|
|
2205
|
+
...this.content(),
|
|
2206
|
+
"}"
|
|
2207
|
+
];
|
|
2208
|
+
}
|
|
2209
|
+
}, yn = class extends Z {
|
|
2210
|
+
treatment() {
|
|
2211
|
+
return [
|
|
2212
|
+
...this.addEmptyString(),
|
|
2213
|
+
`@at-root ${this.getName()} {`,
|
|
2214
|
+
...this.content(),
|
|
2215
|
+
"}"
|
|
2216
|
+
];
|
|
2217
|
+
}
|
|
2218
|
+
}, bn = ["selector", "virtual"], xn = [
|
|
2219
|
+
"var",
|
|
2220
|
+
"property",
|
|
2221
|
+
"scss"
|
|
2222
|
+
], Sn = class e {
|
|
2223
|
+
space;
|
|
2224
|
+
property;
|
|
2225
|
+
parent;
|
|
2226
|
+
item;
|
|
2227
|
+
data = [];
|
|
2228
|
+
first = !1;
|
|
2229
|
+
constructor(e, t, n) {
|
|
2230
|
+
this.space = e, this.property = t, this.parent = n, this.item = t.item;
|
|
2231
|
+
}
|
|
2232
|
+
make() {
|
|
2233
|
+
return new P({}).eachMainOnly((t) => {
|
|
2234
|
+
let { item: n } = t;
|
|
2235
|
+
if (this.isAuxiliary() && this.isAuxiliary(n) && this.isNotBasic(n)) {
|
|
2236
|
+
let n = new e(X.increaseSpace(this.space), t, this.item).make();
|
|
2237
|
+
this.data.push(`${this.space}& {`, ...n, `${this.space}}`);
|
|
2238
|
+
} else {
|
|
2239
|
+
let e = this.toByType(t);
|
|
2240
|
+
e.length > 0 && (this.first = !0), this.data.push(...e);
|
|
2241
|
+
}
|
|
2242
|
+
}, this.property), this.data;
|
|
2243
|
+
}
|
|
2244
|
+
isAuxiliary(e = this.parent) {
|
|
2245
|
+
return !!(e && bn.indexOf(e?.[g.variable]) !== -1);
|
|
2246
|
+
}
|
|
2247
|
+
isNotBasic(e) {
|
|
2248
|
+
return !(e && xn.indexOf(e?.[g.variable]) !== -1);
|
|
2249
|
+
}
|
|
2250
|
+
getContent(t) {
|
|
2251
|
+
return () => new e(this.space, t, this.item).make();
|
|
2252
|
+
}
|
|
2253
|
+
getArgumentsForTo(e) {
|
|
2254
|
+
return [
|
|
2255
|
+
e,
|
|
2256
|
+
this.space,
|
|
2257
|
+
this.getContent(e),
|
|
2258
|
+
this.first
|
|
2259
|
+
];
|
|
2260
|
+
}
|
|
2261
|
+
toByType(e) {
|
|
2262
|
+
let t = this.getArgumentsForTo(e);
|
|
2263
|
+
switch (e.item?.[g.variable]) {
|
|
2264
|
+
case _.var: return new dn(...t).make();
|
|
2265
|
+
case _.property: return new pn(...t).make();
|
|
2266
|
+
case _.selector: return new mn(...t).make();
|
|
2267
|
+
case _.virtual: return new hn(...t).make();
|
|
2268
|
+
case _.media:
|
|
2269
|
+
case _.mediaMax: return new gn(...t).make();
|
|
2270
|
+
case _.container:
|
|
2271
|
+
case _.containerMax: return new _n(...t).make();
|
|
2272
|
+
case _.animate: return new vn(...t).make();
|
|
2273
|
+
case _.root: return new yn(...t).make();
|
|
2274
|
+
case _.state:
|
|
2275
|
+
case _.subclass:
|
|
2276
|
+
case _.classType:
|
|
2277
|
+
case _.scss: return new ln(...t).make();
|
|
2278
|
+
case _.animateFrame: return new un(...t).make();
|
|
2279
|
+
default: return [];
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
}, Cn = class extends J {
|
|
2283
|
+
data;
|
|
2284
|
+
constructor(e) {
|
|
2285
|
+
super(e), this.data = this.make();
|
|
2286
|
+
}
|
|
2287
|
+
make() {
|
|
2288
|
+
return this.items ? [
|
|
2289
|
+
"& {",
|
|
2290
|
+
...new Sn(" ", this.items).make(),
|
|
2291
|
+
"}"
|
|
2292
|
+
] : [];
|
|
2293
|
+
}
|
|
2294
|
+
}, wn = class {
|
|
2295
|
+
component;
|
|
2296
|
+
items;
|
|
2297
|
+
itemsClasses;
|
|
2298
|
+
itemsStyles;
|
|
2299
|
+
constructor(e) {
|
|
2300
|
+
this.component = E(e ?? "component");
|
|
2301
|
+
}
|
|
2302
|
+
get() {
|
|
2303
|
+
return this.items === void 0 && (this.items = this.make()), this.items;
|
|
2304
|
+
}
|
|
2305
|
+
getClasses() {
|
|
2306
|
+
return this.itemsClasses === void 0 && (this.itemsClasses = this.makeClasses()), this.itemsClasses;
|
|
2307
|
+
}
|
|
2308
|
+
getStyles() {
|
|
2309
|
+
return this.itemsStyles === void 0 && (this.itemsStyles = this.makeStyles()), this.itemsStyles;
|
|
2310
|
+
}
|
|
2311
|
+
getDesign() {
|
|
2312
|
+
return t.getDesignName();
|
|
2313
|
+
}
|
|
2314
|
+
getDesignFirst() {
|
|
2315
|
+
return D(t.getDesignName());
|
|
2316
|
+
}
|
|
2317
|
+
getComponentName() {
|
|
2318
|
+
return this.component;
|
|
2319
|
+
}
|
|
2320
|
+
getComponentNameFirst() {
|
|
2321
|
+
return D(this.component);
|
|
2322
|
+
}
|
|
2323
|
+
getFullComponentName() {
|
|
2324
|
+
return `${this.getDesignFirst()}${this.getComponentNameFirst()}`;
|
|
2325
|
+
}
|
|
2326
|
+
getFileName() {
|
|
2327
|
+
return D(this.getPathName());
|
|
2328
|
+
}
|
|
2329
|
+
getPathName() {
|
|
2330
|
+
return `${t.getDesignName()}-${this.component}`;
|
|
2331
|
+
}
|
|
2332
|
+
getPathClasses() {
|
|
2333
|
+
return `${this.getPathName()}-${fe}`;
|
|
2334
|
+
}
|
|
2335
|
+
make() {
|
|
2336
|
+
return M.get([f], this.getPathName(), () => new sn(this.component).get());
|
|
2337
|
+
}
|
|
2338
|
+
makeClasses() {
|
|
2339
|
+
return M.get([f], this.getPathClasses(), () => new cn(this.component).get());
|
|
2340
|
+
}
|
|
2341
|
+
makeStyles() {
|
|
2342
|
+
return new Cn(this.component).get();
|
|
2343
|
+
}
|
|
2344
|
+
}, Tn = class {
|
|
2345
|
+
structure;
|
|
2346
|
+
sample;
|
|
2347
|
+
component;
|
|
2348
|
+
mark;
|
|
2349
|
+
constructor(e, t, n) {
|
|
2350
|
+
this.structure = e, this.sample = n, this.mark = D(t), this.component = this.structure.getComponentNameFirst();
|
|
2351
|
+
}
|
|
2352
|
+
get() {
|
|
2353
|
+
return this.sample;
|
|
2354
|
+
}
|
|
2355
|
+
getRoot() {
|
|
2356
|
+
return "../../";
|
|
2357
|
+
}
|
|
2358
|
+
getNameFile(e) {
|
|
2359
|
+
return e.replace(/\[project]/g, t.getProjectName()).replace(/\[design]/g, this.structure.getDesign()).replace(/\[Design]/g, D(this.structure.getDesign())).replace(/\[component]/g, this.structure.getComponentName()).replace(/DesignComponent/g, this.structure.getFileName()).replace(new RegExp(this.mark, "g"), this.component).replace(RegExp(`DefineSetupFn${this.component}`, "g"), "DefineSetupFnComponent");
|
|
2360
|
+
}
|
|
2361
|
+
replaceName() {
|
|
2362
|
+
return this.sample = this.getNameFile(this.sample), this;
|
|
2363
|
+
}
|
|
2364
|
+
replacePath() {
|
|
2365
|
+
return this.sample = this.sample.replace(/..\/..\/..\//g, this.getRoot()), this;
|
|
2366
|
+
}
|
|
2367
|
+
replaceMark(e, t, n = "") {
|
|
2368
|
+
let r = `\\[?\\/\\/[\\]: #\\(]+:${e} `, i = this.sample.match(RegExp(`^( *)(${r})`, "m"))?.[1];
|
|
2369
|
+
if (typeof i != "string" && this.sample.match(e) && (r = `<!-- :${e} `, i = this.sample.match(RegExp(`^( *)(${r})`, "m"))?.[1]), typeof i == "string") {
|
|
2370
|
+
let e = `\r\n${i}`, a = t.join(`${n}${e}`).replace(/\[space]/g, e).replace(/\$/g, "$$$$");
|
|
2371
|
+
this.sample = a.trim() === "" ? this.sample.replace(RegExp(`(^ *)(${r}.*?$)([\\S\\s]+)(^ *${r})`, "gm"), "$1$2\r\n$4") : this.sample.replace(RegExp(`(^ *)(${r}.*?$)([\\S\\s]+)(^ *${r})`, "gm"), `$1$2${e}${a}\r\n$4`);
|
|
2372
|
+
}
|
|
2373
|
+
return this;
|
|
2374
|
+
}
|
|
2375
|
+
replaceOnce(e = E(this.mark), t = !1) {
|
|
2376
|
+
let n = RegExp(`\\/\\/ :${e}\\.once ([^\r\n]+)([\r\n ]*)`, "g"), r = RegExp(`\\/\\* :${e}\\.once \\*\\/([\\S\\s]*?)\\/\\* :${e}\\.once\\.end \\*\\/([\r\n ]*)`, "g"), i = RegExp(`\\/\\* :${e}\\.once (.*?) \\*\\/([\r\n ]*)`, "g"), a = RegExp(`<!-- :${e}\\.once -->([\\S\\s]*?)<!-- :${e}\\.once\\.end -->([\r\n ]*)`, "g"), o = RegExp(`<!-- :${e}\\.once (.*?) -->([\r\n ]*)`, "g"), s = (...e) => typeof t == "function" ? `${t(e[1])}${e[2]}` : t ? "" : `${e[1]}${e[2]}`;
|
|
2377
|
+
return this.sample = this.sample.replace(n, s).replace(r, s).replace(i, s).replace(a, s).replace(o, s), this;
|
|
2378
|
+
}
|
|
2379
|
+
replaceType(e) {
|
|
2380
|
+
let t = "type", n = this.structure.get(), r = [];
|
|
2381
|
+
return e && r.push(...this.getTypeForConstructor(e)), y(n, ({ name: n, valueAll: i, style: a }) => {
|
|
2382
|
+
let o = this.getPropTypeByValue(i, a);
|
|
2383
|
+
if (!this.initMarkAddValue(t, n, o) && !this.isNoMark(t, n)) {
|
|
2384
|
+
let t = !e && !o.match(/string|boolean/) && o.match(/'/) ? `${o}` : o;
|
|
2385
|
+
r.push(`${n}?: ${t}`);
|
|
2386
|
+
}
|
|
2387
|
+
}), this.replaceMark(t, r);
|
|
2388
|
+
}
|
|
2389
|
+
replaceDefault() {
|
|
2390
|
+
let e = "default", t = this.structure.get(), n = [];
|
|
2391
|
+
return y(t, (t) => {
|
|
2392
|
+
t.default && !this.isNoMark(e, t.name) && n.push(`${t.name}: ${this.getDefault(t.default)}`);
|
|
2393
|
+
}), this.replaceMark(e, n, ",");
|
|
2394
|
+
}
|
|
2395
|
+
replaceProps() {
|
|
2396
|
+
let e = this.structure.get(), t = [], n = this.getIndexDefault();
|
|
2397
|
+
return y(e, (e) => {
|
|
2398
|
+
if (!this.isNoMark("type", e.name)) {
|
|
2399
|
+
let r = this.getPropByValue(e.name, e.valueAll);
|
|
2400
|
+
e.default ? t.push(`${e.name}: {[space] type: ${r},[space] default: ${n}?.${e.name}[space]}`) : t.push(`${e.name}: ${r}`);
|
|
2401
|
+
}
|
|
2402
|
+
}), this.replaceMark("prop", t, ",");
|
|
2403
|
+
}
|
|
2404
|
+
replacePropsValues() {
|
|
2405
|
+
let e = this.structure.get(), t = [];
|
|
2406
|
+
return y(e, (e) => {
|
|
2407
|
+
if (!this.isNoMark("type", e.name)) {
|
|
2408
|
+
let n = this.getPropValuesByValue(e.valueAll);
|
|
2409
|
+
n ? t.push(`${e.name}: [${n}]`) : e.valueAll?.indexOf("custom") !== -1 && t.push(`${e.name}: []`);
|
|
2410
|
+
}
|
|
2411
|
+
}), this.replaceMark("values", t, ",");
|
|
2412
|
+
}
|
|
2413
|
+
replaceClasses(e = (e) => `${e.index}: string`, t = "") {
|
|
2414
|
+
let n = this.structure.getClasses(), r = [];
|
|
2415
|
+
return y(n, (t) => r.push(e(t))), this.replaceMark("classes", r, t);
|
|
2416
|
+
}
|
|
2417
|
+
replaceClassesValues() {
|
|
2418
|
+
let e = [`'${this.structure?.getPathName()}': true`, ...this.initClassesValues()];
|
|
2419
|
+
return this.replaceMark("classes-values", e, ",");
|
|
2420
|
+
}
|
|
2421
|
+
replaceStylesValues() {
|
|
2422
|
+
let e = this.initStylesValues();
|
|
2423
|
+
return this.replaceMark("styles-values", e, ",");
|
|
2424
|
+
}
|
|
2425
|
+
replaceConstructorClasses() {
|
|
2426
|
+
return this.replaceClasses((e) => e.full ? `${e.index}: '${e.className}'` : `${e.index}: this.getSubClass('${e.className}')`, ",");
|
|
2427
|
+
}
|
|
2428
|
+
isBoolean(e) {
|
|
2429
|
+
return e.indexOf(!0) !== -1;
|
|
2430
|
+
}
|
|
2431
|
+
isString(e) {
|
|
2432
|
+
return e.length > 0 && e[0] !== !0;
|
|
2433
|
+
}
|
|
2434
|
+
isNoMark(e, t) {
|
|
2435
|
+
return !!this.sample.match(`:${e}.${t}.none`);
|
|
2436
|
+
}
|
|
2437
|
+
getDefault(e) {
|
|
2438
|
+
return typeof e == "string" ? `'${e}'` : `${e}`;
|
|
2439
|
+
}
|
|
2440
|
+
getPropByValue(e, t) {
|
|
2441
|
+
if (!this.isString(t)) return "Boolean";
|
|
2442
|
+
let n = this.isBoolean(t) ? "[String, Boolean]" : "String", r = this.getIndexProp();
|
|
2443
|
+
return r ? `${n} as PropType<${r}['${e}']>` : n;
|
|
2444
|
+
}
|
|
2445
|
+
getPropTypeByValue(e, t) {
|
|
2446
|
+
let n = [];
|
|
2447
|
+
return this.isBoolean(e) && n.push("boolean"), t && n.push("string"), this.isString(e) && e.forEach((e) => n.push(e === !0 ? "true" : `'${e}'`)), n.length === 0 && n.push("boolean"), n.join(" | ");
|
|
2448
|
+
}
|
|
2449
|
+
getPropValuesByValue(e) {
|
|
2450
|
+
if (this.isString(e)) {
|
|
2451
|
+
let t = [];
|
|
2452
|
+
return e.forEach((e) => {
|
|
2453
|
+
e !== "custom" && t.push(e === !0 ? "true" : `'${e}'`);
|
|
2454
|
+
}), t.join(", ");
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
getIndexProp() {
|
|
2458
|
+
return this.sample.match(/type ([a-zA-Z]*Props[a-zA-Z]*) =/)?.[1];
|
|
2459
|
+
}
|
|
2460
|
+
getIndexDefault() {
|
|
2461
|
+
return this.sample.match(/const ([a-zA-Z]*defaults[a-zA-Z]*)[ :]/)?.[1];
|
|
2462
|
+
}
|
|
2463
|
+
getTypeForConstructor(e) {
|
|
2464
|
+
let t = b(this.structure.get(), "name"), n = [];
|
|
2465
|
+
return e.match(/(?<=type[^{]+Props[^{]+{[^{}]+)(^[^\n{}/]+$)(?=[^{}]+^})/gim)?.forEach((e) => {
|
|
2466
|
+
let r = e.match(/[a-z0-9]+(?=[?:])/i)?.[0];
|
|
2467
|
+
r && t.indexOf(r) === -1 && n.push(`// [constructor] ${e.trim()}`);
|
|
2468
|
+
}), n;
|
|
2469
|
+
}
|
|
2470
|
+
initMarkAddValue(e, t, n) {
|
|
2471
|
+
return this.sample.match(`:${e}.${t}`) ? (this.sample = this.sample.replace(RegExp(`(/[*] ?:${e}[.]${t} ?[*]/)[^\r\n]*`, "g"), `$1 | ${n}`), !0) : !1;
|
|
2472
|
+
}
|
|
2473
|
+
initClassesValues(e = this.structure.get(), t = this.structure?.getPathName() ?? "", n = []) {
|
|
2474
|
+
let r = [];
|
|
2475
|
+
return y(e, (e) => {
|
|
2476
|
+
let { name: i, value: a, state: o } = e, s = `props.${i}`, c = "className" in e && e?.className || `${t}--${i}`, l = [
|
|
2477
|
+
...n,
|
|
2478
|
+
this.isString(a) ? `Boolean(${s})` : s,
|
|
2479
|
+
...this.initClassesCategory(e)
|
|
2480
|
+
];
|
|
2481
|
+
this.isBoolean(a) && r.push(`'${c}': ${l.join(" && ")}`, ...this.initClassesValues(o, c, l)), "style" in e && e.style && r.push(`'${c}--${le}': isFilled(${s}) && !inArray(propsValues.${i}, ${s})`), this.isString(a) && (a.length !== 1 || a[0] !== "custom") && r.push(`[\`${c.match(/-palette$/) ? `${c} ` : ""}${c}--\${${s}}\`]: inArray(propsValues.${i}, ${s})`);
|
|
2482
|
+
}), r;
|
|
2483
|
+
}
|
|
2484
|
+
initClassesCategory(e) {
|
|
2485
|
+
let t = [];
|
|
2486
|
+
return "category" in e && e.category && e.default && y(this.structure.get(), ({ name: n, category: r }) => {
|
|
2487
|
+
e.name !== n && e.category === r && t.push(`!props.${n}`);
|
|
2488
|
+
}), t;
|
|
2489
|
+
}
|
|
2490
|
+
initStylesValues(e = this.structure.get()) {
|
|
2491
|
+
let t = [], n = this.structure?.getPathName();
|
|
2492
|
+
return y(e, ({ name: e, style: r }) => {
|
|
2493
|
+
r && t.push(`'--${n}-sys-${e}': props.${e} ?? null`);
|
|
2494
|
+
}), t;
|
|
2495
|
+
}
|
|
2496
|
+
}, En = class {
|
|
2497
|
+
command;
|
|
2498
|
+
options;
|
|
2499
|
+
structure;
|
|
2500
|
+
constructor(e, t = {}) {
|
|
2501
|
+
this.command = e, this.options = t;
|
|
2502
|
+
}
|
|
2503
|
+
async make() {
|
|
2504
|
+
this.command ? (console.info(`-- ${t.getDesignName()}.${this.command}:`), await this.initMain(), console.info("-- end")) : console.info("-- not name");
|
|
2505
|
+
}
|
|
2506
|
+
isFile(t) {
|
|
2507
|
+
return e.is([...this.dir, ...T(t)]);
|
|
2508
|
+
}
|
|
2509
|
+
getCommand() {
|
|
2510
|
+
return this.command;
|
|
2511
|
+
}
|
|
2512
|
+
getName() {
|
|
2513
|
+
return D(this.getCommand());
|
|
2514
|
+
}
|
|
2515
|
+
getNameMin() {
|
|
2516
|
+
return E(this.getCommand());
|
|
2517
|
+
}
|
|
2518
|
+
getCode() {
|
|
2519
|
+
return O(this.getCommand());
|
|
2520
|
+
}
|
|
2521
|
+
getFullName() {
|
|
2522
|
+
return D(`${t.getDesignName()}-${this.getCommand()}`);
|
|
2523
|
+
}
|
|
2524
|
+
getProjectName() {
|
|
2525
|
+
return D(t.getProjectName());
|
|
2526
|
+
}
|
|
2527
|
+
getStructure() {
|
|
2528
|
+
return this.structure ||= new wn(this.getCommand()), this.structure;
|
|
2529
|
+
}
|
|
2530
|
+
getReplace(e) {
|
|
2531
|
+
return new Tn(this.getStructure(), this.mark, e ?? "");
|
|
2532
|
+
}
|
|
2533
|
+
read(t) {
|
|
2534
|
+
return e.readFile([...this.dir, ...T(t)]);
|
|
2535
|
+
}
|
|
2536
|
+
readSample(e) {
|
|
2537
|
+
return this.sample?.[e];
|
|
2538
|
+
}
|
|
2539
|
+
readDefinable(e, t) {
|
|
2540
|
+
let n = this.getReplace().getNameFile(e);
|
|
2541
|
+
if (this.isFile(n)) return this.getReplace(this.read(n));
|
|
2542
|
+
let r = this.getReplace(this.readSample(e));
|
|
2543
|
+
return t && t(r), r.replaceOnce().replaceName(), r;
|
|
2544
|
+
}
|
|
2545
|
+
write(t, n) {
|
|
2546
|
+
this.console(t), e.write(this.dir, t, n, "");
|
|
2547
|
+
}
|
|
2548
|
+
updatePackage(t, n) {
|
|
2549
|
+
let r = h(), i = r;
|
|
2550
|
+
if (r && i) {
|
|
2551
|
+
let a = t.split("|"), o = a.pop();
|
|
2552
|
+
for (let e of a) e in i || (i[e] = {}), i = i[e];
|
|
2553
|
+
o && (i[o] = n), e.writeByPath(ae, r);
|
|
2554
|
+
}
|
|
2555
|
+
return this;
|
|
2556
|
+
}
|
|
2557
|
+
console(e) {
|
|
2558
|
+
console.info(`-- ${this.isFile(e) ? "update" : "create"} ${e}`);
|
|
2559
|
+
}
|
|
2560
|
+
}, Dn = {
|
|
2561
|
+
"basicTypes.ts": "",
|
|
2562
|
+
"Constructors.ts": "import type { Ref, ToRefs } from 'vue'\nimport { type ConstrEmit, type DesignComp } from '@dxtmisha/functional'\n\nimport type { ConstructorsComponents, ConstructorsEmits, ConstructorsSlots } from './types'\nimport type { ConstructorsProps } from './props'\n\n/**\n * Constructors\n */\nexport class Constructors {\n /**\n * Constructor\n * @param props input data/ входные данные\n * @param refs input data in the form of reactive elements/ входные данные в виде реактивных элементов\n * @param element input element/ элемент ввода\n * @param classDesign design name/ название дизайна\n * @param className class name/ название класса\n * @param components object for working with components/ объект для работы с компонентами\n * @param slots object for working with slots/ объект для работы со слотами\n * @param emits the function is called when an event is triggered/ функция вызывается, когда срабатывает событие\n */\n constructor(\n protected readonly props: ConstructorsProps,\n protected readonly refs: ToRefs<ConstructorsProps>,\n protected readonly element: Ref<HTMLElement | undefined>,\n protected readonly classDesign: string,\n protected readonly className: string,\n protected readonly components?: DesignComp<ConstructorsComponents, ConstructorsProps>,\n protected readonly slots?: ConstructorsSlots,\n protected readonly emits?: ConstrEmit<ConstructorsEmits>\n ) {\n }\n}\n",
|
|
2563
|
+
"ConstructorsDesign.tsx": "import { h, type VNode } from 'vue'\nimport {\n type ConstrOptions,\n type ConstrStyles,\n DesignConstructorAbstract\n} from '@dxtmisha/functional'\n\nimport { Constructors } from './Constructors'\n\nimport {\n type ConstructorsPropsBasic\n} from './props'\nimport {\n type ConstructorsClasses,\n type ConstructorsComponents,\n type ConstructorsEmits,\n type ConstructorsExpose,\n type ConstructorsSlots\n} from './types'\n\n/**\n * ConstructorsDesign\n */\nexport class ConstructorsDesign<\n COMP extends ConstructorsComponents,\n EXPOSE extends ConstructorsExpose,\n CLASSES extends ConstructorsClasses,\n P extends ConstructorsPropsBasic\n> extends DesignConstructorAbstract<\n HTMLDivElement,\n COMP,\n ConstructorsEmits,\n EXPOSE,\n ConstructorsSlots,\n CLASSES,\n P\n > {\n protected readonly item: Constructors\n\n /**\n * Constructor\n * @param name class name/ название класса\n * @param props properties/ свойства\n * @param options list of additional parameters/ список дополнительных параметров\n * @param ItemConstructor constructors item class/ класс элемента конструкторов\n */\n constructor(\n name: string,\n props: Readonly<P>,\n options?: ConstrOptions<COMP, ConstructorsEmits, P>,\n ItemConstructor: typeof Constructors = Constructors\n ) {\n super(\n name,\n props,\n options\n )\n\n this.item = new ItemConstructor(\n this.props,\n this.refs,\n this.element,\n this.getDesign(),\n this.getName(),\n this.components,\n this.slots,\n this.emits\n )\n\n // TODO: Method for initializing base objects\n // TODO: Метод для инициализации базовых объектов\n\n this.init()\n }\n\n /**\n * Initialization of all the necessary properties for work\n *\n * Инициализация всех необходимых свойств для работы.\n */\n protected initExpose(): EXPOSE {\n return {\n // TODO: list of properties for export\n // TODO: список свойств для экспорта\n } as EXPOSE\n }\n\n /**\n * Improvement of the obtained list of classes.\n *\n * Доработка полученного списка классов.\n */\n protected initClasses(): Partial<CLASSES> {\n return {\n main: {},\n ...{\n // :classes [!] System label / Системная метка\n // :classes [!] System label / Системная метка\n }\n } as Partial<CLASSES>\n }\n\n /**\n * Refinement of the received list of styles.\n *\n * Доработка полученного списка стилей.\n */\n protected initStyles(): ConstrStyles {\n return {\n // TODO: list of user styles\n // TODO: список пользовательских стилей\n }\n }\n\n /**\n * A method for rendering.\n *\n * Метод для рендеринга.\n */\n protected initRender(): VNode {\n // const children: any[] = []\n\n return h('div', {\n // ...this.getAttrs(),\n ref: this.element,\n class: this.classes?.value.main\n })\n }\n}\n",
|
|
2564
|
+
"index.ts": "export * from './Constructors'\nexport * from './ConstructorsDesign'\nexport * from './props'\nexport * from './types'\nexport * from './basicTypes'\n",
|
|
2565
|
+
"props.ts": "type ConstructorsPropsToken = {\n // :type [!] System label / Системная метка\n // :type [!] System label / Системная метка\n}\n\nexport type ConstructorsPropsBasic = {\n // TODO: Location for a custom property / Место для пользовательского свойства\n}\n\n/**\n * Type describing incoming properties.\n *\n * Тип, описывающий входящие свойства.\n */\nexport type ConstructorsProps = ConstructorsPropsBasic & ConstructorsPropsToken\n\n/**\n * Default value for property.\n *\n * Значение по умолчанию для свойства.\n */\nexport const defaultsConstructors = {\n // TODO: Location for a user-defined default value / Место для пользовательского значения по умолчанию\n ...{\n // :default [!] System label / Системная метка\n // :default [!] System label / Системная метка\n }\n}\n",
|
|
2566
|
+
"style.scss": "@use \"@dxtmisha/styles/properties\" as ui;\n\n@mixin mixinConstructors {\n\n}\n",
|
|
2567
|
+
"types.ts": "import type { ConstrClass } from '@dxtmisha/functional'\n\n/**\n * Interface for describing which components need to be connected for work.\n *\n * Интерфейс для описания, какие компоненты надо подключить для работы.\n */\nexport type ConstructorsComponents = {\n // componentName: object\n}\n\n/**\n * Type describing available events.\n *\n * Тип, описывающий доступные события.\n */\nexport type ConstructorsEmits = {\n // load: [value: string]\n}\n\n/**\n * Type describing available properties.\n *\n * Тип, описывающий доступные свойства.\n */\nexport interface ConstructorsExpose {\n}\n\n/**\n * Type describing available slots.\n *\n * Тип, описывающий доступные слоты.\n */\nexport interface ConstructorsSlots {\n // default? (props: any): any\n}\n\n/**\n * Type describing subclasses.\n *\n * Тип, описывающий подклассы.\n */\nexport type ConstructorsClasses = {\n main: ConstrClass\n // :classes [!] System label / Системная метка\n // :classes [!] System label / Системная метка\n}\n"
|
|
2568
|
+
}, On = "properties.json", kn = "props.ts", An = "types.ts", jn = "basicTypes.ts", Mn = "style.scss", Nn = "Constructors.ts", Pn = "ConstructorsDesign.tsx", Fn = "index.ts", In = class extends En {
|
|
2569
|
+
sample = Dn;
|
|
2570
|
+
mark = u;
|
|
2571
|
+
dir;
|
|
2572
|
+
constructor(t, n = {}) {
|
|
2573
|
+
super(t, n), this.dir = [
|
|
2574
|
+
e.getRoot(),
|
|
2575
|
+
"src",
|
|
2576
|
+
this.mark,
|
|
2577
|
+
this.getStructure().getComponentNameFirst()
|
|
2578
|
+
];
|
|
2579
|
+
}
|
|
2580
|
+
initMain() {
|
|
2581
|
+
this.makeProperties().makeProps().makeTypes().makeTypesBasic().makeStyle().makeCode().makeMain().makeIndex().makeFilePackage().makeLibrary();
|
|
2582
|
+
}
|
|
2583
|
+
makeProperties() {
|
|
2584
|
+
let e = On;
|
|
2585
|
+
return this.isFile(e) || this.write(e, "{\r\n}\r\n"), this;
|
|
2586
|
+
}
|
|
2587
|
+
makeProps() {
|
|
2588
|
+
let e = kn, t = this.readDefinable(e);
|
|
2589
|
+
return t.replaceType().replaceDefault().replaceProps(), this.write(e, t.get()), this;
|
|
2590
|
+
}
|
|
2591
|
+
makeTypes() {
|
|
2592
|
+
let e = An, t = this.readDefinable(e);
|
|
2593
|
+
return t.replaceClasses(), this.write(e, t.get()), this;
|
|
2594
|
+
}
|
|
2595
|
+
makeTypesBasic() {
|
|
2596
|
+
return this.makeFileStandard(jn);
|
|
2597
|
+
}
|
|
2598
|
+
makeStyle() {
|
|
2599
|
+
let e = Mn;
|
|
2600
|
+
if (!this.isFile(e)) {
|
|
2601
|
+
let t = this.readDefinable(e);
|
|
2602
|
+
this.write(e, t.get());
|
|
2603
|
+
}
|
|
2604
|
+
return this;
|
|
2605
|
+
}
|
|
2606
|
+
makeCode() {
|
|
2607
|
+
return this.makeFileStandard(Nn);
|
|
2608
|
+
}
|
|
2609
|
+
makeMain() {
|
|
2610
|
+
return this.makeFileStandard(Pn);
|
|
2611
|
+
}
|
|
2612
|
+
makeIndex() {
|
|
2613
|
+
return this.makeFileStandard(Fn);
|
|
2614
|
+
}
|
|
2615
|
+
makeFileStandard(e) {
|
|
2616
|
+
let t = this.readDefinable(e);
|
|
2617
|
+
return t.replaceConstructorClasses(), this.write(t.getNameFile(e), t.get()), this;
|
|
2618
|
+
}
|
|
2619
|
+
makeFilePackage() {
|
|
2620
|
+
let e = this.getName(), t = `./${e}`;
|
|
2621
|
+
return this.updatePackage(`exports|${t}`, {
|
|
2622
|
+
types: `./dist/constructors/${e}/index.d.ts`,
|
|
2623
|
+
default: `./dist/${this.getNameMin()}.js`
|
|
2624
|
+
}), this;
|
|
2625
|
+
}
|
|
2626
|
+
makeLibrary() {
|
|
2627
|
+
let t = E(this.getCommand());
|
|
2628
|
+
return e.writeByPath([...a, `${t}.ts`], `export * from '../${u}/${D(this.getCommand())}/index'
|
|
2629
|
+
`), this;
|
|
2630
|
+
}
|
|
2631
|
+
}, Ln = class {
|
|
2632
|
+
name;
|
|
2633
|
+
constructor(e) {
|
|
2634
|
+
this.name = e;
|
|
2635
|
+
}
|
|
2636
|
+
async make() {
|
|
2637
|
+
if (M.clear(), x(this.name)) await new In(this.name).make();
|
|
2638
|
+
else for (let e of this.getComponents()) console.log(`Constructor update: ${e}`), await new In(e).make();
|
|
2639
|
+
this.makeStyle();
|
|
2640
|
+
}
|
|
2641
|
+
getComponents() {
|
|
2642
|
+
return e.readDir(this.getDir());
|
|
2643
|
+
}
|
|
2644
|
+
getComponentsStyle() {
|
|
2645
|
+
let e = [];
|
|
2646
|
+
return this.getComponents().forEach((t) => {
|
|
2647
|
+
let n = D(t);
|
|
2648
|
+
e.push(`@forward "../constructors/${n}/style";`);
|
|
2649
|
+
}), e;
|
|
2650
|
+
}
|
|
2651
|
+
getDir() {
|
|
2652
|
+
return [
|
|
2653
|
+
e.getRoot(),
|
|
2654
|
+
"src",
|
|
2655
|
+
u
|
|
2656
|
+
];
|
|
2657
|
+
}
|
|
2658
|
+
makeStyle() {
|
|
2659
|
+
let t = [...a, ce], n = this.getComponentsStyle();
|
|
2660
|
+
e.writeByPath(t, n.join("\r\n"));
|
|
2661
|
+
}
|
|
2662
|
+
}, Rn = 2, zn = "image/webp", Q = "flags.webp", Bn = [
|
|
2663
|
+
"src",
|
|
2664
|
+
"assets",
|
|
2665
|
+
Q
|
|
2666
|
+
], Vn = [
|
|
2667
|
+
".",
|
|
2668
|
+
"..",
|
|
2669
|
+
"assets",
|
|
2670
|
+
Q
|
|
2671
|
+
], Hn = [
|
|
2672
|
+
"src",
|
|
2673
|
+
"styles",
|
|
2674
|
+
"flags.css"
|
|
2675
|
+
], Un = ".ui-sys-flags", Wn = class {
|
|
2676
|
+
dir;
|
|
2677
|
+
width;
|
|
2678
|
+
height;
|
|
2679
|
+
columns;
|
|
2680
|
+
list;
|
|
2681
|
+
data = [];
|
|
2682
|
+
x = 0;
|
|
2683
|
+
y = 0;
|
|
2684
|
+
square;
|
|
2685
|
+
top;
|
|
2686
|
+
left;
|
|
2687
|
+
canvas;
|
|
2688
|
+
context;
|
|
2689
|
+
constructor(e = "src/assets/flags", t = 96, n = 72, r = 12) {
|
|
2690
|
+
this.dir = e, this.width = t, this.height = n, this.columns = r, this.list = this.initList(), this.square = this.initSquare(), this.top = this.initTop(), this.left = this.initLeft();
|
|
2691
|
+
}
|
|
2692
|
+
async make() {
|
|
2693
|
+
await this.initGraphics();
|
|
2694
|
+
for (let e of this.list) await this.addImage(e), this.data.push(this.addData(e)), this.next();
|
|
2695
|
+
this.save(), this.saveStyle();
|
|
2696
|
+
}
|
|
2697
|
+
getLines() {
|
|
2698
|
+
return Math.ceil(this.list.length / this.columns);
|
|
2699
|
+
}
|
|
2700
|
+
getCanvasWidth() {
|
|
2701
|
+
return this.columns * this.square;
|
|
2702
|
+
}
|
|
2703
|
+
getCanvasHeight() {
|
|
2704
|
+
return this.getLines() * this.square;
|
|
2705
|
+
}
|
|
2706
|
+
getDx() {
|
|
2707
|
+
return this.x * this.square + this.left;
|
|
2708
|
+
}
|
|
2709
|
+
getDy() {
|
|
2710
|
+
return this.y * this.square + this.top;
|
|
2711
|
+
}
|
|
2712
|
+
getStyle() {
|
|
2713
|
+
let e = this.columns * (this.square / this.width), t = this.getLines() * (this.square / this.height), n = `
|
|
2714
|
+
${Un} {
|
|
2715
|
+
--sys-flags-width: ${this.width}px;
|
|
2716
|
+
--sys-flags-height: ${this.height}px;
|
|
2717
|
+
--sys-flags-top: ${this.top}px;
|
|
2718
|
+
--sys-flags-left: ${this.left}px;
|
|
2719
|
+
--sys-flags-lines: ${this.getLines()};
|
|
2720
|
+
|
|
2721
|
+
background-image: url("${Vn.join("/")}");
|
|
2722
|
+
background-size: calc(100% * ${e}) calc(100% * ${t});
|
|
2723
|
+
}
|
|
2724
|
+
`.trim(), r = 100 / (this.getCanvasWidth() - this.width), i = 100 / (this.getCanvasHeight() - this.height);
|
|
2725
|
+
return this.data.forEach((e) => {
|
|
2726
|
+
n += `
|
|
2727
|
+
${Un}--${e.name} {
|
|
2728
|
+
background-position: ${e.x * r}% ${e.y * i}%;
|
|
2729
|
+
}`;
|
|
2730
|
+
}), n;
|
|
2731
|
+
}
|
|
2732
|
+
async addImage(t) {
|
|
2733
|
+
let n = e.joinPath([this.dir, t]), { loadImage: r } = await import("@napi-rs/canvas"), i = await r(n);
|
|
2734
|
+
this.context.drawImage(i, this.getDx(), this.getDy(), this.width, this.height);
|
|
2735
|
+
}
|
|
2736
|
+
addData(e) {
|
|
2737
|
+
return {
|
|
2738
|
+
name: e.replace(/\.[^.]+$/, ""),
|
|
2739
|
+
x: this.getDx(),
|
|
2740
|
+
y: this.getDy()
|
|
2741
|
+
};
|
|
2742
|
+
}
|
|
2743
|
+
next() {
|
|
2744
|
+
this.x++, this.x >= this.columns && (this.x = 0, this.y++);
|
|
2745
|
+
}
|
|
2746
|
+
save() {
|
|
2747
|
+
let t = this.canvas.toBuffer(zn, 64);
|
|
2748
|
+
t && e.writeByPath(Bn, t, !1);
|
|
2749
|
+
}
|
|
2750
|
+
saveStyle() {
|
|
2751
|
+
e.writeByPath(Hn, this.getStyle());
|
|
2752
|
+
}
|
|
2753
|
+
async initGraphics() {
|
|
2754
|
+
let { createCanvas: e } = await import("@napi-rs/canvas");
|
|
2755
|
+
this.canvas = e(this.getCanvasWidth(), this.getCanvasHeight()), this.context = this.canvas.getContext("2d", { alpha: !0 });
|
|
2756
|
+
}
|
|
2757
|
+
initLeft() {
|
|
2758
|
+
return this.square / 2 - this.width / 2;
|
|
2759
|
+
}
|
|
2760
|
+
initList() {
|
|
2761
|
+
return e.readDir(this.dir).filter((e) => e.endsWith(".svg"));
|
|
2762
|
+
}
|
|
2763
|
+
initSquare() {
|
|
2764
|
+
return this.width >= this.height ? this.width * Rn : this.height * Rn;
|
|
2765
|
+
}
|
|
2766
|
+
initTop() {
|
|
2767
|
+
return this.square / 2 - this.height / 2;
|
|
2768
|
+
}
|
|
2769
|
+
}, Gn = class {
|
|
2770
|
+
program;
|
|
2771
|
+
checker;
|
|
2772
|
+
sourceFile;
|
|
2773
|
+
types;
|
|
2774
|
+
constructor(e = "", t = {}) {
|
|
2775
|
+
this.program = k.createProgram([e], t), this.checker = this.program.getTypeChecker(), this.sourceFile = this.program.getSourceFiles().find((t) => t.fileName.endsWith(e));
|
|
2776
|
+
}
|
|
2777
|
+
getTypes() {
|
|
2778
|
+
if (!this.types && this.sourceFile) {
|
|
2779
|
+
let e = [];
|
|
2780
|
+
return k.forEachChild(this.sourceFile, (t) => {
|
|
2781
|
+
if (k.isTypeAliasDeclaration(t) || k.isInterfaceDeclaration(t)) {
|
|
2782
|
+
let n = this.checker.getTypeAtLocation(t.name), r = [];
|
|
2783
|
+
this.checker.getPropertiesOfType(n).forEach((e) => {
|
|
2784
|
+
r.push(this.getPropInformation(t, e));
|
|
2785
|
+
}), e.push({
|
|
2786
|
+
name: t.name.text,
|
|
2787
|
+
props: r
|
|
2788
|
+
});
|
|
2789
|
+
}
|
|
2790
|
+
}), this.types = e, e;
|
|
2791
|
+
}
|
|
2792
|
+
return [];
|
|
2793
|
+
}
|
|
2794
|
+
getType(e) {
|
|
2795
|
+
return this.getTypes().find((t) => t.name === e);
|
|
2796
|
+
}
|
|
2797
|
+
getPropType(e, t) {
|
|
2798
|
+
let n = this.getPropOption(e);
|
|
2799
|
+
if (e.isUnion() && n && n.length > 0) return e.types.every((e) => e.isNumberLiteral()) ? "number" : "string";
|
|
2800
|
+
let r = this.checker.typeToString(e);
|
|
2801
|
+
if (t && (r === "any" || r === "{}" || r === "unknown")) {
|
|
2802
|
+
let e = t.getDeclarations()?.find((e) => k.isPropertySignature(e) || k.isPropertyDeclaration(e));
|
|
2803
|
+
e?.type && (r = e.type.getText().trim() || r);
|
|
2804
|
+
}
|
|
2805
|
+
return r.replace(/'/g, "\\'");
|
|
2806
|
+
}
|
|
2807
|
+
getPropOption(e) {
|
|
2808
|
+
if (e.isUnion()) {
|
|
2809
|
+
let t = y(e.types, (e) => {
|
|
2810
|
+
if (e.isStringLiteral() || e.isNumberLiteral()) return String(e.value);
|
|
2811
|
+
});
|
|
2812
|
+
if (t.length > 0) return t;
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
getPropOptionByNode(e) {
|
|
2816
|
+
if (k.isUnionTypeNode(e)) {
|
|
2817
|
+
let t = [];
|
|
2818
|
+
for (let n of e.types) k.isLiteralTypeNode(n) && k.isStringLiteral(n.literal) && t.push(n.literal.text);
|
|
2819
|
+
return t;
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
getPropOptionByDeclarations(e) {
|
|
2823
|
+
if (e) {
|
|
2824
|
+
for (let t of e) if ((k.isPropertySignature(t) || k.isPropertyDeclaration(t)) && t.type) {
|
|
2825
|
+
let e = this.getPropOptionByNode(t.type);
|
|
2826
|
+
if (e && e.length > 0) return e;
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
return [];
|
|
2830
|
+
}
|
|
2831
|
+
getPropInformation(e, t) {
|
|
2832
|
+
let n = this.checker.getTypeOfSymbolAtLocation(t, e.name), r = k.displayPartsToString(t.getDocumentationComment(this.checker)).trim(), i = r.length > 0 ? r : void 0;
|
|
2833
|
+
return {
|
|
2834
|
+
name: t.name,
|
|
2835
|
+
type: this.getPropType(n, t),
|
|
2836
|
+
option: this.getPropOption(n) ?? this.getPropOptionByDeclarations(t.getDeclarations()),
|
|
2837
|
+
description: i
|
|
2838
|
+
};
|
|
2839
|
+
}
|
|
2840
|
+
}, Kn = {
|
|
2841
|
+
"DesignComponent.mdx": "import {Canvas, Meta} from '@storybook/addon-docs/blocks'\nimport {\n StorybookDescriptions,\n StorybookMain\n} from '@dxtmisha/wiki/storybook'\n\nimport * as Component from './DesignComponent.stories'\nimport {ComponentWikiStorybook} from './wiki'\n\n[//]: # (:documentation-import [!] System label / Системная метка)\n[//]: # (:documentation-import [!] System label / Системная метка)\n\n<Meta of={Component}/>\n<StorybookMain\n name={ComponentWikiStorybook.getName()}\n description={ComponentWikiStorybook.getDescription()}\n story={Component.Component}\n/>\n\n[//]: # (:documentation-body [!] System label / Системная метка)\n[//]: # (:documentation-body [!] System label / Системная метка)\n\n[//]: # (:documentation-events [!] System label / Системная метка)\n[//]: # (:documentation-events [!] System label / Системная метка)\n\n[//]: # (:documentation-expose [!] System label / Системная метка)\n[//]: # (:documentation-expose [!] System label / Системная метка)\n\n[//]: # (:documentation-slots [!] System label / Системная метка)\n[//]: # (:documentation-slots [!] System label / Системная метка)\n",
|
|
2842
|
+
"DesignComponent.stories.ts": "import type { Meta, StoryObj } from '@storybook/vue3-vite'\n\nimport DesignComponent from './DesignComponent.vue'\n// :component.once import { ComponentWikiStorybook } from './wiki'\n\n// :story-import [!] System label / Системная метка\n// :story-import [!] System label / Системная метка\n\nconst meta = {\n// :component.once title: '[project]/Component',\n// :component.once component: DesignComponent,\n// :component.once parameters: {\n// :component.once design: '[design]',\n// :component.once docs: {\n// :component.once description: {\n// :component.once component: ComponentWikiStorybook.getDescription()\n// :component.once }\n// :component.once }\n// :component.once },\n// :component.once argTypes: ComponentWikiStorybook.getWiki(),\n// :component.once args: ComponentWikiStorybook.getValues()\n} satisfies Meta<typeof DesignComponent>\n\nexport default meta\n\ntype Story = StoryObj<typeof meta>\n\nexport const Component: Story = {\n // :story-main [!] System label / Системная метка\n // :story-main [!] System label / Системная метка\n}\n\n// :story-items [!] System label / Системная метка\n// :story-items [!] System label / Системная метка\n",
|
|
2843
|
+
"DesignComponent.vue": "<script setup lang=\"ts\">\n// :component.once import { computed } from 'vue'\n// :component.once import {\n// :component.once inArray,\n// :component.once isFilled,\n// :component.once type ConstrClasses,\n// :component.once type ConstrStyles\n// :component.once } from '@dxtmisha/functional'\n// :component.once import {\n// :component.once ComponentDesign,\n// :component.once type ComponentEmits,\n// :component.once type ComponentSlots\n// :component.once } from '@dxtmisha/constructor/Component'\n\n// :component.once import { defaults, type ComponentProps, propsValues } from './props'\n// :component.once import './styleToken.scss'\n\n// :component.once defineOptions({\n// :component.once name: 'DesignComponent'\n// :component.once })\n\n// :component.once const emits = defineEmits<ComponentEmits>()\n// :component.once const props = withDefaults(defineProps<ComponentProps>(), defaults)\n\n// :component.once const classesToken = computed<ConstrClasses>(() => ({\n// :component.once main: {\n// :component.once // :classes-values [!] System label / Системная метка\n// :component.once // :classes-values [!] System label / Системная метка\n// :component.once }\n// :component.once }))\n// :component.once const stylesToken = computed<ConstrStyles>(() => ({\n// :component.once // :styles-values [!] System label / Системная метка\n// :component.once // :styles-values [!] System label / Системная метка\n// :component.once }))\n\n// :component.once const design = new ComponentDesign(\n// :component.once '[design].[component]',\n// :component.once props,\n// :component.once {\n// :component.once emits,\n// :component.once classes: classesToken,\n// :component.once styles: stylesToken\n// :component.once }\n// :component.once )\n\n// :component.once const render = design.render()\n\n// :component.once defineSlots<ComponentSlots>()\n// :component.once defineExpose(design.expose())\n<\/script>\n\n<!-- :component.once <template> -->\n<!-- :component.once <render/> -->\n<!-- :component.once </template> -->\n",
|
|
2844
|
+
"DesignComponentAiWiki.vue": "<script setup lang=\"ts\">\n// :component.once import { DxtTestWiki } from '@dxtmisha/test'\n// :component.once import { DesignComponent } from './index'\n// :component.once import { ComponentWikiStorybook } from './wiki'\n\n// :component-import [!] System label / Системная метка\n// :component-import [!] System label / Системная метка\n\ndefineOptions({\n name: 'DesignComponentAiWiki'\n})\n<\/script>\n\n<!-- :component.once <template> -->\n<!-- :component.once <DxtTestWiki -->\n<!-- :component.once design=\"Design\" -->\n<!-- :component.once :wiki=\"ComponentWikiStorybook\" -->\n<!-- :component.once :component=\"DesignComponent\" -->\n<!-- :component.once > -->\n <!-- :component-render [!] System label / Системная метка -->\n <!-- :component-render [!] System label / Системная метка -->\n<!-- :component.once </DxtTestWiki> -->\n<!-- :component.once </template> -->\n\n<style lang=\"scss\"></style>\n",
|
|
2845
|
+
"index.ts": "// :component.once import type { DefineSetupFnComponent, ShortEmitsToObject, SlotsType } from 'vue'\n// :component.once import type { ComponentEmits, ComponentSlots } from '@dxtmisha/constructor/Component'\n\n// :component.once import item from './DesignComponent.vue'\n\n// :component.once import type { ComponentProps } from './props'\n// :component.once export type { ComponentProps } from './props'\n\n// :component.once export const DesignComponent: DefineSetupFnComponent<\n// :component.once ComponentProps,\n// :component.once ShortEmitsToObject<ComponentEmits>,\n// :component.once SlotsType<ComponentSlots>\n// :component.once > = item\n",
|
|
2846
|
+
"props.ts": "// :component.once import { type ComponentPropsBasic, defaultsComponent } from '@dxtmisha/constructor/Component'\n\nexport const propsValues = {\n // :values [!] System label / Системная метка\n // :values [!] System label / Системная метка\n}\n\ntype PropsToken = {\n // :type [!] System label / Системная метка\n // :type [!] System label / Системная метка\n}\n\n/**\n * Type describing incoming properties/ Тип, описывающий входящие свойства\n */\nexport type ComponentProps = /* :component.once ComponentPropsBasic & */ PropsToken\n\n/**\n * Default value for property/ Значение по умолчанию для свойства\n */\nexport const defaults: object = {\n /* :component.once ...defaultsComponent, */\n ...{\n // :default [!] System label / Системная метка\n // :default [!] System label / Системная метка\n }\n}\n",
|
|
2847
|
+
"styleToken.scss": "// :component.once @use \"../../../styles/[project]/properties\";\n@use \"@dxtmisha/styles/properties\" as ui;\n// :component.once @use \"@dxtmisha/constructor/style.scss\" as Component;\n\n@include ui.initDesignBasic('[design].[component]') {\n // Basic styles for a component\n // Базовый стили для компонента\n // :component.once @include Component.mixinComponent;\n\n // Styles from tokens\n // Стили из токенов\n // :style [!] System label / Системная метка\n // :style [!] System label / Системная метка\n\n // Here are the user styles\n // Здесь пользовательские стили\n}\n",
|
|
2848
|
+
"wiki.ts": "// :component.once import { WikiStorybook } from '@dxtmisha/wiki'\n// :component.once import { wiki, wikiDescriptions } from '@dxtmisha/wiki/media'\n\n// :component.once import { ComponentWikiData } from './wikiData'\n\n// :component.once export const ComponentWikiStorybook = new WikiStorybook(\n// :component.once ComponentWikiData.component,\n// :component.once ComponentWikiData.props,\n// :component.once ComponentWikiData.defaults,\n// :component.once ComponentWikiData.wikiDesign,\n// :component.once wiki,\n// :component.once wikiDescriptions\n// :component.once )\n",
|
|
2849
|
+
"wikiData.ts": "// :component.once import { type StorybookProps, type StorybookSlots, type WikiDataItem } from '@dxtmisha/wiki'\n\n// :component.once import { wiki[Design] } from '../../../wiki/wiki'\n// :component.once import { defaults } from './props'\n\n// :component.once const propsNames: StorybookProps = [\n// :component.once // :propsList [!] System label / Системная метка\n// :component.once // :propsList [!] System label / Системная метка\n// :component.once ]\n\n// :component.once const slotsNames: StorybookSlots = [\n// :component.once // :slotsList [!] System label / Системная метка\n// :component.once // :slotsList [!] System label / Системная метка\n// :component.once ]\n\n// :component.once const eventsNames: StorybookSlots = [\n// :component.once // :eventsList [!] System label / Системная метка\n// :component.once // :eventsList [!] System label / Системная метка\n// :component.once ]\n\n// :component.once export const ComponentWikiData: WikiDataItem = {\n// :component.once component: 'Component',\n// :component.once props: propsNames,\n// :component.once slots: slotsNames,\n// :component.once events: eventsNames,\n// :component.once defaults,\n// :component.once wikiDesign: wiki[Design]\n// :component.once }\n"
|
|
2850
|
+
}, qn = "properties.json", Jn = "props.ts", Yn = "styleToken.scss", Xn = "DesignComponent.vue", Zn = "DesignComponentAiWiki.vue", Qn = "index.ts", $n = "index.d.ts", er = "wiki.ts", tr = "wikiData.ts", nr = "DesignComponent.stories.ts", rr = "DesignComponent.mdx", ir = class extends En {
|
|
2851
|
+
sample = Kn;
|
|
2852
|
+
mark = "component";
|
|
2853
|
+
dir;
|
|
2854
|
+
propsType;
|
|
2855
|
+
slotsType;
|
|
2856
|
+
eventsType;
|
|
2857
|
+
constructor(r, i = {}) {
|
|
2858
|
+
super(r, i);
|
|
2859
|
+
let a = this.getStructure();
|
|
2860
|
+
this.dir = [
|
|
2861
|
+
e.getRoot(),
|
|
2862
|
+
...n,
|
|
2863
|
+
t.getProjectName(),
|
|
2864
|
+
a.getComponentNameFirst()
|
|
2865
|
+
];
|
|
2866
|
+
}
|
|
2867
|
+
async initMain() {
|
|
2868
|
+
this.makeProperties().makeProps().makeStyle().makeMain().makeIndex().makeWiki().makeWikiData().makeFilePackage().makeLibrary(), await this.makeMainAi(), await this.makeStories(), await this.makeStoriesDocumentation();
|
|
2869
|
+
}
|
|
2870
|
+
makeProperties() {
|
|
2871
|
+
let e = qn;
|
|
2872
|
+
return this.isFile(e) || this.write(e, `{\r\n "main": "{d.${this.getStructure().getComponentName()}}"\r\n}\r\n`), this;
|
|
2873
|
+
}
|
|
2874
|
+
makeProps() {
|
|
2875
|
+
let e = Jn, t = this.readDefinable(e), n = this.getFileConstructor(e);
|
|
2876
|
+
return t.replaceType(n).replaceDefault().replaceProps().replacePropsValues(), this.write(e, t.get()), this;
|
|
2877
|
+
}
|
|
2878
|
+
makeStyle() {
|
|
2879
|
+
let e = Yn, t = this.readDefinable(e), n = this.getStructure().getStyles();
|
|
2880
|
+
return t.replaceMark("style", n), this.write(e, t.get()), this;
|
|
2881
|
+
}
|
|
2882
|
+
makeMain() {
|
|
2883
|
+
let e = Xn, t = this.readDefinable(e);
|
|
2884
|
+
return t.replaceClassesValues(), t.replaceStylesValues(), this.write(t.getNameFile(e), t.get()), this;
|
|
2885
|
+
}
|
|
2886
|
+
async makeMainAi() {
|
|
2887
|
+
let e = Zn, t = this.readDefinable(e), n = this.getStructure().getDesignFirst(), r = this.getStructure().getComponentNameFirst(), i = this.getStructure().getFullComponentName(), a = await this.getWikiDescription();
|
|
2888
|
+
if (a?.ai) {
|
|
2889
|
+
let e = [];
|
|
2890
|
+
if (a.ai.render) {
|
|
2891
|
+
let n = ye(a.ai.render, r, i);
|
|
2892
|
+
a.ai.render.includes("<button") && (e.push("import { DxtTestButton } from '@dxtmisha/test'"), n = ye(n, "button", "DxtTestButton")), n && t.replaceMark("component-render", [
|
|
2893
|
+
"<template #render=\"{ args, classDemo }\">",
|
|
2894
|
+
n,
|
|
2895
|
+
"</template>"
|
|
2896
|
+
]);
|
|
2897
|
+
}
|
|
2898
|
+
a.ai.import && e.push(...a.ai.import), e.length > 0 && t.replaceMark("component-import", e);
|
|
2899
|
+
}
|
|
2900
|
+
return this.write(t.getNameFile(e), t.get().replace("design=\"Design\"", `design="${n}"`)), this;
|
|
2901
|
+
}
|
|
2902
|
+
makeIndex() {
|
|
2903
|
+
let e = Qn, t = this.readDefinable(e);
|
|
2904
|
+
return this.write(e, t.get()), this;
|
|
2905
|
+
}
|
|
2906
|
+
makeWiki() {
|
|
2907
|
+
let e = er, t = this.readDefinable(e);
|
|
2908
|
+
return this.write(e, t.get()), this;
|
|
2909
|
+
}
|
|
2910
|
+
makeWikiData() {
|
|
2911
|
+
let e = tr, t = this.getPropsList(), n = this.getSlotsList(), r = this.getEventsList(), i = this.readDefinable(e);
|
|
2912
|
+
if (t) {
|
|
2913
|
+
let e = [];
|
|
2914
|
+
t.sort((e, t) => e.name.localeCompare(t.name)).forEach((t) => {
|
|
2915
|
+
let n = t.option, r = "";
|
|
2916
|
+
r += `{ name: '${t.name}', type: '${t.type.replace("| undefined", "").trim()}'`, n && n.length > 0 && (r += `, option: [${n.map((e) => `'${e}'`).join(", ")}]`), r += " }", e.push(r);
|
|
2917
|
+
}), i.replaceMark("propsList", e, ",");
|
|
2918
|
+
}
|
|
2919
|
+
if (n) {
|
|
2920
|
+
let e = [];
|
|
2921
|
+
n.sort((e, t) => e.name.localeCompare(t.name)).forEach((t) => {
|
|
2922
|
+
let n = t.description, r = t.type.replace(/\(props: ([^)]+)\) => any/i, "$1").trim(), i = "";
|
|
2923
|
+
i += `{ name: '${t.name}'`, n && (i += `, description: \`${n}\``), r && r !== "any" && (i += `, properties: [{ name: 'props', type: '${r}' }]`), i += " }", e.push(i);
|
|
2924
|
+
}), i.replaceMark("slotsList", e, ",");
|
|
2925
|
+
}
|
|
2926
|
+
if (r) {
|
|
2927
|
+
let e = [];
|
|
2928
|
+
r.sort((e, t) => e.name.localeCompare(t.name)).forEach((t) => {
|
|
2929
|
+
let n = t.description, r = t.type, i = "";
|
|
2930
|
+
i += `{ name: '${t.name}'`, n && (i += `, description: \`${n}\``), r && r !== "[]" && (i += `, properties: ${r}`), i += " }", e.push(i);
|
|
2931
|
+
}), i.replaceMark("eventsList", e, ",");
|
|
2932
|
+
}
|
|
2933
|
+
return this.write(e, i.get()), this;
|
|
2934
|
+
}
|
|
2935
|
+
async makeStories() {
|
|
2936
|
+
let e = nr, t = this.readDefinable(e), n = await this.getWikiDescription();
|
|
2937
|
+
return n && this.replaceMarkStoriesRender(t, n).replaceMarkStoriesStories(t, n).replaceMarkStoriesImport(t, n), this.write(t.getNameFile(e), t.get()), this;
|
|
2938
|
+
}
|
|
2939
|
+
async makeStoriesDocumentation() {
|
|
2940
|
+
let e = rr, t = this.readDefinable(e), n = (await this.getWikiDescription())?.documentation;
|
|
2941
|
+
return n && this.replaceMarkDocumentation(t, "import", n.import).replaceMarkDocumentation(t, "body", n.body).replaceMarkDocumentation(t, "events", n.events, "Events").replaceMarkDocumentation(t, "expose", n.expose, "Expose").replaceMarkDocumentation(t, "slots", n.slots, "Slots"), this.write(t.getNameFile(e), t.get()), this;
|
|
2942
|
+
}
|
|
2943
|
+
getFileConstructor(e) {
|
|
2944
|
+
let t = [
|
|
2945
|
+
"..",
|
|
2946
|
+
"..",
|
|
2947
|
+
u,
|
|
2948
|
+
this.getStructure().getComponentNameFirst(),
|
|
2949
|
+
e
|
|
2950
|
+
];
|
|
2951
|
+
return this.read(t) ?? "";
|
|
2952
|
+
}
|
|
2953
|
+
getTypescriptPaths() {
|
|
2954
|
+
let t = e.getRootProject(), n = this.getStructure().getComponentNameFirst();
|
|
2955
|
+
if (t) return [
|
|
2956
|
+
t,
|
|
2957
|
+
m,
|
|
2958
|
+
d,
|
|
2959
|
+
u,
|
|
2960
|
+
n
|
|
2961
|
+
];
|
|
2962
|
+
}
|
|
2963
|
+
getTypescriptPathsIndex() {
|
|
2964
|
+
let t = this.getTypescriptPaths();
|
|
2965
|
+
if (t) return e.joinPath([...t, $n]);
|
|
2966
|
+
}
|
|
2967
|
+
getTypescriptPathsType() {
|
|
2968
|
+
let t = this.getTypescriptPaths();
|
|
2969
|
+
if (t) return e.joinPath([...t, "types.d.ts"]);
|
|
2970
|
+
}
|
|
2971
|
+
getPropsList() {
|
|
2972
|
+
if (!this.propsType) {
|
|
2973
|
+
let n = this.getTypescriptPathsIndex(), r = this.getStructure().getComponentNameFirst();
|
|
2974
|
+
if (n) {
|
|
2975
|
+
let i = new Gn(e.joinPath([
|
|
2976
|
+
e.getRoot(),
|
|
2977
|
+
"src",
|
|
2978
|
+
l,
|
|
2979
|
+
t.getProjectName(),
|
|
2980
|
+
r,
|
|
2981
|
+
Jn
|
|
2982
|
+
]), { paths: { [`${ue}/${r}`]: [n] } });
|
|
2983
|
+
this.propsType = i.getType(`${r}Props`)?.props;
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
return this.propsType;
|
|
2987
|
+
}
|
|
2988
|
+
getSlotsList() {
|
|
2989
|
+
if (!this.slotsType) {
|
|
2990
|
+
let e = this.getTypesFromConstructor("Slots");
|
|
2991
|
+
e && (this.slotsType = e);
|
|
2992
|
+
}
|
|
2993
|
+
return this.slotsType;
|
|
2994
|
+
}
|
|
2995
|
+
getEventsList() {
|
|
2996
|
+
if (!this.eventsType) {
|
|
2997
|
+
let e = this.getTypesFromConstructor("Emits");
|
|
2998
|
+
e && (this.eventsType = y(e, (e) => ({
|
|
2999
|
+
name: e.name,
|
|
3000
|
+
type: String(e.type).replace(/([^:,[\] ]+): ([^:,[\]]+)/gi, "{ name: '$1', type: '$2' }").replace(/,{/gi, ", {"),
|
|
3001
|
+
description: e.description
|
|
3002
|
+
})));
|
|
3003
|
+
}
|
|
3004
|
+
return this.eventsType;
|
|
3005
|
+
}
|
|
3006
|
+
async getWikiDescription() {
|
|
3007
|
+
let e = this.getStructure().getComponentNameFirst();
|
|
3008
|
+
try {
|
|
3009
|
+
let { wikiDescriptions: t } = await import("@dxtmisha/wiki/media");
|
|
3010
|
+
return t.find((t) => t.name === e);
|
|
3011
|
+
} catch {
|
|
3012
|
+
return;
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
getStoriesComponentsImport(e) {
|
|
3016
|
+
if (e.stories) {
|
|
3017
|
+
let t = [];
|
|
3018
|
+
return e.stories.forEach((e) => {
|
|
3019
|
+
e.components && e.components.forEach((e) => {
|
|
3020
|
+
t.push(e);
|
|
3021
|
+
});
|
|
3022
|
+
}), t;
|
|
3023
|
+
}
|
|
3024
|
+
return [];
|
|
3025
|
+
}
|
|
3026
|
+
getTypesFromConstructor(e) {
|
|
3027
|
+
let t = this.getTypescriptPathsType(), n = this.getStructure().getComponentNameFirst();
|
|
3028
|
+
if (t) return new Gn(t).getType(`${n}${e}`)?.props;
|
|
3029
|
+
}
|
|
3030
|
+
toComponentName(e) {
|
|
3031
|
+
let t = this.getStructure().getDesignFirst(), n = this.getStructure().getComponentName(), r = this.getStructure().getFullComponentName();
|
|
3032
|
+
return e.replace(/DesignComponent/g, r).trim().replace(/design-component/g, `${E(t)}-${E(n)}`).trim().replace(/<(\/?)Design/g, `<$1${t}`);
|
|
3033
|
+
}
|
|
3034
|
+
replaceMarkStoriesRender(e, t) {
|
|
3035
|
+
if (t.render) {
|
|
3036
|
+
let n = this.getStructure().getFullComponentName();
|
|
3037
|
+
e.replaceMark("story-main", [
|
|
3038
|
+
"render: (args: any) => ({",
|
|
3039
|
+
` components: { ${n} },`,
|
|
3040
|
+
" setup: () => ({ args }),",
|
|
3041
|
+
" template: `",
|
|
3042
|
+
` ${this.toComponentName(t.render.trim())}`,
|
|
3043
|
+
" `",
|
|
3044
|
+
"})"
|
|
3045
|
+
]);
|
|
3046
|
+
}
|
|
3047
|
+
return this;
|
|
3048
|
+
}
|
|
3049
|
+
replaceMarkStoriesImport(e, t) {
|
|
3050
|
+
let n = this.getStructure().getDesignFirst(), r = [];
|
|
3051
|
+
return this.getStoriesComponentsImport(t).forEach((e) => {
|
|
3052
|
+
let t = `${n}${e}`;
|
|
3053
|
+
r.push(`import ${t} from '../${e}/${t}.vue'`);
|
|
3054
|
+
}), t.import && r.push(...t.import), e.replaceMark("story-import", r), this;
|
|
3055
|
+
}
|
|
3056
|
+
replaceMarkStoriesStories(e, n) {
|
|
3057
|
+
if (n.stories) {
|
|
3058
|
+
let r = t.getWikiLanguage(), i = this.getStructure().getDesignFirst(), a = this.getStructure().getFullComponentName(), o = [], s = this.getPropsList();
|
|
3059
|
+
n.stories.forEach((e) => {
|
|
3060
|
+
if (s && e.propsName && !T(e.propsName).every((e) => s.some((t) => t.name === e))) return;
|
|
3061
|
+
let t = e.components && y(e.components, (e) => `${i}${e}`), n = this.toComponentName(e.template);
|
|
3062
|
+
o.push(`export const ${e.id}: Story = {`), S(e.name) && e.name?.[r] && o.push(` name: '${e.name?.[r]}',`), o.push(" render: () => ({"), o.push(` components: { ${a}${t ? `, ${t.join(", ")}` : ""} },`), e.setup && (o.push(" setup() {"), o.push(` ${e.setup.trim()}`), o.push(" },")), o.push(" template: `"), o.push(` ${n}`), o.push(" `"), o.push(" })"), o.push("}");
|
|
3063
|
+
}), e.replaceMark("story-items", o);
|
|
3064
|
+
}
|
|
3065
|
+
return this;
|
|
3066
|
+
}
|
|
3067
|
+
replaceMarkDocumentation(e, t, n, r) {
|
|
3068
|
+
if (n) {
|
|
3069
|
+
let i = this.getStructure().getComponentNameFirst(), a = this.getStructure().getFullComponentName(), o = [], s = this.getPropsList();
|
|
3070
|
+
r && o.push(`## ${r}`), o.push(n.replace(/<template prop="([^"]+)">([\S\s]*?)<\/template>/gi, (e, t, n) => s?.some((e) => e.name === t) ? n.trim() : "").replace(/* @__PURE__ */ RegExp("DesignComponent", "g"), a).replace(/* @__PURE__ */ RegExp("Component", "g"), i)), e.replaceMark(`documentation-${t}`, o);
|
|
3071
|
+
}
|
|
3072
|
+
return this;
|
|
3073
|
+
}
|
|
3074
|
+
makeFilePackage() {
|
|
3075
|
+
let e = `./${this.getFullName()}`;
|
|
3076
|
+
return this.updatePackage(`exports|${e}`, {
|
|
3077
|
+
types: `./dist/library/${this.getFullName()}.d.ts`,
|
|
3078
|
+
default: `./dist/library/${this.getFullName()}.js`
|
|
3079
|
+
}), this;
|
|
3080
|
+
}
|
|
3081
|
+
makeLibrary() {
|
|
3082
|
+
let t = `../${l}/${this.getProjectName()}/${this.getName()}/`, n = this.getFullName();
|
|
3083
|
+
return e.writeByPath([...a, `${n}.ts`], `// This file is generated by a script, do not edit.
|
|
3084
|
+
// Этот файл генерируется скриптом, не редактировать.
|
|
3085
|
+
|
|
3086
|
+
export * from '${t}index.js'
|
|
3087
|
+
`), this;
|
|
3088
|
+
}
|
|
3089
|
+
}, ar = class {
|
|
3090
|
+
items;
|
|
3091
|
+
constructor() {
|
|
3092
|
+
this.items = this.initItems();
|
|
3093
|
+
}
|
|
3094
|
+
get() {
|
|
3095
|
+
return this.items;
|
|
3096
|
+
}
|
|
3097
|
+
getComponentList() {
|
|
3098
|
+
let e = [];
|
|
3099
|
+
return this.items.forEach((t) => e.push(...t.components)), e;
|
|
3100
|
+
}
|
|
3101
|
+
getCount() {
|
|
3102
|
+
return this.getComponentList().length;
|
|
3103
|
+
}
|
|
3104
|
+
getComponentsPath() {
|
|
3105
|
+
return [...n, t.getProjectName()];
|
|
3106
|
+
}
|
|
3107
|
+
write(t, n, r = "ts") {
|
|
3108
|
+
let i = r === "json" ? n : [
|
|
3109
|
+
"// This file is generated by a script, do not edit.",
|
|
3110
|
+
"// Этот файл генерируется скриптом, не редактировать.",
|
|
3111
|
+
"",
|
|
3112
|
+
...n,
|
|
3113
|
+
""
|
|
3114
|
+
];
|
|
3115
|
+
e.write(a, t, i.join("\r\n"), r);
|
|
3116
|
+
}
|
|
3117
|
+
getComponents() {
|
|
3118
|
+
let n = [], r = e.readDir(this.getComponentsPath()), i = t.getDesignName();
|
|
3119
|
+
return r.forEach((t) => {
|
|
3120
|
+
if (e.isDir(t)) {
|
|
3121
|
+
let e = O(t).trim();
|
|
3122
|
+
n.push({
|
|
3123
|
+
name: e,
|
|
3124
|
+
design: i,
|
|
3125
|
+
alias: `${i}.${e}`,
|
|
3126
|
+
codeFull: D(`${i}-${e}`),
|
|
3127
|
+
dir: t
|
|
3128
|
+
});
|
|
3129
|
+
}
|
|
3130
|
+
}), n;
|
|
3131
|
+
}
|
|
3132
|
+
initItems() {
|
|
3133
|
+
return [{
|
|
3134
|
+
name: t.getDesignName(),
|
|
3135
|
+
components: this.getComponents()
|
|
3136
|
+
}];
|
|
3137
|
+
}
|
|
3138
|
+
}, or = class {
|
|
3139
|
+
items;
|
|
3140
|
+
constructor(e) {
|
|
3141
|
+
this.items = e;
|
|
3142
|
+
}
|
|
3143
|
+
init() {
|
|
3144
|
+
let e = X.addSpace(1), t = [":root {"];
|
|
3145
|
+
return this.getList().forEach((n) => t.push(...new dn(n, e).make())), t.push("}"), [
|
|
3146
|
+
X.addImportProperties(),
|
|
3147
|
+
"",
|
|
3148
|
+
this.initCalc(t.join("\r\n"))
|
|
3149
|
+
];
|
|
3150
|
+
}
|
|
3151
|
+
getList() {
|
|
3152
|
+
return this.items.findCategory(v.root);
|
|
3153
|
+
}
|
|
3154
|
+
getValue(e) {
|
|
3155
|
+
if (e.match(/calc\(/) && !e.match(/var\(/)) {
|
|
3156
|
+
let t = Ce.compileString(`a{height: ${e};}`).css?.match(/height: ([^;]+);/)?.[1];
|
|
3157
|
+
if (t) return t;
|
|
3158
|
+
}
|
|
3159
|
+
return e;
|
|
3160
|
+
}
|
|
3161
|
+
initCalc(e) {
|
|
3162
|
+
let t = !1, n = e.replace(/(?<=calc\(.*?)var\(([^)]+)\)/gim, (n, r) => {
|
|
3163
|
+
let i = e.match(RegExp(`(?<=${r}:)[^;\r\n]+`, "im"))?.[0].trim();
|
|
3164
|
+
return i ? (t = !0, this.getValue(i)) : r;
|
|
3165
|
+
});
|
|
3166
|
+
return t ? this.initCalc(n) : n.replace(/calc\([^;\r\n]+/gi, (e) => this.getValue(e));
|
|
3167
|
+
}
|
|
3168
|
+
}, sr = class {
|
|
3169
|
+
items;
|
|
3170
|
+
constructor(e) {
|
|
3171
|
+
this.items = e;
|
|
3172
|
+
}
|
|
3173
|
+
init() {
|
|
3174
|
+
let e = [], t = {}, n = X.addSpace(1);
|
|
3175
|
+
return this.getList().forEach((r) => {
|
|
3176
|
+
let { value: i, item: a } = r;
|
|
3177
|
+
if (x(i) && S(i)) {
|
|
3178
|
+
let i = a[g.name];
|
|
3179
|
+
e.push(X.addUse(`./classes/${O(i)}`)), t[i] = [
|
|
3180
|
+
X.addImportProperties(),
|
|
3181
|
+
"",
|
|
3182
|
+
`.${i} {`,
|
|
3183
|
+
...new Sn(n, r).make(),
|
|
3184
|
+
"}"
|
|
3185
|
+
];
|
|
3186
|
+
}
|
|
3187
|
+
}), {
|
|
3188
|
+
data: e,
|
|
3189
|
+
classes: t
|
|
3190
|
+
};
|
|
3191
|
+
}
|
|
3192
|
+
getList() {
|
|
3193
|
+
return this.items.findCategory([v.class, v.theme]);
|
|
3194
|
+
}
|
|
3195
|
+
}, cr = "vars", lr = "classes", $ = "properties", ur = "list", dr = "basic", fr = "style", pr = "main", mr = "classes", hr = class {
|
|
3196
|
+
properties;
|
|
3197
|
+
constructor() {
|
|
3198
|
+
this.properties = new on();
|
|
3199
|
+
}
|
|
3200
|
+
make() {
|
|
3201
|
+
return this.getByDesigns((e, t) => {
|
|
3202
|
+
this.initRoot(t), this.initClasses(t), this.initProperties(t), this.initList(t), this.initBasic(e);
|
|
3203
|
+
}), this;
|
|
3204
|
+
}
|
|
3205
|
+
initRoot(t) {
|
|
3206
|
+
let n = X.join(new or(t).init());
|
|
3207
|
+
return e.write(X.getDir(), cr, n, p), this;
|
|
3208
|
+
}
|
|
3209
|
+
initClasses(t) {
|
|
3210
|
+
let { data: n, classes: r } = new sr(t).init();
|
|
3211
|
+
return y(r, (t, n) => {
|
|
3212
|
+
e.write([...X.getDir(), mr], n, X.join(t), p);
|
|
3213
|
+
}), e.write(X.getDir(), lr, X.join(n), p), this;
|
|
3214
|
+
}
|
|
3215
|
+
initProperties(t) {
|
|
3216
|
+
let n = new rn(t);
|
|
3217
|
+
return e.write(X.getDir(), $, n.get(), p), this;
|
|
3218
|
+
}
|
|
3219
|
+
initList(t) {
|
|
3220
|
+
return e.write(X.getDir(), ur, this.removeExcess(t.get())), this;
|
|
3221
|
+
}
|
|
3222
|
+
initBasic(t) {
|
|
3223
|
+
let n = X.getDir();
|
|
3224
|
+
return e.write(n, dr, [
|
|
3225
|
+
`@use "./${cr}";`,
|
|
3226
|
+
`@use "./${$}";`,
|
|
3227
|
+
`@use "./${lr}";`
|
|
3228
|
+
].join("\r\n"), p), e.write(n, fr, [
|
|
3229
|
+
"@use \"@dxtmisha/styles\" as variables;",
|
|
3230
|
+
`@use "./${$}";`,
|
|
3231
|
+
"",
|
|
3232
|
+
`@forward "@dxtmisha/styles/${$}";`,
|
|
3233
|
+
"",
|
|
3234
|
+
`@include variables.setDesignsDesign('${t}');`,
|
|
3235
|
+
""
|
|
3236
|
+
].join("\r\n"), p), e.is([...n, `${pr}.scss`]) || e.write(n, pr, [
|
|
3237
|
+
`@use "./${dr}";`,
|
|
3238
|
+
`@use "@dxtmisha/styles/${$}" as ui;`,
|
|
3239
|
+
"@use \"@dxtmisha/media/style.css\";",
|
|
3240
|
+
"",
|
|
3241
|
+
"@include ui.initGlobal;",
|
|
3242
|
+
`@include ui.initDesignBody('${t}.main');`
|
|
3243
|
+
].join("\r\n"), p), this;
|
|
3244
|
+
}
|
|
3245
|
+
getByDesigns(e) {
|
|
3246
|
+
let t = this.properties.get().get();
|
|
3247
|
+
this.properties.get().getDesigns().forEach((n) => {
|
|
3248
|
+
n !== "d" && e(n, new P(t).setFocusDesign(n));
|
|
3249
|
+
});
|
|
3250
|
+
}
|
|
3251
|
+
removeExcess(e) {
|
|
3252
|
+
let t = {};
|
|
3253
|
+
return y(e, (e, n) => {
|
|
3254
|
+
if (e[g.variable] === _.var || S(e.value)) {
|
|
3255
|
+
let r = S(e.value) ? this.removeExcess(e.value) : e.value;
|
|
3256
|
+
x(r) && (t[n] = {
|
|
3257
|
+
name: e[g.name],
|
|
3258
|
+
type: e[g.variable],
|
|
3259
|
+
value: r
|
|
3260
|
+
});
|
|
3261
|
+
}
|
|
3262
|
+
}), t;
|
|
3263
|
+
}
|
|
3264
|
+
}, gr = class {
|
|
3265
|
+
make() {
|
|
3266
|
+
this.initWikiFile();
|
|
3267
|
+
}
|
|
3268
|
+
initWikiFile() {
|
|
3269
|
+
if (!e.is([...c, "wiki.ts"])) {
|
|
3270
|
+
let n = t.getDesignName();
|
|
3271
|
+
e.write(c, ie, [
|
|
3272
|
+
"import type { StorybookArgsToList } from '@dxtmisha/wiki'",
|
|
3273
|
+
"",
|
|
3274
|
+
`export const wiki${D(n)}: StorybookArgsToList = {}`,
|
|
3275
|
+
""
|
|
3276
|
+
].join("\r\n"), "ts");
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
}, _r = class {
|
|
3280
|
+
item;
|
|
3281
|
+
constructor(e) {
|
|
3282
|
+
this.item = e;
|
|
3283
|
+
}
|
|
3284
|
+
isAiWiki() {
|
|
3285
|
+
return e.is(this.getPath());
|
|
3286
|
+
}
|
|
3287
|
+
getCode() {
|
|
3288
|
+
return this.item.codeFull;
|
|
3289
|
+
}
|
|
3290
|
+
getComponentFileNameAiWiki() {
|
|
3291
|
+
return `${this.item.codeFull}AiWiki.vue`;
|
|
3292
|
+
}
|
|
3293
|
+
getImport() {
|
|
3294
|
+
return `import ${this.item.codeFull} from '${[
|
|
3295
|
+
"..",
|
|
3296
|
+
"..",
|
|
3297
|
+
...this.getPath()
|
|
3298
|
+
].join("/")}'`;
|
|
3299
|
+
}
|
|
3300
|
+
getPath() {
|
|
3301
|
+
return [
|
|
3302
|
+
...n,
|
|
3303
|
+
t.getProjectName(),
|
|
3304
|
+
this.item.dir,
|
|
3305
|
+
this.getComponentFileNameAiWiki()
|
|
3306
|
+
];
|
|
3307
|
+
}
|
|
3308
|
+
}, vr = class {
|
|
3309
|
+
items;
|
|
3310
|
+
constructor(e) {
|
|
3311
|
+
this.items = e;
|
|
3312
|
+
}
|
|
3313
|
+
make() {
|
|
3314
|
+
this.makeList(), this.makeComponent();
|
|
3315
|
+
}
|
|
3316
|
+
getFileList() {
|
|
3317
|
+
return "ai-list";
|
|
3318
|
+
}
|
|
3319
|
+
getList() {
|
|
3320
|
+
let e = [];
|
|
3321
|
+
return this.items.getComponentList().forEach((t) => {
|
|
3322
|
+
let n = new _r(t);
|
|
3323
|
+
n.isAiWiki() && e.push(n);
|
|
3324
|
+
}), e;
|
|
3325
|
+
}
|
|
3326
|
+
makeList() {
|
|
3327
|
+
let e = this.getList(), t = [], n = [];
|
|
3328
|
+
console.log("Ai wiki:", e.length, "components"), e.forEach((e) => {
|
|
3329
|
+
t.push(e.getImport()), n.push(` ${e.getCode()}`);
|
|
3330
|
+
}), this.items.write(this.getFileList(), [
|
|
3331
|
+
...t,
|
|
3332
|
+
"",
|
|
3333
|
+
"export const aiList: any[] = [",
|
|
3334
|
+
n.join(",\r\n"),
|
|
3335
|
+
"]"
|
|
3336
|
+
], "wiki.ts");
|
|
3337
|
+
}
|
|
3338
|
+
makeComponent() {
|
|
3339
|
+
e.writeByPath([...n, "AiWiki.vue"], `<script setup lang="ts">
|
|
3340
|
+
// This file is generated by a script, do not edit.
|
|
3341
|
+
|
|
3342
|
+
import { DxtTestPage, DxtTestWikiAnchor, DxtTestWikiHide } from '@dxtmisha/test'
|
|
3343
|
+
import { aiList } from '../library/${this.getFileList()}.wiki'
|
|
3344
|
+
|
|
3345
|
+
defineOptions({
|
|
3346
|
+
name: 'AiWiki'
|
|
3347
|
+
})
|
|
3348
|
+
<\/script>
|
|
3349
|
+
|
|
3350
|
+
<template>
|
|
3351
|
+
<DxtTestPage
|
|
3352
|
+
title="List of available UI components"
|
|
3353
|
+
description="Below is a list of Vue 3 components available in the UI. These components are available immediately and do not need to be imported."
|
|
3354
|
+
>
|
|
3355
|
+
<DxtTestWikiHide/>
|
|
3356
|
+
<DxtTestWikiAnchor :list="aiList"/>
|
|
3357
|
+
<component
|
|
3358
|
+
v-for="(item, key) in aiList"
|
|
3359
|
+
:key="key"
|
|
3360
|
+
:is="item"
|
|
3361
|
+
/>
|
|
3362
|
+
</DxtTestPage>
|
|
3363
|
+
</template>
|
|
3364
|
+
`);
|
|
3365
|
+
}
|
|
3366
|
+
}, yr = class {
|
|
3367
|
+
items;
|
|
3368
|
+
constructor(e) {
|
|
3369
|
+
this.items = e;
|
|
3370
|
+
}
|
|
3371
|
+
make() {
|
|
3372
|
+
let e = D(t.getProjectName()), n = E(t.getDesignName());
|
|
3373
|
+
this.getIconImport().length > 0 && this.items.write(te, [
|
|
3374
|
+
"import { Icons } from '@dxtmisha/functional'",
|
|
3375
|
+
"",
|
|
3376
|
+
...this.initIconImport(),
|
|
3377
|
+
"",
|
|
3378
|
+
`export const ${n}MakeIcons = (): void => {`,
|
|
3379
|
+
...this.initIcon(),
|
|
3380
|
+
"}"
|
|
3381
|
+
]), this.items.write(re, [`import '../styles/${e}/main.scss'`]);
|
|
3382
|
+
}
|
|
3383
|
+
getIconImport() {
|
|
3384
|
+
let t = [], n = [e.getRoot(), ...i];
|
|
3385
|
+
return e.is(n) && e.readDirRecursive(n).forEach((e) => {
|
|
3386
|
+
let n = e.replace("/", "-");
|
|
3387
|
+
t.push({
|
|
3388
|
+
name: E(this.getIconName(n)),
|
|
3389
|
+
path: this.getIconPath(e),
|
|
3390
|
+
value: this.getIconName(n)
|
|
3391
|
+
});
|
|
3392
|
+
}), t;
|
|
3393
|
+
}
|
|
3394
|
+
getIconName(e) {
|
|
3395
|
+
return e.replace(/\.[^.]+$/, "");
|
|
3396
|
+
}
|
|
3397
|
+
getIconPath(t) {
|
|
3398
|
+
return e.joinPath([
|
|
3399
|
+
".",
|
|
3400
|
+
"..",
|
|
3401
|
+
"..",
|
|
3402
|
+
...i,
|
|
3403
|
+
t
|
|
3404
|
+
]);
|
|
3405
|
+
}
|
|
3406
|
+
initIcon() {
|
|
3407
|
+
let e = [];
|
|
3408
|
+
return this.getIconImport().forEach((t) => {
|
|
3409
|
+
e.push(` Icons.add('${t.value}', ${t.name})`);
|
|
3410
|
+
}), e;
|
|
3411
|
+
}
|
|
3412
|
+
initIconImport() {
|
|
3413
|
+
let e = [];
|
|
3414
|
+
return this.getIconImport().forEach((t) => {
|
|
3415
|
+
e.push(`const ${t.name} = async () => (await import('${t.path}'))?.default`);
|
|
3416
|
+
}), e;
|
|
3417
|
+
}
|
|
3418
|
+
}, br = class {
|
|
3419
|
+
items;
|
|
3420
|
+
packageName;
|
|
3421
|
+
constructor(e) {
|
|
3422
|
+
this.items = e, this.packageName = h()?.name;
|
|
3423
|
+
}
|
|
3424
|
+
make() {
|
|
3425
|
+
let e = this.getComponents(), n = this.getComponentsReg();
|
|
3426
|
+
return this.items.write(ee, [
|
|
3427
|
+
"import type { PluginComponentImports } from '@dxtmisha/constructor/plugin'",
|
|
3428
|
+
"",
|
|
3429
|
+
`// count: ${this.items.getCount()}`,
|
|
3430
|
+
`export const designName: string = '${t.getDesignName()}'`,
|
|
3431
|
+
`export const packageName: string = '${this.packageName}'`,
|
|
3432
|
+
`export const componentsReg: RegExp = ${n}`,
|
|
3433
|
+
`export const styleVarsReg: RegExp = ${this.getVarsReg()}`,
|
|
3434
|
+
"",
|
|
3435
|
+
"export const componentsList: PluginComponentImports = [",
|
|
3436
|
+
e.join(",\r\n"),
|
|
3437
|
+
"]"
|
|
3438
|
+
]), this;
|
|
3439
|
+
}
|
|
3440
|
+
getComponents() {
|
|
3441
|
+
let e = [];
|
|
3442
|
+
return this.packageName && y(this.items.getComponentList(), (t) => {
|
|
3443
|
+
e.push(` {
|
|
3444
|
+
name: '${t.codeFull}',
|
|
3445
|
+
reg: ${this.getReg([t.name], !0)}
|
|
3446
|
+
}`);
|
|
3447
|
+
}), e;
|
|
3448
|
+
}
|
|
3449
|
+
getComponentsReg() {
|
|
3450
|
+
let e = y(this.items.getComponentList(), (e) => e.name);
|
|
3451
|
+
return this.getReg(e);
|
|
3452
|
+
}
|
|
3453
|
+
getDesigns() {
|
|
3454
|
+
return [t.getDesignName(), ...t.getDesignAlternativeName() ?? []];
|
|
3455
|
+
}
|
|
3456
|
+
getReg(e, t = !1) {
|
|
3457
|
+
let n = `((${this.getDesigns().join("|")})-?(${this.getRegName(e)}))`;
|
|
3458
|
+
return n = t ? `^${n}$` : `${n}(?![\\w-])`, `/${n}/ig`;
|
|
3459
|
+
}
|
|
3460
|
+
getRegName(e) {
|
|
3461
|
+
return y(e, (e) => O(e).replace("-", "-?")).join("|");
|
|
3462
|
+
}
|
|
3463
|
+
getVars() {
|
|
3464
|
+
let n = E(t.getDesignName()), r = [
|
|
3465
|
+
...o,
|
|
3466
|
+
t.getProjectName(),
|
|
3467
|
+
"vars.scss"
|
|
3468
|
+
], i = e.readFileOnly(r), a = [];
|
|
3469
|
+
if (i) {
|
|
3470
|
+
let e = i.match(/(?<=--)[^: ]+(?=:)/g);
|
|
3471
|
+
e && e.forEach((e) => {
|
|
3472
|
+
let t = e.match(/^([^-]+)-(.*?)$/);
|
|
3473
|
+
if (t && t?.[1] === n && t?.[2]) {
|
|
3474
|
+
let e = t[2].split("-");
|
|
3475
|
+
e.length > 2 && e.pop(), a.push(e.join("-"));
|
|
3476
|
+
}
|
|
3477
|
+
});
|
|
3478
|
+
}
|
|
3479
|
+
return Se(a);
|
|
3480
|
+
}
|
|
3481
|
+
getVarsReg() {
|
|
3482
|
+
return `/(?<=var\\(--)(${this.getVars().join("|")})/ig`;
|
|
3483
|
+
}
|
|
3484
|
+
}, xr = class {
|
|
3485
|
+
items;
|
|
3486
|
+
constructor(e) {
|
|
3487
|
+
this.items = e;
|
|
3488
|
+
}
|
|
3489
|
+
make() {
|
|
3490
|
+
let e = t.getDesignName();
|
|
3491
|
+
return this.items.write(ne, [
|
|
3492
|
+
"import type { Plugin as VitePlugin } from 'vite'",
|
|
3493
|
+
"import { type PluginOptions, Plugin } from '@dxtmisha/constructor/plugin'",
|
|
3494
|
+
"",
|
|
3495
|
+
"import {",
|
|
3496
|
+
" componentsList,",
|
|
3497
|
+
" componentsReg,",
|
|
3498
|
+
" designName,",
|
|
3499
|
+
" packageName,",
|
|
3500
|
+
" styleVarsReg",
|
|
3501
|
+
"} from './design'",
|
|
3502
|
+
"",
|
|
3503
|
+
"/**",
|
|
3504
|
+
" * Initializes the Vite plugin for the design system.",
|
|
3505
|
+
" *",
|
|
3506
|
+
" * Инициализирует плагин Vite для дизайн-системы.",
|
|
3507
|
+
" * @param options plugin options / настройки плагина",
|
|
3508
|
+
" */",
|
|
3509
|
+
`export function ui${D(e)}VitePlugin(`,
|
|
3510
|
+
" options: PluginOptions = {}",
|
|
3511
|
+
"): VitePlugin {",
|
|
3512
|
+
" return new Plugin(",
|
|
3513
|
+
" designName,",
|
|
3514
|
+
" packageName,",
|
|
3515
|
+
" componentsReg,",
|
|
3516
|
+
" styleVarsReg,",
|
|
3517
|
+
" componentsList,",
|
|
3518
|
+
` 'vite-plugin-${O(e)}-ui',`,
|
|
3519
|
+
" options",
|
|
3520
|
+
" )",
|
|
3521
|
+
" .init()",
|
|
3522
|
+
"}"
|
|
3523
|
+
]), this;
|
|
3524
|
+
}
|
|
3525
|
+
}, Sr = class {
|
|
3526
|
+
items;
|
|
3527
|
+
constructor(e) {
|
|
3528
|
+
this.items = e;
|
|
3529
|
+
}
|
|
3530
|
+
make() {
|
|
3531
|
+
this.items.write("types", [
|
|
3532
|
+
...this.initImports(),
|
|
3533
|
+
"",
|
|
3534
|
+
"declare module '@vue/runtime-core' {",
|
|
3535
|
+
" export interface GlobalComponents {",
|
|
3536
|
+
...this.initGlobalComponentsVue(),
|
|
3537
|
+
" }",
|
|
3538
|
+
"}"
|
|
3539
|
+
]);
|
|
3540
|
+
}
|
|
3541
|
+
getPathComponent(e) {
|
|
3542
|
+
return `../components/${t.getProjectName()}/${e.dir}`;
|
|
3543
|
+
}
|
|
3544
|
+
initImports() {
|
|
3545
|
+
let e = [];
|
|
3546
|
+
return this.items.getComponentList().forEach((t) => {
|
|
3547
|
+
e.push(`import _${t.codeFull} from '${this.getPathComponent(t)}/${t.codeFull}.vue'`);
|
|
3548
|
+
}), e;
|
|
3549
|
+
}
|
|
3550
|
+
initExports() {
|
|
3551
|
+
let e = [];
|
|
3552
|
+
return this.items.getComponentList().forEach((t) => {
|
|
3553
|
+
e.push(` ${t.codeFull}: _${t.codeFull}`);
|
|
3554
|
+
}), e.join(",\r\n");
|
|
3555
|
+
}
|
|
3556
|
+
initIncludeVueComponents() {
|
|
3557
|
+
let e = [];
|
|
3558
|
+
return this.items.getComponentList().forEach((t) => {
|
|
3559
|
+
e.push(` app.component('${t.codeFull}', _${t.codeFull})`);
|
|
3560
|
+
}), e;
|
|
3561
|
+
}
|
|
3562
|
+
initGlobalComponentsVue() {
|
|
3563
|
+
let e = [];
|
|
3564
|
+
return this.items.getComponentList().forEach((t) => {
|
|
3565
|
+
e.push(` ${t.codeFull}: typeof _${t.codeFull}`);
|
|
3566
|
+
}), e;
|
|
3567
|
+
}
|
|
3568
|
+
}, Cr = class {
|
|
3569
|
+
name;
|
|
3570
|
+
components;
|
|
3571
|
+
constructor(e = "") {
|
|
3572
|
+
this.name = e, this.components = new ar();
|
|
3573
|
+
}
|
|
3574
|
+
get component() {
|
|
3575
|
+
return O(this.name).trim();
|
|
3576
|
+
}
|
|
3577
|
+
async make() {
|
|
3578
|
+
M.clear(), new hr().make(), new gr().make(), await this.makeConstructorComponent(), this.makePackage().makeUiProperties(), new yr(this.components).make(), new br(this.components).make(), new xr(this.components).make(), new vr(this.components).make(), new Sr(this.components).make();
|
|
3579
|
+
}
|
|
3580
|
+
async makeConstructorComponent() {
|
|
3581
|
+
let e = this.component;
|
|
3582
|
+
if (e !== "") await new ir(e).make();
|
|
3583
|
+
else for (let e of this.components.getComponentList()) console.log(`Component update: ${e.alias}`), await new ir(e.name).make();
|
|
3584
|
+
return this;
|
|
3585
|
+
}
|
|
3586
|
+
makePackage() {
|
|
3587
|
+
let n = h(), r = D(t.getProjectName());
|
|
3588
|
+
return n?.exports && (n.exports["."] = {
|
|
3589
|
+
types: "./dist/library/types.d.ts",
|
|
3590
|
+
default: "./dist/library/types.js"
|
|
3591
|
+
}, n.exports["./plugin"] = {
|
|
3592
|
+
types: "./dist/library/plugin.d.ts",
|
|
3593
|
+
default: "./dist/library/plugin.js"
|
|
3594
|
+
}, n.exports["./media"] = {
|
|
3595
|
+
types: "./dist/library/media.d.ts",
|
|
3596
|
+
default: "./dist/library/media.js"
|
|
3597
|
+
}, n.exports["./style.css"] = `./dist/styles/${r}/main.css`, n.exports["./style/ui.scss"] = `./src/styles/${r}/main.scss`, n.exports["./ui-properties"] = {
|
|
3598
|
+
sass: "./ui-properties.scss",
|
|
3599
|
+
default: "./ui-properties.scss"
|
|
3600
|
+
}, n.exports["./types.d.ts"] = "./dist/library/types.d.ts", n["web-types"] = "./dist/web-types.json", n.main = "./dist/library/types.js", n.module = "./dist/library/types.js", n.types = "./dist/library/types.d.ts", n.sideEffects = [
|
|
3601
|
+
"*.css",
|
|
3602
|
+
"*.scss",
|
|
3603
|
+
"**/*.css",
|
|
3604
|
+
"**/*.scss"
|
|
3605
|
+
], e.writeByPath(ae, n)), this;
|
|
3606
|
+
}
|
|
3607
|
+
makeUiProperties() {
|
|
3608
|
+
let n = D(t.getProjectName());
|
|
3609
|
+
return e.writeByPath(se, `@forward "./src/styles/${n}/style.scss";`), this;
|
|
3610
|
+
}
|
|
3611
|
+
}, wr = /^(boolean|number|string|null|any|void|object|unknown|never)$/, Tr = class {
|
|
3612
|
+
project;
|
|
3613
|
+
path;
|
|
3614
|
+
data;
|
|
3615
|
+
wiki;
|
|
3616
|
+
dataComponent;
|
|
3617
|
+
constructor(e, t, n) {
|
|
3618
|
+
this.project = e, this.path = t, this.data = n;
|
|
3619
|
+
}
|
|
3620
|
+
async get() {
|
|
3621
|
+
if (this.wiki) {
|
|
3622
|
+
let e = `${D(t.getDesignName())}${this.wiki.getName()}`, n = {
|
|
3623
|
+
name: e,
|
|
3624
|
+
description: this.wiki.getDescription(),
|
|
3625
|
+
source: {
|
|
3626
|
+
module: `${this.project}/${e}`,
|
|
3627
|
+
symbol: e
|
|
3628
|
+
},
|
|
3629
|
+
props: this.getProps()
|
|
3630
|
+
}, r = await this.getSlots();
|
|
3631
|
+
r && (n.slots = r);
|
|
3632
|
+
let i = await this.getEvents();
|
|
3633
|
+
return i && i.length > 0 && (n.js = { events: i }), n;
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
getProp(e) {
|
|
3637
|
+
let t = this.prepareType(e.getType()), n = t ? this.cleanType(t) : void 0;
|
|
3638
|
+
return {
|
|
3639
|
+
name: e.getName(),
|
|
3640
|
+
description: e.getDescription(),
|
|
3641
|
+
default: e.getDefaultValue() ?? void 0,
|
|
3642
|
+
type: n
|
|
3643
|
+
};
|
|
3644
|
+
}
|
|
3645
|
+
getProps() {
|
|
3646
|
+
let e = [];
|
|
3647
|
+
return this.wiki && this.wiki.getWikiObject().forEach((t) => e.push(this.getProp(t))), e;
|
|
3648
|
+
}
|
|
3649
|
+
async getSlots() {
|
|
3650
|
+
let e = await this.getData();
|
|
3651
|
+
if (e && e.slots) {
|
|
3652
|
+
let t = [];
|
|
3653
|
+
return e.slots.forEach((e) => {
|
|
3654
|
+
let n = (e.properties ?? []).map((e) => ({
|
|
3655
|
+
name: e.name,
|
|
3656
|
+
type: e.type ? this.cleanType(e.type) : void 0,
|
|
3657
|
+
description: e.description
|
|
3658
|
+
}));
|
|
3659
|
+
t.push({
|
|
3660
|
+
name: e.name,
|
|
3661
|
+
description: e.description,
|
|
3662
|
+
"vue-properties": n
|
|
3663
|
+
});
|
|
3664
|
+
}), t;
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
async getEvents() {
|
|
3668
|
+
let e = await this.getData();
|
|
3669
|
+
if (e && e.events) {
|
|
3670
|
+
let t = [];
|
|
3671
|
+
return e.events.forEach((e) => {
|
|
3672
|
+
let n = "() => void";
|
|
3673
|
+
e.properties && e.properties.length > 0 && (n = `(${e.properties.map((e) => `${e.name}: ${e.type ? this.cleanType(e.type) : "any"}`).join(", ")}) => void`), t.push({
|
|
3674
|
+
name: e.name,
|
|
3675
|
+
description: e.description,
|
|
3676
|
+
type: n
|
|
3677
|
+
});
|
|
3678
|
+
}), t;
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
getDirName() {
|
|
3682
|
+
return this.data.dir;
|
|
3683
|
+
}
|
|
3684
|
+
async init() {
|
|
3685
|
+
return this.wiki = await this.initWiki(), this;
|
|
3686
|
+
}
|
|
3687
|
+
async getData() {
|
|
3688
|
+
if (!this.dataComponent) {
|
|
3689
|
+
let t = this.getPaths(["wikiData.ts"]);
|
|
3690
|
+
if (e.is(t)) try {
|
|
3691
|
+
let e = await import(t.join("/"));
|
|
3692
|
+
this.dataComponent = Object.values(e).find((e) => "component" in e);
|
|
3693
|
+
} catch (e) {
|
|
3694
|
+
console.error(t, e);
|
|
3695
|
+
}
|
|
3696
|
+
}
|
|
3697
|
+
return this.dataComponent;
|
|
3698
|
+
}
|
|
3699
|
+
getDirs() {
|
|
3700
|
+
return [
|
|
3701
|
+
".",
|
|
3702
|
+
...this.path,
|
|
3703
|
+
this.getDirName()
|
|
3704
|
+
];
|
|
3705
|
+
}
|
|
3706
|
+
getPaths(e) {
|
|
3707
|
+
return [...this.getDirs(), ...e];
|
|
3708
|
+
}
|
|
3709
|
+
prepareType(e) {
|
|
3710
|
+
return e && y(e.split("|"), (e) => {
|
|
3711
|
+
let t = e.trim();
|
|
3712
|
+
if (t !== "undefined") return wr.test(t) ? t : `'${t}'`;
|
|
3713
|
+
}).join(" | ");
|
|
3714
|
+
}
|
|
3715
|
+
cleanType(e) {
|
|
3716
|
+
return e.replace(/^\(([^()]+)\)$/, "$1").replace(/^\(([^()]+)\)\s*\|\s*undefined$/, "$1 | undefined").trim();
|
|
3717
|
+
}
|
|
3718
|
+
async initWiki() {
|
|
3719
|
+
let e = await this.getData();
|
|
3720
|
+
if (e) {
|
|
3721
|
+
let { WikiStorybook: t } = await import("@dxtmisha/wiki"), { wiki: n, wikiDescriptions: r } = await import("@dxtmisha/wiki/media");
|
|
3722
|
+
return new t(e.component, e.props, e.defaults, e.wikiDesign, n, r);
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3725
|
+
}, Er = class {
|
|
3726
|
+
dir;
|
|
3727
|
+
components;
|
|
3728
|
+
constructor(e = "dist") {
|
|
3729
|
+
this.dir = e, me.setErrorStatus(!0), this.components = new ar();
|
|
3730
|
+
}
|
|
3731
|
+
async make() {
|
|
3732
|
+
let n = h();
|
|
3733
|
+
if (console.log("[DesignWikiStorm] make"), n) {
|
|
3734
|
+
let r = {
|
|
3735
|
+
$schema: "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3736
|
+
framework: "vue",
|
|
3737
|
+
name: D(t.getDesignName()),
|
|
3738
|
+
version: n.version,
|
|
3739
|
+
"js-types-syntax": "typescript",
|
|
3740
|
+
contributions: { html: {
|
|
3741
|
+
"description-markup": "markdown",
|
|
3742
|
+
"vue-components": await this.getComponents()
|
|
3743
|
+
} }
|
|
3744
|
+
};
|
|
3745
|
+
e.writeByPath([this.dir, "web-types.json"], r);
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
async getComponents() {
|
|
3749
|
+
let e = h(), t = [];
|
|
3750
|
+
if (e) for (let n of this.components.getComponentList()) {
|
|
3751
|
+
let r = new Tr(e.name, this.components.getComponentsPath(), n);
|
|
3752
|
+
await r.init();
|
|
3753
|
+
let i = await r.get();
|
|
3754
|
+
i && t.push(i);
|
|
3755
|
+
}
|
|
3756
|
+
return t;
|
|
3757
|
+
}
|
|
3758
|
+
};
|
|
3759
|
+
//#endregion
|
|
3760
|
+
export { Ee as ComponentCreator, Ln as DesignConstructors, Wn as DesignFlags, Cr as DesignUi, Er as DesignWikiStorm, pe as PackageInit };
|