@dxtmisha/scripts 0.4.3 → 0.4.5
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/package.json +1 -1
- package/src/classes/Library/LibraryExport.ts +2 -1
- package/src/config.ts +1 -0
- package/src/library.ts +105 -105
- package/src/media/templates/componentPrompt.en.txt +225 -148
- package/src/media/templates/componentPrompt.ru.txt +230 -150
- package/src/media/templates/packages/library/design.config.json +0 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/scripts",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Development scripts and CLI tools for DXT UI projects - automated component generation, library building and project management tools",
|
|
7
7
|
"keywords": [
|
package/src/config.ts
CHANGED
package/src/library.ts
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
// Classes
|
|
2
|
-
export * from './classes/Ai/AiAbstract'
|
|
3
|
-
export * from './classes/Ai/AiGoogle'
|
|
4
|
-
export * from './classes/Component/ComponentCreator'
|
|
5
|
-
export * from './classes/Component/ComponentItem'
|
|
6
|
-
export * from './classes/Component/ComponentWiki'
|
|
7
|
-
export * from './classes/Component/ComponentWikiFile'
|
|
8
|
-
export * from './classes/Design/DesignCommand'
|
|
9
|
-
export * from './classes/Design/DesignComponent'
|
|
10
|
-
export * from './classes/Design/DesignConstructor'
|
|
11
|
-
export * from './classes/Design/DesignConstructors'
|
|
12
|
-
export * from './classes/Design/DesignReplace'
|
|
13
|
-
export * from './classes/Design/DesignStructure'
|
|
14
|
-
export * from './classes/Design/DesignStructureClasses'
|
|
15
|
-
export * from './classes/Design/DesignStructureItemAbstract'
|
|
16
|
-
export * from './classes/Design/DesignStructureRead'
|
|
17
|
-
export * from './classes/Design/DesignStructureStyles'
|
|
18
|
-
export * from './classes/Design/DesignTypescript'
|
|
19
|
-
export * from './classes/Design/DesignUi'
|
|
20
|
-
export * from './classes/Design/DesignWiki'
|
|
21
|
-
export * from './classes/Library/LibraryExport'
|
|
22
|
-
export * from './classes/Library/LibraryFlags'
|
|
23
|
-
export * from './classes/Library/LibraryItems'
|
|
24
|
-
export * from './classes/Library/LibraryMedia'
|
|
25
|
-
export * from './classes/Package/PackageInit'
|
|
26
|
-
export * from './classes/Package/PackageItem'
|
|
27
|
-
export * from './classes/Properties/Properties'
|
|
28
|
-
export * from './classes/Properties/PropertiesCache'
|
|
29
|
-
export * from './classes/Properties/PropertiesConfig'
|
|
30
|
-
export * from './classes/Properties/PropertiesConvector'
|
|
31
|
-
export * from './classes/Properties/PropertiesFile'
|
|
32
|
-
export * from './classes/Properties/PropertiesImport'
|
|
33
|
-
export * from './classes/Properties/PropertiesItems'
|
|
34
|
-
export * from './classes/Properties/PropertiesKeys'
|
|
35
|
-
export * from './classes/Properties/PropertiesMain'
|
|
36
|
-
export * from './classes/Properties/PropertiesPalette'
|
|
37
|
-
export * from './classes/Properties/PropertiesPath'
|
|
38
|
-
export * from './classes/Properties/PropertiesScss'
|
|
39
|
-
export * from './classes/Properties/PropertiesSeparator'
|
|
40
|
-
export * from './classes/Properties/PropertiesSettings'
|
|
41
|
-
export * from './classes/Properties/PropertiesStandard'
|
|
42
|
-
export * from './classes/Properties/PropertiesTool'
|
|
43
|
-
export * from './classes/Properties/PropertiesTypes'
|
|
44
|
-
export * from './classes/Properties/PropertiesValues'
|
|
45
|
-
export * from './classes/Properties/PropertiesWrap'
|
|
46
|
-
export * from './classes/Properties/convector/convectorColor'
|
|
47
|
-
export * from './classes/Properties/convector/convectorFontFamilies'
|
|
48
|
-
export * from './classes/Properties/convector/convectorShadow'
|
|
49
|
-
export * from './classes/Properties/convector/convectorTypography'
|
|
50
|
-
export * from './classes/Properties/to/PropertiesToAbstract'
|
|
51
|
-
export * from './classes/Properties/to/PropertiesToAnimate'
|
|
52
|
-
export * from './classes/Properties/to/PropertiesToClass'
|
|
53
|
-
export * from './classes/Properties/to/PropertiesToClone'
|
|
54
|
-
export * from './classes/Properties/to/PropertiesToComponent'
|
|
55
|
-
export * from './classes/Properties/to/PropertiesToDrag'
|
|
56
|
-
export * from './classes/Properties/to/PropertiesToDuplicate'
|
|
57
|
-
export * from './classes/Properties/to/PropertiesToFull'
|
|
58
|
-
export * from './classes/Properties/to/PropertiesToLink'
|
|
59
|
-
export * from './classes/Properties/to/PropertiesToMedia'
|
|
60
|
-
export * from './classes/Properties/to/PropertiesToMulti'
|
|
61
|
-
export * from './classes/Properties/to/PropertiesToNone'
|
|
62
|
-
export * from './classes/Properties/to/PropertiesToPalette'
|
|
63
|
-
export * from './classes/Properties/to/PropertiesToProperty'
|
|
64
|
-
export * from './classes/Properties/to/PropertiesToRemove'
|
|
65
|
-
export * from './classes/Properties/to/PropertiesToReplace'
|
|
66
|
-
export * from './classes/Properties/to/PropertiesToRoot'
|
|
67
|
-
export * from './classes/Properties/to/PropertiesToSimilar'
|
|
68
|
-
export * from './classes/Properties/to/PropertiesToSort'
|
|
69
|
-
export * from './classes/Properties/to/PropertiesToState'
|
|
70
|
-
export * from './classes/Properties/to/PropertiesToStyle'
|
|
71
|
-
export * from './classes/Properties/to/PropertiesToSub'
|
|
72
|
-
export * from './classes/Properties/to/PropertiesToSubclass'
|
|
73
|
-
export * from './classes/Properties/to/PropertiesToVar'
|
|
74
|
-
export * from './classes/Properties/to/PropertiesToVariable'
|
|
75
|
-
export * from './classes/Styles/Styles'
|
|
76
|
-
export * from './classes/Styles/StylesClasses'
|
|
77
|
-
export * from './classes/Styles/StylesProperties'
|
|
78
|
-
export * from './classes/Styles/StylesRoot'
|
|
79
|
-
export * from './classes/Styles/StylesTool'
|
|
80
|
-
export * from './classes/Styles/to/StylesToAbstract'
|
|
81
|
-
export * from './classes/Styles/to/StylesToAnimate'
|
|
82
|
-
export * from './classes/Styles/to/StylesToClass'
|
|
83
|
-
export * from './classes/Styles/to/StylesToClassFull'
|
|
84
|
-
export * from './classes/Styles/to/StylesToContainer'
|
|
85
|
-
export * from './classes/Styles/to/StylesToMedia'
|
|
86
|
-
export * from './classes/Styles/to/StylesToProperty'
|
|
87
|
-
export * from './classes/Styles/to/StylesToRoot'
|
|
88
|
-
export * from './classes/Styles/to/StylesToSelector'
|
|
89
|
-
export * from './classes/Styles/to/StylesToVar'
|
|
90
|
-
export * from './classes/Styles/to/StylesToVirtual'
|
|
91
|
-
|
|
92
|
-
// Composables
|
|
93
|
-
export * from './composables/useAi'
|
|
94
|
-
|
|
95
|
-
// Functions
|
|
96
|
-
export * from './functions/getComponentPaths'
|
|
97
|
-
export * from './functions/getConstructorProperties'
|
|
98
|
-
export * from './functions/getNameDirByPaths'
|
|
99
|
-
export * from './functions/toPathStandardSep'
|
|
100
|
-
|
|
101
|
-
// Types
|
|
102
|
-
export * from './types/configTypes'
|
|
103
|
-
export * from './types/designTypes'
|
|
104
|
-
export * from './types/libraryTypes'
|
|
105
|
-
export * from './types/propertyTypes'
|
|
1
|
+
// Classes
|
|
2
|
+
export * from './classes/Ai/AiAbstract'
|
|
3
|
+
export * from './classes/Ai/AiGoogle'
|
|
4
|
+
export * from './classes/Component/ComponentCreator'
|
|
5
|
+
export * from './classes/Component/ComponentItem'
|
|
6
|
+
export * from './classes/Component/ComponentWiki'
|
|
7
|
+
export * from './classes/Component/ComponentWikiFile'
|
|
8
|
+
export * from './classes/Design/DesignCommand'
|
|
9
|
+
export * from './classes/Design/DesignComponent'
|
|
10
|
+
export * from './classes/Design/DesignConstructor'
|
|
11
|
+
export * from './classes/Design/DesignConstructors'
|
|
12
|
+
export * from './classes/Design/DesignReplace'
|
|
13
|
+
export * from './classes/Design/DesignStructure'
|
|
14
|
+
export * from './classes/Design/DesignStructureClasses'
|
|
15
|
+
export * from './classes/Design/DesignStructureItemAbstract'
|
|
16
|
+
export * from './classes/Design/DesignStructureRead'
|
|
17
|
+
export * from './classes/Design/DesignStructureStyles'
|
|
18
|
+
export * from './classes/Design/DesignTypescript'
|
|
19
|
+
export * from './classes/Design/DesignUi'
|
|
20
|
+
export * from './classes/Design/DesignWiki'
|
|
21
|
+
export * from './classes/Library/LibraryExport'
|
|
22
|
+
export * from './classes/Library/LibraryFlags'
|
|
23
|
+
export * from './classes/Library/LibraryItems'
|
|
24
|
+
export * from './classes/Library/LibraryMedia'
|
|
25
|
+
export * from './classes/Package/PackageInit'
|
|
26
|
+
export * from './classes/Package/PackageItem'
|
|
27
|
+
export * from './classes/Properties/Properties'
|
|
28
|
+
export * from './classes/Properties/PropertiesCache'
|
|
29
|
+
export * from './classes/Properties/PropertiesConfig'
|
|
30
|
+
export * from './classes/Properties/PropertiesConvector'
|
|
31
|
+
export * from './classes/Properties/PropertiesFile'
|
|
32
|
+
export * from './classes/Properties/PropertiesImport'
|
|
33
|
+
export * from './classes/Properties/PropertiesItems'
|
|
34
|
+
export * from './classes/Properties/PropertiesKeys'
|
|
35
|
+
export * from './classes/Properties/PropertiesMain'
|
|
36
|
+
export * from './classes/Properties/PropertiesPalette'
|
|
37
|
+
export * from './classes/Properties/PropertiesPath'
|
|
38
|
+
export * from './classes/Properties/PropertiesScss'
|
|
39
|
+
export * from './classes/Properties/PropertiesSeparator'
|
|
40
|
+
export * from './classes/Properties/PropertiesSettings'
|
|
41
|
+
export * from './classes/Properties/PropertiesStandard'
|
|
42
|
+
export * from './classes/Properties/PropertiesTool'
|
|
43
|
+
export * from './classes/Properties/PropertiesTypes'
|
|
44
|
+
export * from './classes/Properties/PropertiesValues'
|
|
45
|
+
export * from './classes/Properties/PropertiesWrap'
|
|
46
|
+
export * from './classes/Properties/convector/convectorColor'
|
|
47
|
+
export * from './classes/Properties/convector/convectorFontFamilies'
|
|
48
|
+
export * from './classes/Properties/convector/convectorShadow'
|
|
49
|
+
export * from './classes/Properties/convector/convectorTypography'
|
|
50
|
+
export * from './classes/Properties/to/PropertiesToAbstract'
|
|
51
|
+
export * from './classes/Properties/to/PropertiesToAnimate'
|
|
52
|
+
export * from './classes/Properties/to/PropertiesToClass'
|
|
53
|
+
export * from './classes/Properties/to/PropertiesToClone'
|
|
54
|
+
export * from './classes/Properties/to/PropertiesToComponent'
|
|
55
|
+
export * from './classes/Properties/to/PropertiesToDrag'
|
|
56
|
+
export * from './classes/Properties/to/PropertiesToDuplicate'
|
|
57
|
+
export * from './classes/Properties/to/PropertiesToFull'
|
|
58
|
+
export * from './classes/Properties/to/PropertiesToLink'
|
|
59
|
+
export * from './classes/Properties/to/PropertiesToMedia'
|
|
60
|
+
export * from './classes/Properties/to/PropertiesToMulti'
|
|
61
|
+
export * from './classes/Properties/to/PropertiesToNone'
|
|
62
|
+
export * from './classes/Properties/to/PropertiesToPalette'
|
|
63
|
+
export * from './classes/Properties/to/PropertiesToProperty'
|
|
64
|
+
export * from './classes/Properties/to/PropertiesToRemove'
|
|
65
|
+
export * from './classes/Properties/to/PropertiesToReplace'
|
|
66
|
+
export * from './classes/Properties/to/PropertiesToRoot'
|
|
67
|
+
export * from './classes/Properties/to/PropertiesToSimilar'
|
|
68
|
+
export * from './classes/Properties/to/PropertiesToSort'
|
|
69
|
+
export * from './classes/Properties/to/PropertiesToState'
|
|
70
|
+
export * from './classes/Properties/to/PropertiesToStyle'
|
|
71
|
+
export * from './classes/Properties/to/PropertiesToSub'
|
|
72
|
+
export * from './classes/Properties/to/PropertiesToSubclass'
|
|
73
|
+
export * from './classes/Properties/to/PropertiesToVar'
|
|
74
|
+
export * from './classes/Properties/to/PropertiesToVariable'
|
|
75
|
+
export * from './classes/Styles/Styles'
|
|
76
|
+
export * from './classes/Styles/StylesClasses'
|
|
77
|
+
export * from './classes/Styles/StylesProperties'
|
|
78
|
+
export * from './classes/Styles/StylesRoot'
|
|
79
|
+
export * from './classes/Styles/StylesTool'
|
|
80
|
+
export * from './classes/Styles/to/StylesToAbstract'
|
|
81
|
+
export * from './classes/Styles/to/StylesToAnimate'
|
|
82
|
+
export * from './classes/Styles/to/StylesToClass'
|
|
83
|
+
export * from './classes/Styles/to/StylesToClassFull'
|
|
84
|
+
export * from './classes/Styles/to/StylesToContainer'
|
|
85
|
+
export * from './classes/Styles/to/StylesToMedia'
|
|
86
|
+
export * from './classes/Styles/to/StylesToProperty'
|
|
87
|
+
export * from './classes/Styles/to/StylesToRoot'
|
|
88
|
+
export * from './classes/Styles/to/StylesToSelector'
|
|
89
|
+
export * from './classes/Styles/to/StylesToVar'
|
|
90
|
+
export * from './classes/Styles/to/StylesToVirtual'
|
|
91
|
+
|
|
92
|
+
// Composables
|
|
93
|
+
export * from './composables/useAi'
|
|
94
|
+
|
|
95
|
+
// Functions
|
|
96
|
+
export * from './functions/getComponentPaths'
|
|
97
|
+
export * from './functions/getConstructorProperties'
|
|
98
|
+
export * from './functions/getNameDirByPaths'
|
|
99
|
+
export * from './functions/toPathStandardSep'
|
|
100
|
+
|
|
101
|
+
// Types
|
|
102
|
+
export * from './types/configTypes'
|
|
103
|
+
export * from './types/designTypes'
|
|
104
|
+
export * from './types/libraryTypes'
|
|
105
|
+
export * from './types/propertyTypes'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
You need to prepare documentation for a component in the [wikiLanguage] language. Follow the format and requirements strictly. Do not add anything beyond what is described.
|
|
2
|
-
Stack: Storybook 9.x, TypeScript, MDX.
|
|
2
|
+
Stack: Storybook 9.x, TypeScript, MDX, Vue 3 Composition API.
|
|
3
3
|
|
|
4
4
|
Canvas component is imported from '@storybook/addon-docs/blocks'
|
|
5
5
|
|
|
@@ -9,27 +9,36 @@ Canvas component is imported from '@storybook/addon-docs/blocks'
|
|
|
9
9
|
```
|
|
10
10
|
[code]
|
|
11
11
|
```
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
Analyze:
|
|
14
|
+
- Component structure (props, computed, methods)
|
|
15
|
+
- Events (emit) and their parameters
|
|
16
|
+
- Slots and their parameters
|
|
17
|
+
- Data types (interfaces, types)
|
|
18
|
+
- Expose methods and properties
|
|
19
|
+
- Internal logic and behavior
|
|
20
|
+
- Dependencies on other components
|
|
13
21
|
|
|
14
22
|
====================================
|
|
15
23
|
2) Add missing type comments
|
|
16
24
|
====================================
|
|
17
25
|
Add brief single-language (in [wikiLanguage]) JSDoc comments to missing types and their properties.
|
|
26
|
+
|
|
18
27
|
Code to fix:
|
|
19
28
|
```ts
|
|
20
29
|
// types.ts
|
|
21
30
|
[types]
|
|
22
31
|
```
|
|
23
|
-
Duplicate the result below without wrapper:
|
|
24
|
-
[types]
|
|
25
32
|
|
|
26
33
|
Comment requirements:
|
|
27
|
-
- Single-line for simple fields
|
|
28
|
-
- Multi-line for logic blocks
|
|
29
|
-
- No duplication of the obvious
|
|
30
|
-
- Adapted for
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
- Single-line for simple fields (/** Description */)
|
|
35
|
+
- Multi-line for complex types or logic blocks
|
|
36
|
+
- No duplication of the obvious (don't comment "id" as "component id")
|
|
37
|
+
- Adapted for display in Storybook
|
|
38
|
+
- Use technical terms correctly
|
|
39
|
+
- For union types, describe each value separately in code
|
|
40
|
+
|
|
41
|
+
Example (strictly follow the format):
|
|
33
42
|
```ts
|
|
34
43
|
/**
|
|
35
44
|
* Basic properties for image components.
|
|
@@ -46,167 +55,189 @@ export interface IconPropsBasic<
|
|
|
46
55
|
icon?: ImageValue<Image>
|
|
47
56
|
/** Active icon value */
|
|
48
57
|
iconActive?: ImageValue<Image>
|
|
58
|
+
|
|
59
|
+
// Design
|
|
60
|
+
/**
|
|
61
|
+
* Icon size
|
|
62
|
+
* @default 'medium'
|
|
63
|
+
*/
|
|
64
|
+
size?: 'small' | 'medium' | 'large'
|
|
49
65
|
}
|
|
50
66
|
```
|
|
51
67
|
|
|
52
68
|
====================================
|
|
53
69
|
3) Stories for Storybook
|
|
54
70
|
====================================
|
|
55
|
-
Create
|
|
71
|
+
Create minimum necessary examples. Each story demonstrates a specific usage scenario.
|
|
72
|
+
|
|
56
73
|
Code to fix:
|
|
57
74
|
```ts
|
|
58
75
|
// ComponentDoc.stories.ts
|
|
59
76
|
[stories]
|
|
60
77
|
```
|
|
78
|
+
|
|
61
79
|
Rules:
|
|
62
|
-
-
|
|
63
|
-
- Don't touch
|
|
64
|
-
- Don't
|
|
65
|
-
- Don't add stories just for filling
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
80
|
+
- STRICTLY FORBIDDEN to touch const meta. DO NOT CHANGE ANYTHING IN META.
|
|
81
|
+
- Don't touch existing constants and stories
|
|
82
|
+
- Don't rename existing constants
|
|
83
|
+
- Don't add stories just for filling
|
|
84
|
+
- Each story must have a purpose and demonstrate specific functionality
|
|
85
|
+
- If component has different modes, show one clear example for each
|
|
86
|
+
- Story names in PascalCase style without extra words (e.g.: `Basic`, `WithIcon`, `Disabled`)
|
|
87
|
+
- Minimize imports: only necessary
|
|
88
|
+
- Don't use extra wrappers (div, section) without necessity
|
|
89
|
+
- Simple, readable code
|
|
90
|
+
|
|
91
|
+
Example:
|
|
92
|
+
```ts
|
|
93
|
+
export const Basic: Story = {
|
|
94
|
+
args: {
|
|
95
|
+
label: 'Click me'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const WithIcon: Story = {
|
|
100
|
+
args: {
|
|
101
|
+
label: 'Click me',
|
|
102
|
+
icon: 'check'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
69
106
|
|
|
70
107
|
====================================
|
|
71
108
|
4) MDX documentation (component description)
|
|
72
109
|
====================================
|
|
73
|
-
Prepare
|
|
110
|
+
Prepare complete component description in MDX format. Strict style: no tables, no extra sections, only necessary information.
|
|
111
|
+
|
|
74
112
|
Code to fix:
|
|
75
113
|
```md
|
|
76
|
-
//
|
|
114
|
+
// ComponentName.mdx
|
|
77
115
|
[md]
|
|
78
116
|
```
|
|
79
117
|
|
|
80
|
-
|
|
81
|
-
- At the beginning: [description] — Brief description of the purpose (1–3 sentences): conveys the essence of the component as briefly as possible.
|
|
82
|
-
- Next: main text (documentation) — starts without a heading. This is [doc].
|
|
83
|
-
- You can refine existing text by changing it, but don't delete. Delete only unnecessary or outdated content.
|
|
84
|
-
- Be sure to list slots (if any) and events (if any) in the given format.
|
|
85
|
-
- Don't describe props in a list if they are simple. Describe only complex relationships (e.g., dependent props) or composite types in detail.
|
|
86
|
-
- Usage example — at the end of the corresponding semantic block or at the very bottom if there is one general example.
|
|
87
|
-
- Slots and events — strictly in the format below. If there are no types, the type block is omitted.
|
|
88
|
-
- Add Canvas if there is a usage example. If not, add stories.
|
|
89
|
-
|
|
90
|
-
Slot format:
|
|
91
|
-
```
|
|
92
|
-
## Slots
|
|
93
|
-
### `slotName`
|
|
94
|
-
Brief description of the slot's purpose. You can highlight features with a bulleted list.
|
|
95
|
-
If there are props, add props description. `props: any` means there are no props, no need to write it.
|
|
96
|
-
If there are multiple slots — each with `###` subheading.
|
|
97
|
-
If it just returns VNode, no need to describe.
|
|
98
|
-
Don't write something like: `This slot accepts any VNode and doesn't pass any properties.`
|
|
99
|
-
If there are no events, don't describe the events block.
|
|
100
|
-
If there are no slots, don't describe the slots block.
|
|
101
|
-
|
|
102
|
-
Event format:
|
|
103
|
-
```
|
|
104
|
-
## Events
|
|
105
|
-
### `eventName`
|
|
106
|
-
Description of when and why it is emitted.
|
|
118
|
+
Document structure (strict):
|
|
107
119
|
|
|
108
|
-
|
|
109
|
-
|
|
120
|
+
**1. Brief description:**
|
|
121
|
+
- One sentence, conveying the essence of the component as briefly as possible
|
|
122
|
+
- Don't use phrases like "This component", start immediately with the purpose
|
|
110
123
|
|
|
111
|
-
|
|
124
|
+
**2. Main documentation text:**
|
|
125
|
+
- Starts WITHOUT a heading
|
|
126
|
+
- Detailed functionality description (2-4 paragraphs)
|
|
127
|
+
- Block "**Key Features:**" (list of key features)
|
|
128
|
+
- Block "**Typical Use Cases:**" (list of usage examples)
|
|
129
|
+
- Can refine existing text, but DO NOT delete relevant information
|
|
130
|
+
- Delete only outdated or redundant content
|
|
112
131
|
|
|
113
|
-
**
|
|
132
|
+
**3. Special sections (if present):**
|
|
114
133
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
134
|
+
**Props (only for complex cases):**
|
|
135
|
+
- Describe Props only if they have complex interaction logic, dependencies, or composite types
|
|
136
|
+
- DO NOT describe simple boolean/string props in a list - JSDoc comments in types are enough for them
|
|
137
|
+
- Format: `## Props`, then `### PropName` for each complex prop
|
|
138
|
+
|
|
139
|
+
Example of complex prop description:
|
|
140
|
+
```md
|
|
141
|
+
## Props
|
|
142
|
+
### `adaptive`
|
|
143
|
+
|
|
144
|
+
Window adaptive behavior mode.
|
|
145
|
+
|
|
146
|
+
**Type:** `'modal' | 'menu' | 'actionSheet' | 'static'`
|
|
147
|
+
|
|
148
|
+
**Default:** `'modal'`
|
|
149
|
+
|
|
150
|
+
**Possible values:**
|
|
151
|
+
- `'modal'` — modal window in screen center with overlay
|
|
152
|
+
- `'menu'` — dropdown menu attached to control element
|
|
153
|
+
- `'actionSheet'` — bottom panel for mobile interfaces
|
|
154
|
+
- `'static'` — static mode without overlay and positioning
|
|
121
155
|
```
|
|
122
156
|
|
|
123
|
-
|
|
157
|
+
**4. Mandatory sections (if present in component):**
|
|
124
158
|
|
|
125
|
-
|
|
159
|
+
**Expose methods/properties:**
|
|
160
|
+
```md
|
|
161
|
+
## Expose Methods
|
|
162
|
+
### `methodName`
|
|
163
|
+
|
|
164
|
+
Method description.
|
|
165
|
+
|
|
166
|
+
**Type:** `(param: Type) => ReturnType`
|
|
126
167
|
|
|
127
168
|
**Parameters:**
|
|
128
|
-
- `
|
|
169
|
+
- `param: Type` — parameter description
|
|
129
170
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
<button @click="onclick">
|
|
134
|
-
{{ open ? 'Close' : 'Open' }}
|
|
135
|
-
</button>
|
|
136
|
-
</template>
|
|
137
|
-
</Window>
|
|
171
|
+
**Returns:** return value description
|
|
172
|
+
|
|
173
|
+
[code example]
|
|
138
174
|
```
|
|
139
175
|
|
|
140
|
-
|
|
141
|
-
|
|
176
|
+
**Slots:**
|
|
177
|
+
```md
|
|
178
|
+
## Slots
|
|
179
|
+
### `slotName`
|
|
142
180
|
|
|
143
|
-
|
|
181
|
+
Slot description.
|
|
144
182
|
|
|
145
183
|
**Parameters:**
|
|
146
|
-
- `
|
|
184
|
+
- `param: Type` — slot parameter description
|
|
147
185
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
- `element: HTMLDivElement` — window DOM element
|
|
151
|
-
- `control: HTMLElement` — control DOM element
|
|
152
|
-
- `open: boolean` — window open state (`true` - open, `false` - closed)
|
|
186
|
+
[code example]
|
|
187
|
+
```
|
|
153
188
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
console.log('Window open:', options.open)
|
|
159
|
-
console.log('Window element:', options.element)
|
|
160
|
-
console.log('Control element:', options.control)
|
|
161
|
-
}
|
|
162
|
-
</script>
|
|
189
|
+
**Events:**
|
|
190
|
+
```md
|
|
191
|
+
## Events
|
|
192
|
+
### `eventName`
|
|
163
193
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
194
|
+
Event description.
|
|
195
|
+
|
|
196
|
+
**Parameters:**
|
|
197
|
+
- `param: Type` — event parameter description
|
|
198
|
+
|
|
199
|
+
**Type structure:** (if parameter is complex)
|
|
200
|
+
- `field: string` — field description
|
|
201
|
+
- `field2: number` — field description
|
|
202
|
+
|
|
203
|
+
[code example]
|
|
171
204
|
```
|
|
172
205
|
|
|
206
|
+
**5. Usage examples:**
|
|
207
|
+
- Add Canvas to demonstrate specific scenarios
|
|
208
|
+
- DO NOT add base `<Canvas of={Component.Component}/>` — it's already at the beginning
|
|
209
|
+
- Format: `<Canvas of={Component.StoryName}/>`
|
|
173
210
|
|
|
174
|
-
|
|
175
|
-
<Canvas of={Chip.ChipSkeleton}/>
|
|
211
|
+
**Strict formatting rules:**
|
|
176
212
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
[types.ts]
|
|
182
|
-
#########
|
|
183
|
-
[ComponentDoc.stories.ts]
|
|
184
|
-
#########
|
|
185
|
-
[UiPlayerLite.mdx]
|
|
213
|
+
- Heading levels:
|
|
214
|
+
- `##` — main sections (Props, Expose Methods, Slots, Events)
|
|
215
|
+
- `###` — specific elements (method, slot, event names)
|
|
216
|
+
- `####` — subsections within description (Behavior, Examples)
|
|
186
217
|
|
|
187
|
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
- [types.ts] — final types block with comments (only content, without file name comments).
|
|
192
|
-
- [ComponentDoc.stories.ts] — final stories file (only content, without file name comments).
|
|
193
|
-
- [UiPlayerLite.mdx] — final MDX documentation (only content, without file name comments).
|
|
218
|
+
- Code:
|
|
219
|
+
- Types and interfaces: ` ```ts `
|
|
220
|
+
- Component markup: ` ```html ` (NOT ` ```vue `)
|
|
221
|
+
- Inline code: wrap in backticks `` `code` ``
|
|
194
222
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
-
|
|
199
|
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
|
|
205
|
-
|
|
223
|
+
- Meta and StorybookMain:
|
|
224
|
+
- STRICTLY FORBIDDEN to touch Meta and StorybookMain blocks
|
|
225
|
+
- They must remain as is at the beginning of the file
|
|
226
|
+
- Don't add, don't delete, don't modify them
|
|
227
|
+
|
|
228
|
+
- Structural elements:
|
|
229
|
+
- Use `**Bold text:**` for subheadings within descriptions
|
|
230
|
+
- Use `>` for important notes and warnings
|
|
231
|
+
- Lists only where they improve readability
|
|
232
|
+
|
|
233
|
+
**Example of full document structure:**
|
|
234
|
+
|
|
235
|
+
```md
|
|
236
|
+
import { Meta, Canvas } from '@storybook/addon-docs/blocks'
|
|
237
|
+
import * as Component from './Component.stories'
|
|
238
|
+
|
|
239
|
+
<Meta of={Component} />
|
|
206
240
|
|
|
207
|
-
====================================
|
|
208
|
-
Example (don't include in response, only as style guide)
|
|
209
|
-
====================================
|
|
210
241
|
Component for creating modal windows, dialogs, and popup elements with flexible positioning and adaptive behavior.
|
|
211
242
|
|
|
212
243
|
Window manages content display over the main interface, supports various positioning types (modal windows, dropdown menus, action sheets), open/close animations, and event system integration. The component automatically handles clicks outside the area, focus management, and adaptation to different screen sizes.
|
|
@@ -231,6 +262,8 @@ Window manages content display over the main interface, supports various positio
|
|
|
231
262
|
|
|
232
263
|
## CSS Classes for Behavior Control
|
|
233
264
|
|
|
265
|
+
Component uses special CSS classes for behavior control:
|
|
266
|
+
|
|
234
267
|
- `*--block` — prevents window from closing when clicking outside its boundaries
|
|
235
268
|
- `*--blockChildren` — prevents current window from closing
|
|
236
269
|
- `*--blockOther` — prevents other windows from closing until current one is closed
|
|
@@ -241,34 +274,20 @@ Window manages content display over the main interface, supports various positio
|
|
|
241
274
|
|
|
242
275
|
Where `*` is the component class name (e.g., `d1-window`, `m3-window`).
|
|
243
276
|
|
|
244
|
-
##
|
|
245
|
-
|
|
246
|
-
The Window component supports static mode operation through the `staticMode` property. In this mode, the window works as an embedded component without modal behavior:
|
|
277
|
+
## Props
|
|
278
|
+
### `adaptive`
|
|
247
279
|
|
|
248
|
-
|
|
249
|
-
- **Animations disabled** — no appearance/disappearance effects
|
|
250
|
-
- **Positioning disabled** — window is embedded in document flow
|
|
251
|
-
- **Works with adaptive** — when the `adaptive` property has one of the static modes (e.g., `static`), static mode is enabled
|
|
280
|
+
Window adaptive behavior mode.
|
|
252
281
|
|
|
253
|
-
|
|
282
|
+
**Type:** `'modal' | 'menu' | 'actionSheet' | 'static'`
|
|
254
283
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
Controls the axis of window placement relative to the anchor element. Default: `y`.
|
|
258
|
-
|
|
259
|
-
> Applies only in menu mode (`adaptive="menu"` or `adaptive="menuWindow"`).
|
|
284
|
+
**Default:** `'modal'`
|
|
260
285
|
|
|
261
286
|
**Possible values:**
|
|
262
|
-
- `'
|
|
263
|
-
- `'
|
|
264
|
-
- `'
|
|
265
|
-
|
|
266
|
-
### Behavior
|
|
267
|
-
|
|
268
|
-
- Component automatically selects the placement side with the most available space
|
|
269
|
-
- When using context menu (`contextmenu`), positioning occurs from cursor coordinates
|
|
270
|
-
- Window always stays within visible screen area (viewport)
|
|
271
|
-
- Indent from anchor is set via `indent` property (default 4px)
|
|
287
|
+
- `'modal'` — modal window in screen center
|
|
288
|
+
- `'menu'` — dropdown menu attached to element
|
|
289
|
+
- `'actionSheet'` — bottom panel for mobile devices
|
|
290
|
+
- `'static'` — static mode without overlay
|
|
272
291
|
|
|
273
292
|
## State Management via v-model
|
|
274
293
|
|
|
@@ -368,3 +387,61 @@ const handleWindow = (options) => {
|
|
|
368
387
|
</template>
|
|
369
388
|
```
|
|
370
389
|
|
|
390
|
+
## Usage Examples
|
|
391
|
+
### Basic Modal Window
|
|
392
|
+
|
|
393
|
+
<Canvas of={Component.BasicModal}/>
|
|
394
|
+
|
|
395
|
+
### Dropdown Menu
|
|
396
|
+
|
|
397
|
+
<Canvas of={Component.DropdownMenu}/>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
====================================
|
|
401
|
+
5) Final return
|
|
402
|
+
====================================
|
|
403
|
+
Return the result STRICTLY in the format (nothing extra before or after):
|
|
404
|
+
|
|
405
|
+
[types.ts]
|
|
406
|
+
#########
|
|
407
|
+
[ComponentDoc.stories.ts]
|
|
408
|
+
#########
|
|
409
|
+
[ComponentName.mdx]
|
|
410
|
+
|
|
411
|
+
**Output format requirements:**
|
|
412
|
+
- DO NOT add file labels like `// filepath: ...`
|
|
413
|
+
- DO NOT wrap in code blocks (` ```ts `, ` ```md `)
|
|
414
|
+
- DO NOT add comments with file names
|
|
415
|
+
- DO NOT include in the result text `[types.ts]`, `[ComponentDoc.stories.ts]`, `[ComponentName.mdx]`
|
|
416
|
+
- Only clean code, separated by a line of nine hash symbols: `#########`
|
|
417
|
+
- Order strictly: types → stories → documentation
|
|
418
|
+
- Each block starts with the first line of code, without spaces and line breaks before
|
|
419
|
+
|
|
420
|
+
**Structure of each block:**
|
|
421
|
+
- `[types.ts]` — final types file with JSDoc comments (only file content)
|
|
422
|
+
- `[ComponentDoc.stories.ts]` — final stories file (only file content)
|
|
423
|
+
- `[ComponentName.mdx]` — final MDX documentation (only file content)
|
|
424
|
+
|
|
425
|
+
====================================
|
|
426
|
+
Constraints and style
|
|
427
|
+
====================================
|
|
428
|
+
|
|
429
|
+
**Forbidden:**
|
|
430
|
+
- Tables in any form
|
|
431
|
+
- Arbitrary additional sections outside specified ones
|
|
432
|
+
- "Props" section for simple properties without complex logic
|
|
433
|
+
- Duplication of descriptions of the same thing
|
|
434
|
+
- Placeholders outside those specified in prompt (`[code]`, `[types]`, `[stories]`, `[md]`)
|
|
435
|
+
- Using ` ```vue ` for code examples (only ` ```html `)
|
|
436
|
+
- Changing Meta block in MDX
|
|
437
|
+
- Adding base Canvas (`<Canvas of={Component.Component}/>`)
|
|
438
|
+
|
|
439
|
+
**Required:**
|
|
440
|
+
- Documentation language corresponds to [wikiLanguage]
|
|
441
|
+
- If [wikiLanguage] = "en", use English for ALL documentation
|
|
442
|
+
- If [wikiLanguage] = "ru", use Russian for ALL documentation
|
|
443
|
+
- Code blocks: types and events — ` ```ts `, markup — ` ```html `
|
|
444
|
+
- Stories: only necessary scenarios, without visual decorations
|
|
445
|
+
- Brevity and informativeness without "fluff"
|
|
446
|
+
- Technically correct terms
|
|
447
|
+
- Code examples are functional and up-to-date
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
Нужно подготовить документацию для компонента на языке [wikiLanguage].
|
|
2
|
-
|
|
1
|
+
Нужно подготовить документацию для компонента на языке [wikiLanguage].
|
|
2
|
+
Следуй строго формату и требованиям ниже.
|
|
3
|
+
Не добавляй ничего лишнего вне описанного.
|
|
4
|
+
Стек: Storybook 9.x, TypeScript, MDX, Vue 3 Composition API.
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
Canvas компонент импортируется из '@storybook/addon-docs/blocks'
|
|
5
7
|
|
|
6
8
|
====================================
|
|
7
9
|
1) Изучи текущий код компонента
|
|
@@ -9,27 +11,36 @@
|
|
|
9
11
|
```
|
|
10
12
|
[code]
|
|
11
13
|
```
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
Проанализируй:
|
|
16
|
+
- Структуру компонента (props, computed, methods)
|
|
17
|
+
- События (emit) и их параметры
|
|
18
|
+
- Слоты (slots) и их параметры
|
|
19
|
+
- Типы данных (interfaces, types)
|
|
20
|
+
- Expose методы и свойства
|
|
21
|
+
- Внутреннюю логику и поведение
|
|
22
|
+
- Зависимости от других компонентов
|
|
13
23
|
|
|
14
24
|
====================================
|
|
15
25
|
2) Добавь недостающие комментарии к типам
|
|
16
26
|
====================================
|
|
17
27
|
Добавь краткие одноязычные (на [wikiLanguage]) JSDoc-комментарии к отсутствующим типам и их свойствам.
|
|
28
|
+
|
|
18
29
|
Код для исправления:
|
|
19
30
|
```ts
|
|
20
31
|
// types.ts
|
|
21
32
|
[types]
|
|
22
33
|
```
|
|
23
|
-
Ниже продублируй итог без обёртки:
|
|
24
|
-
[types]
|
|
25
34
|
|
|
26
35
|
Требования к комментариям:
|
|
27
|
-
- Однострочные для простых
|
|
28
|
-
- Многострочные для блоков
|
|
29
|
-
- Без дублирования
|
|
30
|
-
- Адаптированы
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
- Однострочные для простых полей (/** Описание */)
|
|
37
|
+
- Многострочные для сложных типов или блоков логики
|
|
38
|
+
- Без дублирования очевидного (не комментируй "id" как "id компонента")
|
|
39
|
+
- Адаптированы для отображения в Storybook
|
|
40
|
+
- Используй технические термины правильно
|
|
41
|
+
- Для union типов опиши каждое значение отдельно в коде
|
|
42
|
+
|
|
43
|
+
Пример (строго следуй формату):
|
|
33
44
|
```ts
|
|
34
45
|
/**
|
|
35
46
|
* Basic properties for image components.
|
|
@@ -46,167 +57,189 @@ export interface IconPropsBasic<
|
|
|
46
57
|
icon?: ImageValue<Image>
|
|
47
58
|
/** Значение активной иконки */
|
|
48
59
|
iconActive?: ImageValue<Image>
|
|
60
|
+
|
|
61
|
+
// Design
|
|
62
|
+
/**
|
|
63
|
+
* Размер иконки
|
|
64
|
+
* @default 'medium'
|
|
65
|
+
*/
|
|
66
|
+
size?: 'small' | 'medium' | 'large'
|
|
49
67
|
}
|
|
50
68
|
```
|
|
51
69
|
|
|
52
70
|
====================================
|
|
53
71
|
3) Истории (stories) для Storybook
|
|
54
72
|
====================================
|
|
55
|
-
Создай
|
|
73
|
+
Создай минимально необходимые примеры. Каждая история демонстрирует конкретный сценарий использования.
|
|
74
|
+
|
|
56
75
|
Код для исправления:
|
|
57
76
|
```ts
|
|
58
77
|
// ComponentDoc.stories.ts
|
|
59
78
|
[stories]
|
|
60
79
|
```
|
|
80
|
+
|
|
61
81
|
Правила:
|
|
62
|
-
-
|
|
63
|
-
- Не трогать
|
|
64
|
-
- Не
|
|
65
|
-
- Не
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
82
|
+
- СТРОГО ЗАПРЕЩЕНО трогать const meta. НИЧЕГО НЕ МЕНЯТЬ В META.
|
|
83
|
+
- Не трогать существующие константы и истории
|
|
84
|
+
- Не переименовывать существующие константы
|
|
85
|
+
- Не добавлять истории ради заполнения
|
|
86
|
+
- Каждая история должна иметь цель и демонстрировать конкретную функциональность
|
|
87
|
+
- Если компонент имеет разные режимы, покажи по одному чёткому примеру для каждого
|
|
88
|
+
- Имена историй в стиле PascalCase без лишних слов (например: `Basic`, `WithIcon`, `Disabled`)
|
|
89
|
+
- Минимизируй импорты: только необходимое
|
|
90
|
+
- Не используй лишние обёртки (div, section) без необходимости
|
|
91
|
+
- Простой, читаемый код
|
|
92
|
+
|
|
93
|
+
Пример:
|
|
94
|
+
```ts
|
|
95
|
+
export const Basic: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
label: 'Click me'
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const WithIcon: Story = {
|
|
102
|
+
args: {
|
|
103
|
+
label: 'Click me',
|
|
104
|
+
icon: 'check'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
69
108
|
|
|
70
109
|
====================================
|
|
71
110
|
4) MDX-документация (описание компонента)
|
|
72
111
|
====================================
|
|
73
|
-
Подготовь полное описание компонента в формате MDX. Строгая стилистика: никаких таблиц, никаких лишних
|
|
112
|
+
Подготовь полное описание компонента в формате MDX. Строгая стилистика: никаких таблиц, никаких лишних разделов, только необходимая информация.
|
|
113
|
+
|
|
74
114
|
Код для исправления:
|
|
75
115
|
```md
|
|
76
|
-
//
|
|
116
|
+
// ComponentName.mdx
|
|
77
117
|
[md]
|
|
78
118
|
```
|
|
79
119
|
|
|
80
|
-
|
|
81
|
-
- В начале: [description] — Краткое описание назначения (1–3 предложения): максимально коротко передаёт суть компонента.
|
|
82
|
-
- Далее: основной текст (документация) — начинается без заголовка. Это [doc].
|
|
83
|
-
- Можно дорабатывать существующий текст, изменяя, но не удалять. Удаляй только лишнее или неактуальное.
|
|
84
|
-
- Обязательно перечисли слоты (если есть) и события (если есть) в заданном формате.
|
|
85
|
-
- Не описывай props списком, если они простые. Подробно описывай только сложные связки (например, зависимые props) или составные типы.
|
|
86
|
-
- Пример использования — в конце соответствующего смыслового блока или в самом низу, если один общий пример.
|
|
87
|
-
- Слоты и события — строго в формате ниже. Если типов нет — блок с типом опускается.
|
|
88
|
-
- Добавь Canvas, если есть пример использования. Если нет — добавь stories.
|
|
89
|
-
|
|
90
|
-
Формат слотов:
|
|
91
|
-
```
|
|
92
|
-
## Слоты
|
|
93
|
-
### `имяСлота`
|
|
94
|
-
Краткое описание назначения слота. Можно маркированным списком выделить особенности.
|
|
95
|
-
Если есть props, добавить описание props. `props: any` - это значит, что нет пропсов, его не надо писать.
|
|
96
|
-
Если слотов несколько — каждый с подпунктом `###`.
|
|
97
|
-
Если возвращает просто VNode, не надо описывать.
|
|
98
|
-
Не надо писать что-то в таком виде: `Этот слот принимает любые VNode и не передает никаких свойств.`
|
|
99
|
-
Если нет событий, не описывать блок событий.
|
|
100
|
-
Если нет слотов, не описывать блок слотов.
|
|
101
|
-
|
|
102
|
-
Формат событий:
|
|
103
|
-
```
|
|
104
|
-
## События
|
|
105
|
-
### `имяСобытия`
|
|
106
|
-
Описание, когда и зачем испускается.
|
|
120
|
+
Структура документа (строго):
|
|
107
121
|
|
|
108
|
-
|
|
109
|
-
|
|
122
|
+
**1. Краткое описание (description):**
|
|
123
|
+
- Одно предложение, максимально кратко передающее суть компонента
|
|
124
|
+
- Не используй фразы типа "Этот компонент", начинай сразу с назначения
|
|
110
125
|
|
|
111
|
-
|
|
126
|
+
**2. Основной текст документации (doc):**
|
|
127
|
+
- Начинается БЕЗ заголовка
|
|
128
|
+
- Детальное описание функциональности (2-4 абзаца)
|
|
129
|
+
- Блок "**Основные возможности:**" (список ключевых фич)
|
|
130
|
+
- Блок "**Типичные сценарии использования:**" (список примеров применения)
|
|
131
|
+
- Можно дорабатывать существующий текст, но НЕ удалять актуальную информацию
|
|
132
|
+
- Удаляй только устаревшее или избыточное
|
|
112
133
|
|
|
113
|
-
|
|
134
|
+
**3. Специальные разделы (если есть):**
|
|
114
135
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
136
|
+
**Props (только для сложных случаев):**
|
|
137
|
+
- Описывай Props только если они имеют сложную логику взаимодействия, зависимости или составные типы
|
|
138
|
+
- НЕ описывай простые boolean/string props списком - для них достаточно JSDoc комментариев в типах
|
|
139
|
+
- Формат: `## Props`, затем `### НазваниеProp` для каждого сложного prop
|
|
140
|
+
|
|
141
|
+
Пример описания сложного prop:
|
|
142
|
+
```md
|
|
143
|
+
## Props
|
|
144
|
+
### `adaptive`
|
|
145
|
+
|
|
146
|
+
Режим адаптивного поведения окна.
|
|
147
|
+
|
|
148
|
+
**Тип:** `'modal' | 'menu' | 'actionSheet' | 'static'`
|
|
149
|
+
|
|
150
|
+
**По умолчанию:** `'modal'`
|
|
151
|
+
|
|
152
|
+
**Возможные значения:**
|
|
153
|
+
- `'modal'` — модальное окно по центру экрана с оверлеем
|
|
154
|
+
- `'menu'` — выпадающее меню, привязанное к элементу управления
|
|
155
|
+
- `'actionSheet'` — нижняя панель для мобильных интерфейсов
|
|
156
|
+
- `'static'` — статичный режим без оверлея и позиционирования
|
|
121
157
|
```
|
|
122
158
|
|
|
123
|
-
|
|
159
|
+
**4. Обязательные секции (если присутствуют в компоненте):**
|
|
124
160
|
|
|
125
|
-
|
|
161
|
+
**Expose методы/свойства:**
|
|
162
|
+
```md
|
|
163
|
+
## Expose методы
|
|
164
|
+
### `methodName`
|
|
165
|
+
|
|
166
|
+
Описание метода.
|
|
167
|
+
|
|
168
|
+
**Тип:** `(param: Type) => ReturnType`
|
|
126
169
|
|
|
127
170
|
**Параметры:**
|
|
128
|
-
- `
|
|
171
|
+
- `param: Type` — описание параметра
|
|
129
172
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
<button @click="onclick">
|
|
134
|
-
{{ open ? 'Закрыть' : 'Открыть' }}
|
|
135
|
-
</button>
|
|
136
|
-
</template>
|
|
137
|
-
</Window>
|
|
173
|
+
**Возвращает:** описание возвращаемого значения
|
|
174
|
+
|
|
175
|
+
[пример кода]
|
|
138
176
|
```
|
|
139
177
|
|
|
140
|
-
|
|
141
|
-
|
|
178
|
+
**Слоты:**
|
|
179
|
+
```md
|
|
180
|
+
## Слоты
|
|
181
|
+
### `slotName`
|
|
142
182
|
|
|
143
|
-
|
|
183
|
+
Описание слота.
|
|
144
184
|
|
|
145
185
|
**Параметры:**
|
|
146
|
-
- `
|
|
186
|
+
- `param: Type` — описание параметра слота
|
|
147
187
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
- `element: HTMLDivElement` — DOM элемент окна
|
|
151
|
-
- `control: HTMLElement` — DOM элемент управления
|
|
152
|
-
- `open: boolean` — состояние открытия окна (`true` - открыто, `false` - закрыто)
|
|
188
|
+
[пример кода]
|
|
189
|
+
```
|
|
153
190
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
console.log('Окно открыто:', options.open)
|
|
159
|
-
console.log('Элемент окна:', options.element)
|
|
160
|
-
console.log('Элемент управления:', options.control)
|
|
161
|
-
}
|
|
162
|
-
</script>
|
|
191
|
+
**События:**
|
|
192
|
+
```md
|
|
193
|
+
## События
|
|
194
|
+
### `eventName`
|
|
163
195
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
196
|
+
Описание события.
|
|
197
|
+
|
|
198
|
+
**Параметры:**
|
|
199
|
+
- `param: Type` — описание параметра события
|
|
200
|
+
|
|
201
|
+
**Структура Type:** (если параметр сложный)
|
|
202
|
+
- `field: string` — описание поля
|
|
203
|
+
- `field2: number` — описание поля
|
|
204
|
+
|
|
205
|
+
[пример кода]
|
|
171
206
|
```
|
|
172
207
|
|
|
208
|
+
**5. Примеры использования:**
|
|
209
|
+
- Добавляй Canvas для демонстрации конкретных сценариев
|
|
210
|
+
- НЕ добавляй базовый `<Canvas of={Component.Component}/>` — он уже есть в начале
|
|
211
|
+
- Формат: `<Canvas of={Component.StoryName}/>`
|
|
173
212
|
|
|
174
|
-
|
|
175
|
-
<Canvas of={Chip.ChipSkeleton}/>
|
|
213
|
+
**Строгие правила форматирования:**
|
|
176
214
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
[types.ts]
|
|
182
|
-
#########
|
|
183
|
-
[ComponentDoc.stories.ts]
|
|
184
|
-
#########
|
|
185
|
-
[UiPlayerLite.mdx]
|
|
215
|
+
- Заголовки уровней:
|
|
216
|
+
- `##` — основные разделы (Props, Expose методы, Слоты, События)
|
|
217
|
+
- `###` — конкретные элементы (названия методов, слотов, событий)
|
|
218
|
+
- `####` — подразделы внутри описания (Поведение, Примеры)
|
|
186
219
|
|
|
187
|
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
- [types.ts] — итоговый блок типов с комментариями (only content, without file name comments).
|
|
192
|
-
- [ComponentDoc.stories.ts] — итоговый файл историй (only content, without file name comments).
|
|
193
|
-
- [UiPlayerLite.mdx] — итоговая MDX-документация (only content, without file name comments).
|
|
220
|
+
- Код:
|
|
221
|
+
- Типы и интерфейсы: ` ```ts `
|
|
222
|
+
- Разметка компонентов: ` ```html ` (НЕ ` ```vue `)
|
|
223
|
+
- Inline код: обёртка в обратные кавычки `` `код` ``
|
|
194
224
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
-
|
|
199
|
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
|
|
205
|
-
|
|
225
|
+
- Meta и StorybookMain:
|
|
226
|
+
- СТРОГО ЗАПРЕЩЕНО трогать блоки Meta и StorybookMain
|
|
227
|
+
- Они должны остаться как есть в начале файла
|
|
228
|
+
- Не добавлять, не удалять, не изменять их
|
|
229
|
+
|
|
230
|
+
- Структурные элементы:
|
|
231
|
+
- Используй `**Жирный текст:**` для подзаголовков внутри описаний
|
|
232
|
+
- Используй `>` для важных замечаний и предупреждений
|
|
233
|
+
- Списки только там, где они улучшают читаемость
|
|
234
|
+
|
|
235
|
+
**Пример полной структуры документа:**
|
|
236
|
+
|
|
237
|
+
```md
|
|
238
|
+
import { Meta, Canvas } from '@storybook/addon-docs/blocks'
|
|
239
|
+
import * as Component from './Component.stories'
|
|
240
|
+
|
|
241
|
+
<Meta of={Component} />
|
|
206
242
|
|
|
207
|
-
====================================
|
|
208
|
-
Пример (не включать в ответ, только как ориентир стиля)
|
|
209
|
-
====================================
|
|
210
243
|
Компонент для создания модальных окон, диалогов и всплывающих элементов с гибким позиционированием и адаптивным поведением.
|
|
211
244
|
|
|
212
245
|
Window управляет отображением контента поверх основного интерфейса, поддерживает различные типы позиционирования (модальные окна, выпадающие меню, action sheets), анимации открытия/закрытия и интеграцию с системой событий. Компонент автоматически обрабатывает клики вне области, управление фокусом и адаптацию под различные размеры экранов.
|
|
@@ -231,6 +264,8 @@ Window управляет отображением контента поверх
|
|
|
231
264
|
|
|
232
265
|
## CSS классы для управления поведением
|
|
233
266
|
|
|
267
|
+
Компонент использует специальные CSS классы для управления поведением:
|
|
268
|
+
|
|
234
269
|
- `*--block` — предотвращает закрытие окна при клике вне его границ
|
|
235
270
|
- `*--blockChildren` — предотвращает закрытие текущего окна
|
|
236
271
|
- `*--blockOther` — предотвращает закрытие других окон до закрытия текущего
|
|
@@ -241,34 +276,20 @@ Window управляет отображением контента поверх
|
|
|
241
276
|
|
|
242
277
|
Где `*` — название класса компонента (например, `d1-window`, `m3-window`).
|
|
243
278
|
|
|
244
|
-
##
|
|
245
|
-
|
|
246
|
-
Компонент Window поддерживает статический режим работы через свойство `staticMode`. В этом режиме окно работает как встроенный компонент без модального поведения:
|
|
247
|
-
|
|
248
|
-
- **Содержимое отображается сразу** — окно не скрывается и не требует активации
|
|
249
|
-
- **Отключены анимации** — нет эффектов появления/исчезновения
|
|
250
|
-
- **Отключено позиционирование** — окно встраивается в поток документа
|
|
251
|
-
- **Работает с adaptive** — когда свойство `adaptive` имеет один из статичных режимов (например, `static`), включается статичный режим
|
|
279
|
+
## Props
|
|
280
|
+
### `adaptive`
|
|
252
281
|
|
|
253
|
-
|
|
282
|
+
Режим адаптивного поведения окна.
|
|
254
283
|
|
|
255
|
-
|
|
284
|
+
**Тип:** `'modal' | 'menu' | 'actionSheet' | 'static'`
|
|
256
285
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
> Применяется только в режиме меню (`adaptive="menu"` или `adaptive="menuWindow"`).
|
|
286
|
+
**По умолчанию:** `'modal'`
|
|
260
287
|
|
|
261
288
|
**Возможные значения:**
|
|
262
|
-
- `'
|
|
263
|
-
- `'
|
|
264
|
-
- `'
|
|
265
|
-
|
|
266
|
-
### Поведение
|
|
267
|
-
|
|
268
|
-
- Компонент автоматически выбирает сторону размещения с наибольшим доступным пространством
|
|
269
|
-
- При использовании контекстного меню (`contextmenu`) позиционирование происходит от координат курсора
|
|
270
|
-
- Окно всегда остается в пределах видимой области экрана (viewport)
|
|
271
|
-
- Отступ от якоря задается через свойство `indent` (по умолчанию 4px)
|
|
289
|
+
- `'modal'` — модальное окно по центру экрана
|
|
290
|
+
- `'menu'` — выпадающее меню, привязанное к элементу
|
|
291
|
+
- `'actionSheet'` — нижняя панель для мобильных устройств
|
|
292
|
+
- `'static'` — статичный режим без оверлея
|
|
272
293
|
|
|
273
294
|
## Управление состоянием через v-model
|
|
274
295
|
|
|
@@ -367,3 +388,62 @@ const handleWindow = (options) => {
|
|
|
367
388
|
</Window>
|
|
368
389
|
</template>
|
|
369
390
|
```
|
|
391
|
+
|
|
392
|
+
## Примеры использования
|
|
393
|
+
### Базовое модальное окно
|
|
394
|
+
|
|
395
|
+
<Canvas of={Component.BasicModal}/>
|
|
396
|
+
|
|
397
|
+
### Выпадающее меню
|
|
398
|
+
|
|
399
|
+
<Canvas of={Component.DropdownMenu}/>
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
====================================
|
|
403
|
+
5) Итоговый возврат
|
|
404
|
+
====================================
|
|
405
|
+
Верни результат СТРОГО в формате (ничего лишнего до или после):
|
|
406
|
+
|
|
407
|
+
[types.ts]
|
|
408
|
+
#########
|
|
409
|
+
[ComponentDoc.stories.ts]
|
|
410
|
+
#########
|
|
411
|
+
[ComponentName.mdx]
|
|
412
|
+
|
|
413
|
+
**Требования к формату вывода:**
|
|
414
|
+
- НЕ добавляй метки файлов типа `// filepath: ...`
|
|
415
|
+
- НЕ оборачивай в блоки кода (` ```ts `, ` ```md `)
|
|
416
|
+
- НЕ добавляй комментарии с названиями файлов
|
|
417
|
+
- НЕ включай в сам результат текст `[types.ts]`, `[ComponentDoc.stories.ts]`, `[ComponentName.mdx]`
|
|
418
|
+
- Только чистый код, разделённый строкой из девяти символов решётки: `#########`
|
|
419
|
+
- Порядок строго: типы → истории → документация
|
|
420
|
+
- Каждый блок начинается с первой строки кода, без пробелов и переносов перед
|
|
421
|
+
|
|
422
|
+
**Структура каждого блока:**
|
|
423
|
+
- `[types.ts]` — итоговый файл типов с JSDoc комментариями (только содержимое файла)
|
|
424
|
+
- `[ComponentDoc.stories.ts]` — итоговый файл историй (только содержимое файла)
|
|
425
|
+
- `[ComponentName.mdx]` — итоговая MDX-документация (только содержимое файла)
|
|
426
|
+
|
|
427
|
+
====================================
|
|
428
|
+
Ограничения и стилистика
|
|
429
|
+
====================================
|
|
430
|
+
|
|
431
|
+
**Запрещено:**
|
|
432
|
+
- Таблицы в любом виде
|
|
433
|
+
- Произвольные дополнительные разделы вне указанных
|
|
434
|
+
- Раздел "Props" для простых свойств без сложной логики
|
|
435
|
+
- Дублирование описаний одного и того же
|
|
436
|
+
- Placeholder'ы вне указанных в промпте (`[code]`, `[types]`, `[stories]`, `[md]`)
|
|
437
|
+
- Использование ` ```vue ` для примеров кода (только ` ```html `)
|
|
438
|
+
- Изменение Meta блока в MDX
|
|
439
|
+
- Добавление базового Canvas (`<Canvas of={Component.Component}/>`)
|
|
440
|
+
|
|
441
|
+
**Обязательно:**
|
|
442
|
+
- Язык документации соответствует [wikiLanguage]
|
|
443
|
+
- Если [wikiLanguage] = "en", используй английский для ВСЕЙ документации
|
|
444
|
+
- Если [wikiLanguage] = "ru", используй русский для ВСЕЙ документации
|
|
445
|
+
- Кодовые блоки: типы и события — ` ```ts `, разметка — ` ```html `
|
|
446
|
+
- Истории: только необходимые сценарии, без визуальных украшений
|
|
447
|
+
- Краткость и информативность без "воды"
|
|
448
|
+
- Технически корректные термины
|
|
449
|
+
- Примеры кода работоспособны и актуальны
|