@stacksjs/stx-vscode 0.2.351
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/LICENSE.md +21 -0
- package/README.md +33 -0
- package/dist/assets/languages/stx.configuration.json +67 -0
- package/dist/assets/snippets/stx-components.json +11 -0
- package/dist/assets/snippets/stx-directives.json +74 -0
- package/dist/assets/snippets/stx.json +479 -0
- package/dist/assets/syntaxes/stx.tmLanguage.json +441 -0
- package/dist/contributes.json +168 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +6985 -0
- package/package.json +48 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Stacks.js
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @stacksjs/stx-vscode
|
|
2
|
+
|
|
3
|
+
stx language support for VS Code extensions to embed: the hovers, completions, diagnostics, go to definition, folding, semantic tokens, utility-class previews, grammar, snippets and language configuration behind the [stx extension](https://marketplace.visualstudio.com/items?itemName=Stacks.vscode-stx).
|
|
4
|
+
|
|
5
|
+
It is built from the extension's own source, `packages/vscode/src`, so the extension and every extension embedding this package run the same code. The Stacks extension (`Stacks.vscode-stacks`) is the embedder it was made for.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { join } from 'node:path'
|
|
11
|
+
import { activateStxLanguage, STX_EXTENSION_ID } from '@stacksjs/stx-vscode'
|
|
12
|
+
import * as vscode from 'vscode'
|
|
13
|
+
|
|
14
|
+
export async function activate(context: vscode.ExtensionContext) {
|
|
15
|
+
await activateStxLanguage(context, {
|
|
16
|
+
// Copy node_modules/@stacksjs/stx-vscode/dist/assets here when you build.
|
|
17
|
+
assetsPath: join(context.extensionPath, 'dist', 'stx'),
|
|
18
|
+
// The stx extension contributes the snippets itself; offer them only without it.
|
|
19
|
+
snippets: !vscode.extensions.getExtension(STX_EXTENSION_ID),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
// The stx extension stands down when it sees this from Stacks.vscode-stacks.
|
|
23
|
+
return { stx: { active: true } }
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The static half has to be in your extension's manifest, because VS Code reads grammars and language configurations only from there. `@stacksjs/stx-vscode/contributes.json` holds the `languages`, `grammars`, `snippets`, `commands` and `configuration` entries, with paths relative to `dist/assets`. Leave `snippets` out of the manifest and pass `snippets: true` instead if your extension can be installed next to the stx extension, or every snippet shows up twice.
|
|
28
|
+
|
|
29
|
+
`vscode`, `prettier` and `@stacksjs/ts-css` are imported, not bundled: bundle the library into your extension.
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"comments": {
|
|
3
|
+
"blockComment": [
|
|
4
|
+
"{{--",
|
|
5
|
+
"--}}"
|
|
6
|
+
]
|
|
7
|
+
},
|
|
8
|
+
"wordPattern": "(@[a-zA-Z_][a-zA-Z0-9_]*)|([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
9
|
+
"brackets": [
|
|
10
|
+
[
|
|
11
|
+
"{",
|
|
12
|
+
"}"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"[",
|
|
16
|
+
"]"
|
|
17
|
+
],
|
|
18
|
+
[
|
|
19
|
+
"(",
|
|
20
|
+
")"
|
|
21
|
+
]
|
|
22
|
+
],
|
|
23
|
+
"autoClosingPairs": [
|
|
24
|
+
[
|
|
25
|
+
"{",
|
|
26
|
+
"}"
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
"[",
|
|
30
|
+
"]"
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
"(",
|
|
34
|
+
")"
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
"\"",
|
|
38
|
+
"\""
|
|
39
|
+
],
|
|
40
|
+
[
|
|
41
|
+
"'",
|
|
42
|
+
"'"
|
|
43
|
+
]
|
|
44
|
+
],
|
|
45
|
+
"surroundingPairs": [
|
|
46
|
+
[
|
|
47
|
+
"{",
|
|
48
|
+
"}"
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
"[",
|
|
52
|
+
"]"
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
"(",
|
|
56
|
+
")"
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
"\"",
|
|
60
|
+
"\""
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"'",
|
|
64
|
+
"'"
|
|
65
|
+
]
|
|
66
|
+
]
|
|
67
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"stx If Directive": {
|
|
3
|
+
"prefix": "@if",
|
|
4
|
+
"body": [
|
|
5
|
+
"@if($1)",
|
|
6
|
+
" $2",
|
|
7
|
+
"@endif"
|
|
8
|
+
],
|
|
9
|
+
"description": "Create an @if directive block"
|
|
10
|
+
},
|
|
11
|
+
"stx If-Else Directive": {
|
|
12
|
+
"prefix": "@ifelse",
|
|
13
|
+
"body": [
|
|
14
|
+
"@if($1)",
|
|
15
|
+
" $2",
|
|
16
|
+
"@else",
|
|
17
|
+
" $3",
|
|
18
|
+
"@endif"
|
|
19
|
+
],
|
|
20
|
+
"description": "Create an @if-@else directive block"
|
|
21
|
+
},
|
|
22
|
+
"stx Foreach Directive": {
|
|
23
|
+
"prefix": "@foreach",
|
|
24
|
+
"body": [
|
|
25
|
+
"@foreach($1 as $2)",
|
|
26
|
+
" $3",
|
|
27
|
+
"@endforeach"
|
|
28
|
+
],
|
|
29
|
+
"description": "Create a @foreach loop"
|
|
30
|
+
},
|
|
31
|
+
"stx For Directive": {
|
|
32
|
+
"prefix": "@for",
|
|
33
|
+
"body": [
|
|
34
|
+
"@for($1; $2; $3)",
|
|
35
|
+
" $4",
|
|
36
|
+
"@endfor"
|
|
37
|
+
],
|
|
38
|
+
"description": "Create a @for loop"
|
|
39
|
+
},
|
|
40
|
+
"stx While Directive": {
|
|
41
|
+
"prefix": "@while",
|
|
42
|
+
"body": [
|
|
43
|
+
"@while($1)",
|
|
44
|
+
" $2",
|
|
45
|
+
"@endwhile"
|
|
46
|
+
],
|
|
47
|
+
"description": "Create a @while loop"
|
|
48
|
+
},
|
|
49
|
+
"stx Section Directive": {
|
|
50
|
+
"prefix": "@section",
|
|
51
|
+
"body": [
|
|
52
|
+
"@section('$1')",
|
|
53
|
+
" $2",
|
|
54
|
+
"@endsection"
|
|
55
|
+
],
|
|
56
|
+
"description": "Create a @section block"
|
|
57
|
+
},
|
|
58
|
+
"stx Include Directive": {
|
|
59
|
+
"prefix": "@include",
|
|
60
|
+
"body": [
|
|
61
|
+
"@include('$1'${2:, ['$3' => $4]})"
|
|
62
|
+
],
|
|
63
|
+
"description": "Include a template"
|
|
64
|
+
},
|
|
65
|
+
"stx Component Directive": {
|
|
66
|
+
"prefix": "@component",
|
|
67
|
+
"body": [
|
|
68
|
+
"@component('$1'${2:, ['$3' => $4]})",
|
|
69
|
+
" $5",
|
|
70
|
+
"@endcomponent"
|
|
71
|
+
],
|
|
72
|
+
"description": "Create a @component block"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
{
|
|
2
|
+
"stx-comment": {
|
|
3
|
+
"description": "stx comment block",
|
|
4
|
+
"prefix": "{{--",
|
|
5
|
+
"body": [
|
|
6
|
+
"{{-- $1 --}}$0"
|
|
7
|
+
]
|
|
8
|
+
},
|
|
9
|
+
"stx-raw": {
|
|
10
|
+
"description": "Displays content without processing expressions",
|
|
11
|
+
"prefix": "@raw",
|
|
12
|
+
"body": [
|
|
13
|
+
"@raw",
|
|
14
|
+
"\t$0",
|
|
15
|
+
"@endraw"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"stx-markdown": {
|
|
19
|
+
"description": "Render markdown content as HTML",
|
|
20
|
+
"prefix": "@markdown",
|
|
21
|
+
"body": [
|
|
22
|
+
"@markdown",
|
|
23
|
+
"\t$0",
|
|
24
|
+
"@endmarkdown"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"stx-verbatim": {
|
|
28
|
+
"description": "Displays content without processing directives",
|
|
29
|
+
"prefix": "@verbatim",
|
|
30
|
+
"body": [
|
|
31
|
+
"@verbatim",
|
|
32
|
+
"\t$0",
|
|
33
|
+
"@endverbatim"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"stx-ts": {
|
|
37
|
+
"description": "Embeds TypeScript code block",
|
|
38
|
+
"prefix": "@ts",
|
|
39
|
+
"body": [
|
|
40
|
+
"@ts",
|
|
41
|
+
"\t$0",
|
|
42
|
+
"@endts"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"stx-js": {
|
|
46
|
+
"description": "Embeds JavaScript code block",
|
|
47
|
+
"prefix": "@js",
|
|
48
|
+
"body": [
|
|
49
|
+
"@js",
|
|
50
|
+
"\t$0",
|
|
51
|
+
"@endjs"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"stx-component": {
|
|
55
|
+
"description": "Include a component with props",
|
|
56
|
+
"prefix": "@component",
|
|
57
|
+
"body": [
|
|
58
|
+
"@component('${1:name}', { ${2:props} })$0"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"stx-webcomponent": {
|
|
62
|
+
"description": "Include a web component",
|
|
63
|
+
"prefix": "@webcomponent",
|
|
64
|
+
"body": [
|
|
65
|
+
"@webcomponent('${1:name}')$0"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"stx-translate": {
|
|
69
|
+
"description": "Translate a string using the i18n system",
|
|
70
|
+
"prefix": "@translate",
|
|
71
|
+
"body": [
|
|
72
|
+
"@translate('${1:key}', { ${2:params} })$0"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"stx-t": {
|
|
76
|
+
"description": "Short alias for translate directive",
|
|
77
|
+
"prefix": "@t",
|
|
78
|
+
"body": [
|
|
79
|
+
"@t('${1:key}', { ${2:params} })$0"
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"stx-if": {
|
|
83
|
+
"description": "Conditional if statement",
|
|
84
|
+
"prefix": "@if",
|
|
85
|
+
"body": [
|
|
86
|
+
"@if(${1:condition})",
|
|
87
|
+
"\t$0",
|
|
88
|
+
"@endif"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"stx-if-else": {
|
|
92
|
+
"description": "Conditional if-else statement",
|
|
93
|
+
"prefix": "@if-else",
|
|
94
|
+
"body": [
|
|
95
|
+
"@if(${1:condition})",
|
|
96
|
+
"\t$2",
|
|
97
|
+
"@else",
|
|
98
|
+
"\t$0",
|
|
99
|
+
"@endif"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"stx-elseif": {
|
|
103
|
+
"description": "Else-if conditional branch",
|
|
104
|
+
"prefix": "@elseif",
|
|
105
|
+
"body": [
|
|
106
|
+
"@elseif(${1:condition})$0"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"stx-unless": {
|
|
110
|
+
"description": "Inverse of if statement",
|
|
111
|
+
"prefix": "@unless",
|
|
112
|
+
"body": [
|
|
113
|
+
"@unless(${1:condition})",
|
|
114
|
+
"\t$0",
|
|
115
|
+
"@endunless"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"stx-for": {
|
|
119
|
+
"description": "Traditional for loop",
|
|
120
|
+
"prefix": "@for",
|
|
121
|
+
"body": [
|
|
122
|
+
"@for(${1:let i = 0}; ${2:i < items.length}; ${3:i++})",
|
|
123
|
+
"\t$0",
|
|
124
|
+
"@endfor"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"stx-foreach": {
|
|
128
|
+
"description": "Loop through items using forEach",
|
|
129
|
+
"prefix": "@foreach",
|
|
130
|
+
"body": [
|
|
131
|
+
"@foreach(${1:items} as ${2:item}${3:, ${4:index}})",
|
|
132
|
+
"\t$0",
|
|
133
|
+
"@endforeach"
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"stx-while": {
|
|
137
|
+
"description": "While loop statement",
|
|
138
|
+
"prefix": "@while",
|
|
139
|
+
"body": [
|
|
140
|
+
"@while(${1:condition})",
|
|
141
|
+
"\t$0",
|
|
142
|
+
"@endwhile"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
"stx-switch": {
|
|
146
|
+
"description": "Switch statement",
|
|
147
|
+
"prefix": "@switch",
|
|
148
|
+
"body": [
|
|
149
|
+
"@switch(${1:value})",
|
|
150
|
+
"\t@case(${2:option1})",
|
|
151
|
+
"\t\t$3",
|
|
152
|
+
"\t\t@break",
|
|
153
|
+
"\t@case(${4:option2})",
|
|
154
|
+
"\t\t$5",
|
|
155
|
+
"\t\t@break",
|
|
156
|
+
"\t@default",
|
|
157
|
+
"\t\t$0",
|
|
158
|
+
"@endswitch"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"stx-case": {
|
|
162
|
+
"description": "Case for switch statement",
|
|
163
|
+
"prefix": "@case",
|
|
164
|
+
"body": [
|
|
165
|
+
"@case(${1:value})",
|
|
166
|
+
"\t$0",
|
|
167
|
+
"\t@break"
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
"stx-default": {
|
|
171
|
+
"description": "Default case for switch statement",
|
|
172
|
+
"prefix": "@default",
|
|
173
|
+
"body": [
|
|
174
|
+
"@default",
|
|
175
|
+
"\t$0"
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
"stx-break": {
|
|
179
|
+
"description": "Break from loop or switch",
|
|
180
|
+
"prefix": "@break",
|
|
181
|
+
"body": [
|
|
182
|
+
"@break$0"
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
"stx-continue": {
|
|
186
|
+
"description": "Continue to next iteration in a loop",
|
|
187
|
+
"prefix": "@continue",
|
|
188
|
+
"body": [
|
|
189
|
+
"@continue$0"
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
"stx-include": {
|
|
193
|
+
"description": "Include a partial template",
|
|
194
|
+
"prefix": "@include",
|
|
195
|
+
"body": [
|
|
196
|
+
"@include('${1:template}')$0"
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"stx-extends": {
|
|
200
|
+
"description": "Extend a base layout",
|
|
201
|
+
"prefix": "@extends",
|
|
202
|
+
"body": [
|
|
203
|
+
"@extends('${1:layout}')$0"
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
"stx-section": {
|
|
207
|
+
"description": "Define a content section",
|
|
208
|
+
"prefix": "@section",
|
|
209
|
+
"body": [
|
|
210
|
+
"@section('${1:name}')",
|
|
211
|
+
"\t$0",
|
|
212
|
+
"@endsection"
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
"stx-yield": {
|
|
216
|
+
"description": "Output the contents of a section",
|
|
217
|
+
"prefix": "@yield",
|
|
218
|
+
"body": [
|
|
219
|
+
"@yield('${1:section}')$0"
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
"stx-transition": {
|
|
223
|
+
"description": "Apply transition animations to an element",
|
|
224
|
+
"prefix": "@transition",
|
|
225
|
+
"body": [
|
|
226
|
+
"@transition('${1|fade,slide,scale,flip,rotate,custom|}', ${2:400}, '${3|ease,ease-in,ease-out,ease-in-out,linear|}', ${4:0}, '${5|in,out,both|}')",
|
|
227
|
+
"\t$0",
|
|
228
|
+
"@endtransition"
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
"stx-motion": {
|
|
232
|
+
"description": "Control animation display based on user preferences",
|
|
233
|
+
"prefix": "@motion",
|
|
234
|
+
"body": [
|
|
235
|
+
"@motion(${1|true,false|})",
|
|
236
|
+
"\t$0",
|
|
237
|
+
"@endmotion"
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
"stx-animation-group": {
|
|
241
|
+
"description": "Group elements for coordinated animations",
|
|
242
|
+
"prefix": "@animationGroup",
|
|
243
|
+
"body": [
|
|
244
|
+
"@animationGroup('${1:groupName}'${2:, '${3:#selector1}'${4:, '${5:#selector2}'${6:, '${7:#selector3}'}}})"
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
"stx-scroll-animate": {
|
|
248
|
+
"description": "Trigger animation when element scrolls into view",
|
|
249
|
+
"prefix": "@scrollAnimate",
|
|
250
|
+
"body": [
|
|
251
|
+
"@scrollAnimate('${1|fade,slide,scale,flip,rotate,custom|}', ${2:400}, '${3|ease,ease-in,ease-out,ease-in-out,linear|}', ${4:0.2}, ${5:0})",
|
|
252
|
+
"\t$0",
|
|
253
|
+
"@endscrollAnimate"
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
"stx-css": {
|
|
257
|
+
"description": "Embed CSS code block",
|
|
258
|
+
"prefix": "@css",
|
|
259
|
+
"body": [
|
|
260
|
+
"@css",
|
|
261
|
+
"\t$0",
|
|
262
|
+
"@endcss"
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
"stx-json": {
|
|
266
|
+
"description": "Output variable as JSON",
|
|
267
|
+
"prefix": "@json",
|
|
268
|
+
"body": [
|
|
269
|
+
"@json(${1:variable})$0"
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
"stx-env": {
|
|
273
|
+
"description": "Check environment condition",
|
|
274
|
+
"prefix": "@env",
|
|
275
|
+
"body": [
|
|
276
|
+
"@env('${1:environment}')",
|
|
277
|
+
"\t$0",
|
|
278
|
+
"@endenv"
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
"stx-locale": {
|
|
282
|
+
"description": "Set locale for content",
|
|
283
|
+
"prefix": "@locale",
|
|
284
|
+
"body": [
|
|
285
|
+
"@locale('${1:en}')$0"
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
"stx-echo": {
|
|
289
|
+
"description": "Echo variable with escaping",
|
|
290
|
+
"prefix": "{{",
|
|
291
|
+
"body": [
|
|
292
|
+
"{{ ${1:variable} }}$0"
|
|
293
|
+
]
|
|
294
|
+
},
|
|
295
|
+
"stx-echo-raw": {
|
|
296
|
+
"description": "Echo variable without escaping",
|
|
297
|
+
"prefix": "{!!",
|
|
298
|
+
"body": [
|
|
299
|
+
"{!! ${1:variable} !!}$0"
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
"stx-echo-triple": {
|
|
303
|
+
"description": "Echo variable with triple braces",
|
|
304
|
+
"prefix": "{{{",
|
|
305
|
+
"body": [
|
|
306
|
+
"{{{ ${1:variable} }}}$0"
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
"stx-component-block": {
|
|
310
|
+
"description": "Include a component with block content",
|
|
311
|
+
"prefix": "@component-block",
|
|
312
|
+
"body": [
|
|
313
|
+
"@component('${1:name}', { ${2:props} })",
|
|
314
|
+
"\t$0",
|
|
315
|
+
"@endcomponent"
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
"stx-slot": {
|
|
319
|
+
"description": "Define a named slot in a component",
|
|
320
|
+
"prefix": "@slot",
|
|
321
|
+
"body": [
|
|
322
|
+
"@slot('${1:name}')",
|
|
323
|
+
"\t$0",
|
|
324
|
+
"@endslot"
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
"stx-form": {
|
|
328
|
+
"description": "HTML form with submit handler",
|
|
329
|
+
"prefix": "stx-form",
|
|
330
|
+
"body": [
|
|
331
|
+
"<form @submit.prevent=\"${1:handleSubmit}\">",
|
|
332
|
+
"\t$0",
|
|
333
|
+
"\t<button type=\"submit\">${2:Submit}</button>",
|
|
334
|
+
"</form>"
|
|
335
|
+
]
|
|
336
|
+
},
|
|
337
|
+
"stx-input": {
|
|
338
|
+
"description": "Form input element with binding",
|
|
339
|
+
"prefix": "stx-input",
|
|
340
|
+
"body": [
|
|
341
|
+
"<input type=\"${1|text,email,password,number,tel,url,date|}\" name=\"${2:name}\" @bind=\"${3:value}\" placeholder=\"${4:placeholder}\" />"
|
|
342
|
+
]
|
|
343
|
+
},
|
|
344
|
+
"stx-layout": {
|
|
345
|
+
"description": "Basic HTML layout with stx structure",
|
|
346
|
+
"prefix": "stx-layout",
|
|
347
|
+
"body": [
|
|
348
|
+
"<!DOCTYPE html>",
|
|
349
|
+
"<html lang=\"${1:en}\">",
|
|
350
|
+
"<head>",
|
|
351
|
+
"\t<meta charset=\"UTF-8\">",
|
|
352
|
+
"\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
|
|
353
|
+
"\t<title>${2:Title}</title>",
|
|
354
|
+
"\t<style>",
|
|
355
|
+
"\t\t$3",
|
|
356
|
+
"\t</style>",
|
|
357
|
+
"</head>",
|
|
358
|
+
"<body>",
|
|
359
|
+
"\t$0",
|
|
360
|
+
"\t<script>",
|
|
361
|
+
"\t\tmodule.exports = {",
|
|
362
|
+
"\t\t\t// component data here",
|
|
363
|
+
"\t\t};",
|
|
364
|
+
"\t</script>",
|
|
365
|
+
"</body>",
|
|
366
|
+
"</html>"
|
|
367
|
+
]
|
|
368
|
+
},
|
|
369
|
+
"stx-once": {
|
|
370
|
+
"description": "Include content only once per rendering cycle",
|
|
371
|
+
"prefix": "@once",
|
|
372
|
+
"body": [
|
|
373
|
+
"@once",
|
|
374
|
+
"\t$0",
|
|
375
|
+
"@endonce"
|
|
376
|
+
]
|
|
377
|
+
},
|
|
378
|
+
"stx-csrf": {
|
|
379
|
+
"description": "Include CSRF protection token",
|
|
380
|
+
"prefix": "@csrf",
|
|
381
|
+
"body": [
|
|
382
|
+
"@csrf$0"
|
|
383
|
+
]
|
|
384
|
+
},
|
|
385
|
+
"stx-method": {
|
|
386
|
+
"description": "Specify form submission method",
|
|
387
|
+
"prefix": "@method",
|
|
388
|
+
"body": [
|
|
389
|
+
"@method('${1|GET,POST,PUT,PATCH,DELETE|}')$0"
|
|
390
|
+
]
|
|
391
|
+
},
|
|
392
|
+
"stx-auth": {
|
|
393
|
+
"description": "Content only visible to authenticated users",
|
|
394
|
+
"prefix": "@auth",
|
|
395
|
+
"body": [
|
|
396
|
+
"@auth",
|
|
397
|
+
"\t$0",
|
|
398
|
+
"@endauth"
|
|
399
|
+
]
|
|
400
|
+
},
|
|
401
|
+
"stx-guest": {
|
|
402
|
+
"description": "Content only visible to guests (non-authenticated users)",
|
|
403
|
+
"prefix": "@guest",
|
|
404
|
+
"body": [
|
|
405
|
+
"@guest",
|
|
406
|
+
"\t$0",
|
|
407
|
+
"@endguest"
|
|
408
|
+
]
|
|
409
|
+
},
|
|
410
|
+
"stx Template": {
|
|
411
|
+
"prefix": "stx",
|
|
412
|
+
"body": [
|
|
413
|
+
"<template>",
|
|
414
|
+
" $1",
|
|
415
|
+
"</template>",
|
|
416
|
+
"",
|
|
417
|
+
"<script>",
|
|
418
|
+
"export default {",
|
|
419
|
+
" name: '$2',",
|
|
420
|
+
" props: {",
|
|
421
|
+
" $3",
|
|
422
|
+
" },",
|
|
423
|
+
" setup(props) {",
|
|
424
|
+
" $4",
|
|
425
|
+
" return {",
|
|
426
|
+
" $5",
|
|
427
|
+
" }",
|
|
428
|
+
" }",
|
|
429
|
+
"}",
|
|
430
|
+
"</script>"
|
|
431
|
+
],
|
|
432
|
+
"description": "Create a new stx template"
|
|
433
|
+
},
|
|
434
|
+
"stx Component": {
|
|
435
|
+
"prefix": "stxc",
|
|
436
|
+
"body": [
|
|
437
|
+
"<template>",
|
|
438
|
+
" <div class=\"$1\">",
|
|
439
|
+
" $2",
|
|
440
|
+
" </div>",
|
|
441
|
+
"</template>",
|
|
442
|
+
"",
|
|
443
|
+
"<script>",
|
|
444
|
+
"export default {",
|
|
445
|
+
" name: '$3',",
|
|
446
|
+
" props: {",
|
|
447
|
+
" $4",
|
|
448
|
+
" }",
|
|
449
|
+
"}",
|
|
450
|
+
"</script>"
|
|
451
|
+
],
|
|
452
|
+
"description": "Create a new stx component"
|
|
453
|
+
},
|
|
454
|
+
"stx Layout": {
|
|
455
|
+
"prefix": "stxl",
|
|
456
|
+
"body": [
|
|
457
|
+
"<template>",
|
|
458
|
+
" <div class=\"layout\">",
|
|
459
|
+
" <header>",
|
|
460
|
+
" $1",
|
|
461
|
+
" </header>",
|
|
462
|
+
" <main>",
|
|
463
|
+
" $2",
|
|
464
|
+
" </main>",
|
|
465
|
+
" <footer>",
|
|
466
|
+
" $3",
|
|
467
|
+
" </footer>",
|
|
468
|
+
" </div>",
|
|
469
|
+
"</template>",
|
|
470
|
+
"",
|
|
471
|
+
"<script>",
|
|
472
|
+
"export default {",
|
|
473
|
+
" name: '$4'",
|
|
474
|
+
"}",
|
|
475
|
+
"</script>"
|
|
476
|
+
],
|
|
477
|
+
"description": "Create a new stx layout"
|
|
478
|
+
}
|
|
479
|
+
}
|