@dxtmisha/scripts 0.4.7 → 0.5.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/bin/ai-doc.ts +9 -0
- package/package.json +9 -7
- package/src/classes/Ai/AiAbstract.ts +94 -13
- package/src/classes/Ai/AiDoc.ts +62 -0
- package/src/classes/Ai/AiDocItem.ts +20 -0
- package/src/classes/Ai/AiDocItemAbstract.ts +198 -0
- package/src/classes/Ai/AiDocItemClasses.ts +20 -0
- package/src/classes/Ai/AiDocItemComposables.ts +13 -0
- package/src/classes/Ai/AiDocType.ts +45 -0
- package/src/classes/Ai/AiGoogle.ts +7 -29
- package/src/classes/Ai/AiGoogleCli.ts +24 -0
- package/src/classes/Ai/AiGoogleCliLite.ts +144 -0
- package/src/classes/Ai/AiGoogleLite.ts +77 -0
- package/src/classes/BuildItem.ts +176 -0
- package/src/classes/Component/ComponentCreator.ts +2 -0
- package/src/classes/Component/ComponentItem.ts +3 -1
- package/src/classes/Component/ComponentWiki.ts +107 -190
- package/src/classes/Component/ComponentWikiFile.ts +102 -15
- package/src/classes/Design/DesignCommand.ts +3 -1
- package/src/classes/Design/DesignComponent.ts +3 -1
- package/src/classes/Design/DesignConstructor.ts +3 -1
- package/src/classes/Design/DesignConstructors.ts +3 -1
- package/src/classes/Design/DesignReplace.ts +3 -1
- package/src/classes/Design/DesignStructure.ts +3 -1
- package/src/classes/Design/DesignStructureClasses.ts +3 -1
- package/src/classes/Design/DesignStructureItemAbstract.ts +2 -0
- package/src/classes/Design/DesignStructureRead.ts +3 -1
- package/src/classes/Design/DesignStructureStyles.ts +2 -0
- package/src/classes/Design/DesignTypescript.ts +1 -1
- package/src/classes/Design/DesignUi.ts +3 -1
- package/src/classes/Design/DesignWiki.ts +3 -1
- package/src/classes/Git/GitRead.ts +258 -0
- package/src/classes/Library/LibraryExport.ts +2 -0
- package/src/classes/Library/LibraryFlags.ts +3 -1
- package/src/classes/Library/LibraryItems.ts +3 -1
- package/src/classes/Library/LibraryMedia.ts +3 -1
- package/src/classes/Package/PackageInit.ts +2 -0
- package/src/classes/Package/PackageItem.ts +2 -0
- package/src/classes/Properties/Properties.ts +3 -1
- package/src/classes/Properties/PropertiesCache.ts +3 -1
- package/src/classes/Properties/PropertiesConfig.ts +21 -0
- package/src/classes/Properties/PropertiesConvector.ts +3 -1
- package/src/classes/Properties/PropertiesFile.ts +11 -1
- package/src/classes/Properties/PropertiesImport.ts +3 -1
- package/src/classes/Properties/PropertiesItems.ts +3 -1
- package/src/classes/Properties/PropertiesKeys.ts +3 -1
- package/src/classes/Properties/PropertiesMain.ts +3 -1
- package/src/classes/Properties/PropertiesPalette.ts +3 -1
- package/src/classes/Properties/PropertiesPath.ts +3 -1
- package/src/classes/Properties/PropertiesScss.ts +3 -1
- package/src/classes/Properties/PropertiesSeparator.ts +3 -1
- package/src/classes/Properties/PropertiesSettings.ts +3 -1
- package/src/classes/Properties/PropertiesStandard.ts +3 -1
- package/src/classes/Properties/PropertiesTool.ts +3 -1
- package/src/classes/Properties/PropertiesTypes.ts +3 -1
- package/src/classes/Properties/PropertiesValues.ts +2 -0
- package/src/classes/Properties/PropertiesWrap.ts +3 -1
- package/src/classes/Properties/convector/convectorColor.ts +2 -0
- package/src/classes/Properties/convector/convectorFontFamilies.ts +2 -0
- package/src/classes/Properties/convector/convectorShadow.ts +3 -1
- package/src/classes/Properties/convector/convectorTypography.ts +3 -1
- package/src/classes/Properties/to/PropertiesToAbstract.ts +2 -0
- package/src/classes/Properties/to/PropertiesToAnimate.ts +3 -1
- package/src/classes/Properties/to/PropertiesToClass.ts +2 -0
- package/src/classes/Properties/to/PropertiesToClone.ts +3 -1
- package/src/classes/Properties/to/PropertiesToComponent.ts +2 -0
- package/src/classes/Properties/to/PropertiesToDrag.ts +3 -1
- package/src/classes/Properties/to/PropertiesToDuplicate.ts +3 -1
- package/src/classes/Properties/to/PropertiesToFull.ts +2 -0
- package/src/classes/Properties/to/PropertiesToLink.ts +3 -1
- package/src/classes/Properties/to/PropertiesToMedia.ts +3 -1
- package/src/classes/Properties/to/PropertiesToMulti.ts +3 -1
- package/src/classes/Properties/to/PropertiesToNone.ts +3 -1
- package/src/classes/Properties/to/PropertiesToPalette.ts +3 -1
- package/src/classes/Properties/to/PropertiesToProperty.ts +3 -1
- package/src/classes/Properties/to/PropertiesToRemove.ts +3 -1
- package/src/classes/Properties/to/PropertiesToReplace.ts +2 -0
- package/src/classes/Properties/to/PropertiesToRoot.ts +2 -0
- package/src/classes/Properties/to/PropertiesToSimilar.ts +3 -1
- package/src/classes/Properties/to/PropertiesToSort.ts +3 -1
- package/src/classes/Properties/to/PropertiesToState.ts +3 -1
- package/src/classes/Properties/to/PropertiesToStyle.ts +3 -1
- package/src/classes/Properties/to/PropertiesToSub.ts +2 -0
- package/src/classes/Properties/to/PropertiesToSubclass.ts +2 -0
- package/src/classes/Properties/to/PropertiesToVar.ts +3 -1
- package/src/classes/Properties/to/PropertiesToVariable.ts +3 -1
- package/src/classes/Styles/Styles.ts +3 -1
- package/src/classes/Styles/StylesClasses.ts +3 -1
- package/src/classes/Styles/StylesProperties.ts +2 -0
- package/src/classes/Styles/StylesRoot.ts +2 -0
- package/src/classes/Styles/StylesTool.ts +3 -1
- package/src/classes/Styles/to/StylesToAbstract.ts +3 -1
- package/src/classes/Styles/to/StylesToAnimate.ts +2 -0
- package/src/classes/Styles/to/StylesToClass.ts +2 -0
- package/src/classes/Styles/to/StylesToClassFull.ts +2 -0
- package/src/classes/Styles/to/StylesToContainer.ts +2 -0
- package/src/classes/Styles/to/StylesToMedia.ts +2 -0
- package/src/classes/Styles/to/StylesToProperty.ts +3 -1
- package/src/classes/Styles/to/StylesToRoot.ts +2 -0
- package/src/classes/Styles/to/StylesToSelector.ts +3 -1
- package/src/classes/Styles/to/StylesToVar.ts +3 -1
- package/src/classes/Styles/to/StylesToVirtual.ts +2 -0
- package/src/composables/useAi.ts +3 -0
- package/src/config.ts +11 -0
- package/src/functions/getComponentPaths.ts +2 -0
- package/src/functions/getConfigAi.ts +13 -0
- package/src/functions/getConstructorProperties.ts +3 -1
- package/src/functions/getNameDirByPaths.ts +2 -0
- package/src/functions/toPathStandardSep.ts +2 -0
- package/src/library-ai.ts +3 -0
- package/src/library.ts +2 -89
- package/src/media/ai/ai-doc-types.ts +21 -0
- package/src/media/properties/css.ts +4 -1
- package/src/media/properties/listSort.ts +1 -1
- package/src/media/properties/style.ts +2 -0
- package/src/media/templates/component/DesignComponent.vue +1 -1
- package/src/media/templates/constructors/ConstructorsDesign.tsx +4 -2
- package/src/media/templates/packages/library/package.json +2 -1
- package/src/media/templates/prompts/aiDocClassPrompt.en.txt +66 -0
- package/src/media/templates/prompts/aiDocClassPrompt.ru.txt +64 -0
- package/src/media/templates/prompts/aiDocComposablePrompt.en.txt +67 -0
- package/src/media/templates/prompts/aiDocComposablePrompt.ru.txt +67 -0
- package/src/media/templates/prompts/aiDocFunctionPrompt.en.txt +57 -0
- package/src/media/templates/prompts/aiDocFunctionPrompt.ru.txt +57 -0
- package/src/media/templates/prompts/componentPrompt.en.txt +105 -0
- package/src/media/templates/prompts/componentPrompt.ru.txt +105 -0
- package/src/media/templates/prompts/demoClassEn.mdx +111 -0
- package/src/media/templates/prompts/demoClassRu.mdx +111 -0
- package/src/media/templates/prompts/demoComponentEn.mdx +282 -0
- package/src/media/templates/prompts/demoComponentRu.mdx +282 -0
- package/src/media/templates/prompts/demoComposableEn.mdx +103 -0
- package/src/media/templates/prompts/demoComposableRu.mdx +103 -0
- package/src/media/templates/prompts/demoDocEn.mdx +30 -0
- package/src/media/templates/prompts/demoDocRu.mdx +30 -0
- package/src/media/templates/viteComponentTemplateConfig.ts +1 -1
- package/src/types/aiTypes.ts +19 -0
- package/src/types/configTypes.ts +8 -2
- package/src/types/gitTypes.ts +59 -0
- package/src/media/templates/componentPrompt.en.txt +0 -541
- package/src/media/templates/componentPrompt.ru.txt +0 -539
|
@@ -1,541 +0,0 @@
|
|
|
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, Vue 3 Composition API.
|
|
3
|
-
|
|
4
|
-
Canvas component is imported from '@storybook/addon-docs/blocks'
|
|
5
|
-
|
|
6
|
-
====================================
|
|
7
|
-
1) Study the current component code
|
|
8
|
-
====================================
|
|
9
|
-
```
|
|
10
|
-
[code]
|
|
11
|
-
```
|
|
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
|
|
21
|
-
|
|
22
|
-
====================================
|
|
23
|
-
2) Add missing type comments
|
|
24
|
-
====================================
|
|
25
|
-
Add brief single-language (in [wikiLanguage]) JSDoc comments to missing types and their properties.
|
|
26
|
-
|
|
27
|
-
Code to fix:
|
|
28
|
-
```ts
|
|
29
|
-
// types.ts
|
|
30
|
-
[types]
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Comment requirements:
|
|
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):
|
|
42
|
-
```ts
|
|
43
|
-
/**
|
|
44
|
-
* Basic properties for image components.
|
|
45
|
-
*/
|
|
46
|
-
export interface IconPropsBasic<
|
|
47
|
-
Image extends ImagePropsBasic = ImagePropsBasic
|
|
48
|
-
> extends SkeletonPropsInclude {
|
|
49
|
-
// Status
|
|
50
|
-
/** Active state of the icon */
|
|
51
|
-
active?: boolean
|
|
52
|
-
|
|
53
|
-
// Icon
|
|
54
|
-
/** Main icon value */
|
|
55
|
-
icon?: ImageValue<Image>
|
|
56
|
-
/** Active icon value */
|
|
57
|
-
iconActive?: ImageValue<Image>
|
|
58
|
-
|
|
59
|
-
// Design
|
|
60
|
-
/**
|
|
61
|
-
* Icon size
|
|
62
|
-
* @default 'medium'
|
|
63
|
-
*/
|
|
64
|
-
size?: 'small' | 'medium' | 'large'
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
====================================
|
|
69
|
-
3) Stories for Storybook
|
|
70
|
-
====================================
|
|
71
|
-
Create minimum necessary examples. Each story demonstrates a specific usage scenario.
|
|
72
|
-
|
|
73
|
-
Code to fix:
|
|
74
|
-
```ts
|
|
75
|
-
// ComponentDoc.stories.ts
|
|
76
|
-
[stories]
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Rules:
|
|
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
|
-
```
|
|
106
|
-
|
|
107
|
-
====================================
|
|
108
|
-
4) MDX documentation (component description)
|
|
109
|
-
====================================
|
|
110
|
-
Prepare complete component description in MDX format. Strict style: no tables, no extra sections, only necessary information.
|
|
111
|
-
|
|
112
|
-
Code to fix:
|
|
113
|
-
```md
|
|
114
|
-
// ComponentName.mdx
|
|
115
|
-
[md]
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Document structure (strict):
|
|
119
|
-
|
|
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
|
|
123
|
-
|
|
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
|
|
131
|
-
|
|
132
|
-
**3. Special sections (if present):**
|
|
133
|
-
|
|
134
|
-
Instead of simply listing Props, describe **specific component capabilities**.
|
|
135
|
-
|
|
136
|
-
Each section should:
|
|
137
|
-
- Have a second-level heading (`##`) describing the capability, not just the prop name
|
|
138
|
-
- Briefly explain the purpose and behavior of the functionality
|
|
139
|
-
- List related properties (if there are several)
|
|
140
|
-
- Describe property interaction with each other and their effect on the component
|
|
141
|
-
- Include usage examples with code
|
|
142
|
-
|
|
143
|
-
**Capability description format:**
|
|
144
|
-
|
|
145
|
-
```md
|
|
146
|
-
## Capability Name
|
|
147
|
-
|
|
148
|
-
Brief description of the capability and its purpose (1-2 paragraphs).
|
|
149
|
-
|
|
150
|
-
**Properties:** (if several related properties)
|
|
151
|
-
|
|
152
|
-
- `propName` — property description
|
|
153
|
-
- `propName2` — property description
|
|
154
|
-
|
|
155
|
-
**Possible values:** (for enum/union types)
|
|
156
|
-
|
|
157
|
-
- `'value1'` — value description and its behavior
|
|
158
|
-
- `'value2'` — value description and its behavior
|
|
159
|
-
|
|
160
|
-
Additional description of behavior, property interaction, features, and limitations.
|
|
161
|
-
|
|
162
|
-
[code examples]
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
**Examples of correct capability descriptions:**
|
|
166
|
-
|
|
167
|
-
```md
|
|
168
|
-
## Header Position Animation
|
|
169
|
-
|
|
170
|
-
The `animationHeadPosition` property defines the behavior of the Head area during show/hide animations.
|
|
171
|
-
|
|
172
|
-
**Possible values:**
|
|
173
|
-
|
|
174
|
-
- `'top'` — keeps Head at the top during transition (default)
|
|
175
|
-
- `'toBottom'` — animates Head down along with content
|
|
176
|
-
|
|
177
|
-
Synchronizes header movement with content animation using CSS transforms for smooth transitions.
|
|
178
|
-
|
|
179
|
-
[code example]
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
```md
|
|
183
|
-
## Navigation and Arrows
|
|
184
|
-
|
|
185
|
-
Properties `arrowCarousel`, `arrowStepper`, `disabledPrevious`, `disabledNext`, and `align` are designed for managing built-in navigation elements and content alignment.
|
|
186
|
-
|
|
187
|
-
**Properties:**
|
|
188
|
-
|
|
189
|
-
- `arrowCarousel` — enables navigation arrows (left/right) for switching elements
|
|
190
|
-
- `arrowStepper` — enables numeric step buttons (minus/plus)
|
|
191
|
-
- `disabledPrevious` — disables left button (back/minus)
|
|
192
|
-
- `disabledNext` — disables right button (forward/plus)
|
|
193
|
-
- `align` — horizontal content alignment (`left`, `center`, `right`)
|
|
194
|
-
|
|
195
|
-
Properties work together: only one arrow mode is active — if `arrowCarousel = true`, `arrowStepper` mode is ignored and vice versa.
|
|
196
|
-
|
|
197
|
-
[code example]
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
```md
|
|
201
|
-
## Outline Buttons
|
|
202
|
-
|
|
203
|
-
Button component supports outline mode via the `outline` property. In this mode, buttons have a minimalist visual style with transparent background and colored border:
|
|
204
|
-
|
|
205
|
-
- **Minimalist design** - suitable for interfaces requiring reduced visual load
|
|
206
|
-
- **Transparent background** - maintains clean appearance while remaining interactive
|
|
207
|
-
- **Hover feedback** - background appears on hover for better user interaction
|
|
208
|
-
|
|
209
|
-
Outline mode is especially useful for creating tertiary actions and secondary options.
|
|
210
|
-
|
|
211
|
-
[code example]
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
**When NOT to describe Props in separate sections:**
|
|
215
|
-
|
|
216
|
-
- Simple boolean/string/number properties without complex logic — JSDoc comments in types are sufficient
|
|
217
|
-
- Properties with obvious behavior (e.g., `disabled`, `label`, `placeholder`)
|
|
218
|
-
- Single independent properties without interaction with others
|
|
219
|
-
|
|
220
|
-
**When to describe capabilities in separate sections:**
|
|
221
|
-
|
|
222
|
-
- Properties with complex interaction logic (e.g., `cancel` and `cancelShow`)
|
|
223
|
-
- Groups of related properties working together (e.g., navigation arrows)
|
|
224
|
-
- Properties with multiple operation modes (e.g., `adaptive` with different values)
|
|
225
|
-
- Properties affecting other component parts or having priority over others
|
|
226
|
-
- Component display modes (e.g., `primary`, `secondary`, `outline`)
|
|
227
|
-
- CSS classes for behavior control
|
|
228
|
-
|
|
229
|
-
**4. Mandatory sections (if present in component):**
|
|
230
|
-
|
|
231
|
-
**Expose methods/properties:**
|
|
232
|
-
```md
|
|
233
|
-
## Expose Methods
|
|
234
|
-
### `methodName`
|
|
235
|
-
|
|
236
|
-
Method description.
|
|
237
|
-
|
|
238
|
-
**Type:** `(param: Type) => ReturnType`
|
|
239
|
-
|
|
240
|
-
**Parameters:**
|
|
241
|
-
- `param: Type` — parameter description
|
|
242
|
-
|
|
243
|
-
**Returns:** return value description
|
|
244
|
-
|
|
245
|
-
[code example]
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
**Slots:**
|
|
249
|
-
```md
|
|
250
|
-
## Slots
|
|
251
|
-
### `slotName`
|
|
252
|
-
|
|
253
|
-
Slot description.
|
|
254
|
-
|
|
255
|
-
**Parameters:**
|
|
256
|
-
- `param: Type` — slot parameter description
|
|
257
|
-
|
|
258
|
-
[code example]
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
**Events:**
|
|
262
|
-
```md
|
|
263
|
-
## Events
|
|
264
|
-
### `eventName`
|
|
265
|
-
|
|
266
|
-
Event description.
|
|
267
|
-
|
|
268
|
-
**Parameters:**
|
|
269
|
-
- `param: Type` — event parameter description
|
|
270
|
-
|
|
271
|
-
**Type structure:** (if parameter is complex)
|
|
272
|
-
- `field: string` — field description
|
|
273
|
-
- `field2: number` — field description
|
|
274
|
-
|
|
275
|
-
[code example]
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
**5. Usage examples:**
|
|
279
|
-
- Add Canvas to demonstrate specific scenarios
|
|
280
|
-
- DO NOT add base `<Canvas of={Component.Component}/>` — it's already at the beginning
|
|
281
|
-
- Format: `<Canvas of={Component.StoryName}/>`
|
|
282
|
-
|
|
283
|
-
**Strict formatting rules:**
|
|
284
|
-
|
|
285
|
-
- Heading levels:
|
|
286
|
-
- `##` — main sections (Props, Expose Methods, Slots, Events)
|
|
287
|
-
- `###` — specific elements (method, slot, event names)
|
|
288
|
-
- `####` — subsections within description (Behavior, Examples)
|
|
289
|
-
|
|
290
|
-
- Code:
|
|
291
|
-
- Types and interfaces: ` ```ts `
|
|
292
|
-
- Component markup: ` ```html ` (NOT ` ```vue `)
|
|
293
|
-
- Inline code: wrap in backticks `` `code` ``
|
|
294
|
-
|
|
295
|
-
- Meta and StorybookMain:
|
|
296
|
-
- STRICTLY FORBIDDEN to touch Meta and StorybookMain blocks
|
|
297
|
-
- They must remain as is at the beginning of the file
|
|
298
|
-
- Don't add, don't delete, don't modify them
|
|
299
|
-
|
|
300
|
-
- Structural elements:
|
|
301
|
-
- Use `**Bold text:**` for subheadings within descriptions
|
|
302
|
-
- Use `>` for important notes and warnings
|
|
303
|
-
- Lists only where they improve readability
|
|
304
|
-
|
|
305
|
-
**Example of full document structure:**
|
|
306
|
-
|
|
307
|
-
```md
|
|
308
|
-
import { Meta, Canvas } from '@storybook/addon-docs/blocks'
|
|
309
|
-
import * as Component from './Component.stories'
|
|
310
|
-
|
|
311
|
-
<Meta of={Component} />
|
|
312
|
-
|
|
313
|
-
Component for creating modal windows, dialogs, and popup elements with flexible positioning and adaptive behavior.
|
|
314
|
-
|
|
315
|
-
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.
|
|
316
|
-
|
|
317
|
-
**Key Features:**
|
|
318
|
-
|
|
319
|
-
- Flexible positioning (center, edges, screen corners)
|
|
320
|
-
- Adaptive modes (modal, menu, actionSheet, static)
|
|
321
|
-
- Open/close animations with origin configuration
|
|
322
|
-
- State management via v-model or expose methods
|
|
323
|
-
- Scrollbar integration for scrollable content
|
|
324
|
-
- Background interaction blocking (persistent mode)
|
|
325
|
-
- Window lifecycle events
|
|
326
|
-
|
|
327
|
-
**Typical Use Cases:**
|
|
328
|
-
|
|
329
|
-
- Modal windows for forms and confirmations
|
|
330
|
-
- Dropdown menus and context menus
|
|
331
|
-
- Side panels and drawer components
|
|
332
|
-
- Action sheets for mobile interfaces
|
|
333
|
-
- Tooltips and dialogs
|
|
334
|
-
|
|
335
|
-
## CSS Classes for Behavior Control
|
|
336
|
-
|
|
337
|
-
Component uses special CSS classes for behavior control:
|
|
338
|
-
|
|
339
|
-
- `*--block` — prevents window from closing when clicking outside its boundaries
|
|
340
|
-
- `*--blockChildren` — prevents current window from closing
|
|
341
|
-
- `*--blockOther` — prevents other windows from closing until current one is closed
|
|
342
|
-
- `*--close` — applies to elements for closing the window
|
|
343
|
-
- `*--controlOpenOnly` — applies to control elements that only open the window
|
|
344
|
-
- `*--controlStatic` — applies to control elements in static mode
|
|
345
|
-
- `*--static` — applies to elements inside window, canceling all actions
|
|
346
|
-
|
|
347
|
-
Where `*` is the component class name (e.g., `d1-window`, `m3-window`).
|
|
348
|
-
|
|
349
|
-
## Header Position Animation
|
|
350
|
-
|
|
351
|
-
The `animationHeadPosition` property defines the behavior of the Head area during show/hide animations.
|
|
352
|
-
|
|
353
|
-
**Possible values:**
|
|
354
|
-
|
|
355
|
-
- `'top'` — keeps Head at the top during transition (default)
|
|
356
|
-
- `'toBottom'` — animates Head down along with content
|
|
357
|
-
|
|
358
|
-
Synchronizes header movement with content animation using CSS transforms for smooth transitions.
|
|
359
|
-
|
|
360
|
-
```html
|
|
361
|
-
<template>
|
|
362
|
-
<Window v-model:open="isOpen" :animationHeadPosition="'toBottom'">
|
|
363
|
-
<template #default>
|
|
364
|
-
<p>Window content</p>
|
|
365
|
-
<button @click="isOpen = false">Close</button>
|
|
366
|
-
</template>
|
|
367
|
-
</Window>
|
|
368
|
-
</template>
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
## Navigation and Arrows
|
|
372
|
-
|
|
373
|
-
Properties `arrowCarousel`, `arrowStepper`, `disabledPrevious`, `disabledNext`, and `align` are designed for managing built-in navigation elements and content alignment.
|
|
374
|
-
|
|
375
|
-
**Properties:**
|
|
376
|
-
|
|
377
|
-
- `arrowCarousel` — enables navigation arrows (left/right) for switching elements
|
|
378
|
-
- `arrowStepper` — enables numeric step buttons (minus/plus)
|
|
379
|
-
- `disabledPrevious` — disables left button (back/minus)
|
|
380
|
-
- `disabledNext` — disables right button (forward/plus)
|
|
381
|
-
- `align` — horizontal content alignment (`left`, `center`, `right`)
|
|
382
|
-
|
|
383
|
-
Properties work together: only one arrow mode is active — if `arrowCarousel = true`, `arrowStepper` mode is ignored and vice versa.
|
|
384
|
-
|
|
385
|
-
```html
|
|
386
|
-
<template>
|
|
387
|
-
<Window v-model:open="isOpen" :arrowCarousel="true" :align="'center'">
|
|
388
|
-
<template #default>
|
|
389
|
-
<p>Window content</p>
|
|
390
|
-
<button @click="isOpen = false">Close</button>
|
|
391
|
-
</template>
|
|
392
|
-
</Window>
|
|
393
|
-
</template>
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
## Outline Buttons
|
|
397
|
-
|
|
398
|
-
Button component supports outline mode via the `outline` property. In this mode, buttons have a minimalist visual style with transparent background and colored border:
|
|
399
|
-
|
|
400
|
-
- **Minimalist design** - suitable for interfaces requiring reduced visual load
|
|
401
|
-
- **Transparent background** - maintains clean appearance while remaining interactive
|
|
402
|
-
- **Hover feedback** - background appears on hover for better user interaction
|
|
403
|
-
|
|
404
|
-
Outline mode is especially useful for creating tertiary actions and secondary options.
|
|
405
|
-
|
|
406
|
-
```html
|
|
407
|
-
<template>
|
|
408
|
-
<Button outline @click="handleClick">Click me</Button>
|
|
409
|
-
</template>
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
## Expose Methods
|
|
413
|
-
### `id`
|
|
414
|
-
|
|
415
|
-
Unique window identifier.
|
|
416
|
-
|
|
417
|
-
**Type:** `string`
|
|
418
|
-
|
|
419
|
-
```html
|
|
420
|
-
<script setup>
|
|
421
|
-
const windowRef = ref()
|
|
422
|
-
|
|
423
|
-
onMounted(() => {
|
|
424
|
-
console.log(windowRef.value.id) // "window-123"
|
|
425
|
-
})
|
|
426
|
-
</script>
|
|
427
|
-
|
|
428
|
-
<template>
|
|
429
|
-
<Window ref="windowRef" />
|
|
430
|
-
</template>
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
## Slots
|
|
434
|
-
### `control`
|
|
435
|
-
|
|
436
|
-
Slot for placing window control elements (close buttons, minimize, etc.).
|
|
437
|
-
|
|
438
|
-
**Parameters:**
|
|
439
|
-
- `props: WindowControlItem` — object with window control data
|
|
440
|
-
|
|
441
|
-
```html
|
|
442
|
-
<Window>
|
|
443
|
-
<template #control="{ onclick, open }">
|
|
444
|
-
<button @click="onclick">
|
|
445
|
-
{{ open ? 'Close' : 'Open' }}
|
|
446
|
-
</button>
|
|
447
|
-
</template>
|
|
448
|
-
</Window>
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
## Events
|
|
452
|
-
### `window`
|
|
453
|
-
|
|
454
|
-
Event fires when the window state changes (open/close).
|
|
455
|
-
|
|
456
|
-
**Parameters:**
|
|
457
|
-
- `options: WindowEmitOptions` — object with window data
|
|
458
|
-
|
|
459
|
-
**WindowEmitOptions structure:**
|
|
460
|
-
- `id: string` — unique window identifier
|
|
461
|
-
- `element: HTMLDivElement` — window DOM element
|
|
462
|
-
- `control: HTMLElement` — control DOM element
|
|
463
|
-
- `open: boolean` — window open state (`true` - open, `false` - closed)
|
|
464
|
-
|
|
465
|
-
```html
|
|
466
|
-
<script setup>
|
|
467
|
-
const handleWindow = (options) => {
|
|
468
|
-
console.log('Window ID:', options.id)
|
|
469
|
-
console.log('Window open:', options.open)
|
|
470
|
-
console.log('Window element:', options.element)
|
|
471
|
-
console.log('Control element:', options.control)
|
|
472
|
-
}
|
|
473
|
-
</script>
|
|
474
|
-
|
|
475
|
-
<template>
|
|
476
|
-
<Window @window="handleWindow">
|
|
477
|
-
<template #default>
|
|
478
|
-
<p>Window content</p>
|
|
479
|
-
</template>
|
|
480
|
-
</Window>
|
|
481
|
-
</template>
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
## Usage Examples
|
|
485
|
-
### Basic Modal Window
|
|
486
|
-
|
|
487
|
-
<Canvas of={Component.BasicModal}/>
|
|
488
|
-
|
|
489
|
-
### Dropdown Menu
|
|
490
|
-
|
|
491
|
-
<Canvas of={Component.DropdownMenu}/>
|
|
492
|
-
```
|
|
493
|
-
|
|
494
|
-
====================================
|
|
495
|
-
5) Final return
|
|
496
|
-
====================================
|
|
497
|
-
Return the result STRICTLY in the format (nothing extra before or after):
|
|
498
|
-
|
|
499
|
-
[types.ts]
|
|
500
|
-
#########
|
|
501
|
-
[ComponentDoc.stories.ts]
|
|
502
|
-
#########
|
|
503
|
-
[ComponentName.mdx]
|
|
504
|
-
|
|
505
|
-
**Output format requirements:**
|
|
506
|
-
- DO NOT add file labels like `// filepath: ...`
|
|
507
|
-
- DO NOT wrap in code blocks (` ```ts `, ` ```md `)
|
|
508
|
-
- DO NOT add comments with file names
|
|
509
|
-
- DO NOT include in the result text `[types.ts]`, `[ComponentDoc.stories.ts]`, `[ComponentName.mdx]`
|
|
510
|
-
- Only clean code, separated by a line of nine hash symbols: `#########`
|
|
511
|
-
- Order strictly: types → stories → documentation
|
|
512
|
-
- Each block starts with the first line of code, without spaces and line breaks before
|
|
513
|
-
|
|
514
|
-
**Structure of each block:**
|
|
515
|
-
- `[types.ts]` — final types file with JSDoc comments (only file content)
|
|
516
|
-
- `[ComponentDoc.stories.ts]` — final stories file (only file content)
|
|
517
|
-
- `[ComponentName.mdx]` — final MDX documentation (only file content)
|
|
518
|
-
|
|
519
|
-
====================================
|
|
520
|
-
Constraints and style
|
|
521
|
-
====================================
|
|
522
|
-
|
|
523
|
-
**Forbidden:**
|
|
524
|
-
- Tables in any form
|
|
525
|
-
- Arbitrary additional sections outside specified ones
|
|
526
|
-
- "Props" section for simple properties without complex logic
|
|
527
|
-
- Duplication of descriptions of the same thing
|
|
528
|
-
- Placeholders outside those specified in prompt (`[code]`, `[types]`, `[stories]`, `[md]`)
|
|
529
|
-
- Using ` ```vue ` for code examples (only ` ```html `)
|
|
530
|
-
- Changing Meta block in MDX
|
|
531
|
-
- Adding base Canvas (`<Canvas of={Component.Component}/>`)
|
|
532
|
-
|
|
533
|
-
**Required:**
|
|
534
|
-
- Documentation language corresponds to [wikiLanguage]
|
|
535
|
-
- If [wikiLanguage] = "en", use English for ALL documentation
|
|
536
|
-
- If [wikiLanguage] = "ru", use Russian for ALL documentation
|
|
537
|
-
- Code blocks: types and events — ` ```ts `, markup — ` ```html `
|
|
538
|
-
- Stories: only necessary scenarios, without visual decorations
|
|
539
|
-
- Brevity and informativeness without "fluff"
|
|
540
|
-
- Technically correct terms
|
|
541
|
-
- Code examples are functional and up-to-date
|