ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / workbench / contrib / chat / browser / chatPetAchievementsWidget.ts 297 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
import './media/chatPetAchievements.css' ;
import * as DOM from '../../../../base/browser/dom.js' ;
import { status } from '../../../../base/browser/ui/aria/aria.js' ;
import { Button } from '../../../../base/browser/ui/button/button.js' ;
import { DomScrollableElement } from '../../../../base/browser/ui/scrollbar/scrollableElement.js' ;
import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js' ;
import { autorun, observableSignalFromEvent } from '../../../../base/common/observable.js' ;
import { ScrollbarVisibility
localize
ILogService
IThemeService
renderChatPetAchievementPreview
chatPetAchievements ChatPetAccessoryId ChatPetAchievementId getChatPetAccessory getChatPetAchievementPresentation
ChatPetVariant IChatPetService
container HTMLElement
content HTMLElement
scrollable DomScrollableElement
renderDisposables
accessoryCards
unseenAchievementIds
focusTarget
lastDimension Dimension
parent HTMLElement
chatPetService IChatPetService
themeService IThemeService
logService ILogService
container parent
content
scrollable content
horizontal ScrollbarVisibility Hidden
vertical ScrollbarVisibility Auto
container scrollable
content EventType
scrollTop content scrollTop
scrollTop scrollable scrollTop
scrollable scrollTop
passive
themeChanged themeService onDidColorThemeChange
reader
unlockedAchievements chatPetService unlockedAchievements reader
variant chatPetService variant reader
themeChanged reader
unlockedAchievements chatPetService selectedAccessory variant
reader
chatPetService selectedAccessory reader
reader
chatPetService unseenAchievements reader
dimension Dimension
dimension
lastDimension dimension
container style width
container style height
width dimension width container clientWidth
height dimension height container clientHeight
container classList width
content style width
content style height
scrollableNode scrollable
scrollableNode style width
scrollableNode style height
scrollable
focusTarget
unlockedAchievements ChatPetAchievementId selectedAccessory ChatPetAccessoryId variant ChatPetVariant
activeElement
restoreFocusId activeElement activeElement dataset accessoryId
renderDisposables
content
accessoryCards
focusTarget
inner content
inner textContent
inner textContent
unlockedSet unlockedAchievements
collection inner
collection
collection
unlockedAchievements length
chatPetAchievements length
collectionHeader collection
collectionHeader textContent
collectionHeader textContent
unlockedAchievements length
chatPetAchievements length
list collection
cards
noHatId
noHatItem list
noHatSelected selectedAccessory
noHatCard renderDisposables noHatItem
secondary
ariaLabel noHatSelected
noHatCard element classList
noHatCard element dataset accessoryId noHatId
noHatCard element noHatSelected
noHatCard element classList noHatSelected
noHatPreviews noHatCard element
noHatPreviews variant
noHatContent noHatCard element
noHatContent textContent
noHatState noHatContent
noHatState textContent noHatSelected
renderDisposables noHatCard
renderDisposables noHatCard
accessoryCards noHatId
button noHatCard
state noHatState
defaultState
selectedAriaLabel
defaultAriaLabel
cards noHatId noHatCard
achievement chatPetAchievements
unlocked unlockedSet achievement id
presentation achievement unlocked
wearing unlocked achievement accessories accessory selectedAccessory accessory id
item list
accessoryId achievement accessories id
card renderDisposables item
secondary
ariaLabel presentation locked
presentation hint presentation rewardLabels
presentation title presentation accessories label wearing
card element classList
card element dataset accessoryId accessoryId
card element classList unlocked
card element classList wearing
card element wearing
card enabled unlocked
newBadge card element
newBadge textContent
newBadge
previews card element
previewAccessories unlocked achievement accessories achievement accessories
accessory previewAccessories
previews accessory unlocked variant
cardContent card element
presentation locked
cardContent textContent presentation title
state cardContent
state textContent wearing
cardContent textContent presentation description
cardContent textContent presentation accessories accessory accessory label
accessoryCards accessoryId
button card
state
defaultState
selectedAriaLabel achievement title achievement accessories label
defaultAriaLabel achievement title achievement accessories label
achievementId achievement id
newBadge
cardContent textContent
cardContent textContent
cardContent textContent presentation hint
cardContent textContent presentation rewardLabels
renderDisposables card accessoryId achievement id
renderDisposables card
cards accessoryId card
roadmapItem list
roadmapCard roadmapItem
roadmapPreview roadmapCard
roadmapPreview textContent
roadmapContent roadmapCard
roadmapContent textContent
roadmapContent textContent
roadmapIntro roadmapContent
roadmapIntro textContent
roadmapList roadmapContent
item
roadmapList textContent item
experimentalNote inner
experimentalNote textContent
scrollable
lastDimension
chatPetService unseenAchievements
selectedCardId selectedAccessory noHatId
cards selectedCardId
restoreFocusId
_store isDisposed
cards restoreFocusId
previews HTMLElement accessory Parameters renderChatPetAchievementPreview unlocked variant ChatPetVariant
preview previews HTMLCanvasElement
preview width
preview height
preview
renderDisposables preview accessory unlocked variant themeService logService
accessoryId ChatPetAccessoryId achievementId ChatPetAchievementId
achievementId
chatPetService achievementId
accessoryId chatPetService selectedAccessory
chatPetService accessoryId
accessoryId
accessoryId label
accessoryId ChatPetAccessoryId
selectedId accessoryId
id card accessoryCards
wearing id selectedId
card button element classList wearing
card button element wearing
baseAriaLabel wearing card selectedAriaLabel card defaultAriaLabel
card button card achievementId unseenAchievementIds card achievementId
baseAriaLabel
baseAriaLabel
card state textContent wearing card defaultState
accessoryCards selectedId button
achievementIds ChatPetAchievementId
unseenAchievementIds achievementIds
card accessoryCards
card newBadge classList card achievementId unseenAchievementIds card achievementId
chatPetService selectedAccessory
}
from
'../../../../base/common/scrollable.js'
;
import
{
}
from
'../../../../nls.js'
;
import
{
}
from
'../../../../platform/log/common/log.js'
;
import
{
}
from
'../../../../platform/theme/common/themeService.js'
;
import
{
,
CHAT_PET_ACHIEVEMENT_PREVIEW_SIZE
}
from
'./chatPetAchievementPreview.js'
;
import
{
,
,
,
,
}
from
'./chatPetAchievements.js'
;
import
{
,
}
from
'./chatPetService.js'
;
export
class
ChatPetAchievementsWidget
extends
Disposable
{
private
readonly
:
;
private
readonly
:
;
private
readonly
:
;
private
readonly
=
this
.
_register
(
new
DisposableStore
(
)
)
;
private
readonly
=
new
Map< string , {
readonly button: Button;
readonly state: HTMLElement;
readonly defaultState: string ;
readonly selectedAriaLabel: string ;
readonly defaultAriaLabel: string ;
readonly achievementId? : ChatPetAchievementId;
readonly newBadge? : HTMLElement;
} >
(
)
;
private
=
new
Set< ChatPetAchievementId>
(
)
;
private
:
(
(
)
=>
void
)
|
undefined
;
private
:
DOM
.
|
undefined
;
constructor
(
:
,
private
readonly
onDidRequestClose
:
(
)
=>
void
,
@ IChatPetService
private
readonly
:
,
@ IThemeService
private
readonly
:
,
@ ILogService
private
readonly
:
,
)
{
super
(
)
;
this
.
=
DOM
.
append
(
,
DOM
.
$
(
'.chat-pet-achievements-widget'
)
)
;
this
.
=
DOM
.
$
(
'.chat-pet-achievements-content'
)
;
this
.
=
this
.
_register
(
new
DomScrollableElement
(
this
.
,
{
:
.
,
:
.
,
}
)
)
;
this
.
.
appendChild
(
this
.
.
getDomNode
(
)
)
;
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
,
DOM
.
.
SCROLL
,
(
)
=>
{
const
=
this
.
.
;
if
(
!==
this
.
.
getScrollPosition
(
)
.
)
{
this
.
.
setScrollPosition
(
{
}
)
;
}
}
,
{
:
true
}
)
)
;
const
=
observableSignalFromEvent
(
this
,
this
.
.
)
;
this
.
_register
(
autorun
(
=>
{
const
=
this
.
.
.
read
(
)
;
const
=
this
.
.
.
read
(
)
;
.
read
(
)
;
this
.
render
(
,
this
.
.
.
read
(
undefined
)
,
)
;
}
)
)
;
this
.
_register
(
autorun
(
=>
{
this
.
updateSelectedAccessory
(
this
.
.
.
read
(
)
)
;
}
)
)
;
this
.
_register
(
autorun
(
=>
{
this
.
updateNewAchievements
(
this
.
.
.
read
(
)
)
;
}
)
)
;
}
layout
(
?
:
DOM
.
)
:
void
{
if
(
)
{
this
.
=
;
this
.
.
.
=
` ${ dimension. width} px `
;
this
.
.
.
=
` ${ dimension. height} px `
;
}
const
=
?.
??
this
.
.
;
const
=
?.
??
this
.
.
;
this
.
.
.
toggle
(
'narrow'
,
<
560
)
;
this
.
.
.
=
` ${ width} px `
;
this
.
.
.
=
` ${ height} px `
;
const
=
this
.
.
getDomNode
(
)
;
.
.
=
` ${ width} px `
;
.
.
=
` ${ height} px `
;
this
.
.
scanDomNode
(
)
;
}
focus
(
)
:
void
{
this
.
?.
(
)
;
}
private
render
(
:
readonly
[
]
,
:
|
undefined
,
:
)
:
void
{
const
=
DOM
.
getActiveElement
(
)
;
const
=
DOM
.
isHTMLElement
(
)
?
.
closest < HTMLElement>
(
'.chat-pet-achievement-card'
)
?.
.
:
undefined
;
this
.
.
clear
(
)
;
DOM
.
clearNode
(
this
.
)
;
this
.
.
clear
(
)
;
this
.
=
undefined
;
const
=
DOM
.
append
(
this
.
,
DOM
.
$
(
'.chat-pet-achievements-inner'
)
)
;
DOM
.
append
(
,
DOM
.
$
(
'h1'
)
)
.
=
localize
(
'chatPet.achievements.title'
,
"Achievements"
)
;
DOM
.
append
(
,
DOM
.
$
(
'p.chat-pet-achievements-intro'
)
)
.
=
localize
(
'chatPet.achievements.intro'
,
"Unlock hats as you explore agent features, then choose what your pet wears by selecting an unlocked card."
)
;
const
=
new
Set
(
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'section.chat-pet-achievements-collection'
)
)
;
.
setAttribute
(
'role'
,
'region'
)
;
.
setAttribute
(
'aria-label'
,
localize
(
'chatPet.achievements.collectionAriaLabel'
,
"Achievement collection, {0} of {1} unlocked"
,
.
,
.
)
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'.chat-pet-achievements-collection-header'
)
)
;
DOM
.
append
(
,
DOM
.
$
(
'h2'
)
)
.
=
localize
(
'chatPet.achievements.collection'
,
"Collection"
)
;
DOM
.
append
(
,
DOM
.
$
(
'span.chat-pet-achievements-count'
)
)
.
=
localize
(
'chatPet.achievements.count'
,
"{0} of {1} unlocked"
,
.
,
.
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'ul.chat-pet-achievements-list'
)
)
;
const
=
new
Map< string , Button>
(
)
;
const
=
'none'
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'li.chat-pet-achievements-list-item'
)
)
;
const
=
===
undefined
;
const
=
this
.
.
add
(
new
Button
(
,
{
:
true
,
:
?
localize
(
'chatPet.achievement.noHatSelected'
,
"No Hat, selected"
)
:
localize
(
'chatPet.achievement.noHat'
,
"No Hat"
)
,
}
)
)
;
.
.
.
add
(
'chat-pet-achievement-card'
,
'no-hat'
)
;
.
.
.
=
;
.
.
setAttribute
(
'aria-pressed'
,
String
(
)
)
;
.
.
.
toggle
(
'wearing'
,
)
;
const
=
DOM
.
append
(
.
,
DOM
.
$
(
'.chat-pet-achievement-previews'
)
)
;
this
.
renderCardPreview
(
,
undefined
,
true
,
)
;
const
=
DOM
.
append
(
.
,
DOM
.
$
(
'.chat-pet-achievement-card-content'
)
)
;
DOM
.
append
(
,
DOM
.
$
(
'h3'
)
)
.
=
localize
(
'chatPet.achievements.noHat'
,
"No Hat"
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'span.chat-pet-achievement-state'
)
)
;
.
=
?
localize
(
'chatPet.achievement.wearing'
,
"Wearing"
)
:
localize
(
'chatPet.achievement.select'
,
"Select"
)
;
this
.
.
add
(
.
onDidClick
(
(
)
=>
this
.
selectAccessory
(
undefined
)
)
)
;
this
.
.
add
(
.
onDidEscape
(
(
)
=>
this
.
onDidRequestClose
(
)
)
)
;
this
.
.
set
(
,
{
:
,
:
,
:
localize
(
'chatPet.achievement.select'
,
"Select"
)
,
:
localize
(
'chatPet.achievement.noHatSelected'
,
"No Hat, selected"
)
,
:
localize
(
'chatPet.achievement.noHat'
,
"No Hat"
)
,
}
)
;
.
set
(
,
)
;
for
(
const
of
)
{
const
=
.
has
(
.
)
;
const
=
getChatPetAchievementPresentation
(
,
)
;
const
=
&&
.
.
some
(
=>
===
.
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'li.chat-pet-achievements-list-item'
)
)
;
const
=
.
[
0
]
.
;
const
=
this
.
.
add
(
new
Button
(
,
{
:
true
,
:
.
?
localize
(
'chatPet.achievement.lockedAriaLabel'
,
"Locked. Hint: {0} Rewards: {1}."
,
.
,
.
.
join
(
', '
)
)
:
localize
(
'chatPet.achievement.cardAriaLabel'
,
"{0}. Reward: {1}. {2}"
,
.
,
.
[
0
]
.
,
?
localize
(
'chatPet.achievement.wearing'
,
"Wearing"
)
:
localize
(
'chatPet.achievement.unlocked'
,
"Unlocked"
)
)
,
}
)
)
;
.
.
.
add
(
'chat-pet-achievement-card'
)
;
.
.
.
=
;
.
.
.
toggle
(
'locked'
,
!
)
;
.
.
.
toggle
(
'wearing'
,
)
;
.
.
setAttribute
(
'aria-pressed'
,
String
(
)
)
;
.
=
;
const
=
DOM
.
append
(
.
,
DOM
.
$
(
'span.chat-pet-achievement-new-badge.hidden'
)
)
;
.
=
localize
(
'chatPet.achievement.new'
,
"New"
)
;
.
setAttribute
(
'aria-hidden'
,
'true'
)
;
const
=
DOM
.
append
(
.
,
DOM
.
$
(
'.chat-pet-achievement-previews'
)
)
;
const
=
?
.
:
[
.
[
0
]
]
;
for
(
const
of
)
{
this
.
renderCardPreview
(
,
,
,
)
;
}
const
=
DOM
.
append
(
.
,
DOM
.
$
(
'.chat-pet-achievement-card-content'
)
)
;
if
(
!
.
)
{
DOM
.
append
(
,
DOM
.
$
(
'h3'
)
)
.
=
.
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'span.chat-pet-achievement-state'
)
)
;
.
=
?
localize
(
'chatPet.achievement.wearing'
,
"Wearing"
)
:
localize
(
'chatPet.achievement.unlocked'
,
"Unlocked"
)
;
DOM
.
append
(
,
DOM
.
$
(
'p.chat-pet-achievement-description'
)
)
.
=
.
;
DOM
.
append
(
,
DOM
.
$
(
'p.chat-pet-achievement-reward'
)
)
.
=
localize
(
'chatPet.achievement.rewards'
,
"Rewards: {0}"
,
.
.
map
(
=>
.
)
.
join
(
', '
)
)
;
this
.
.
set
(
,
{
:
,
,
:
localize
(
'chatPet.achievement.unlocked'
,
"Unlocked"
)
,
:
localize
(
'chatPet.achievement.cardAriaLabel'
,
"{0}. Reward: {1}. {2}"
,
.
,
.
[
0
]
.
,
localize
(
'chatPet.achievement.wearing'
,
"Wearing"
)
)
,
:
localize
(
'chatPet.achievement.cardAriaLabel'
,
"{0}. Reward: {1}. {2}"
,
.
,
.
[
0
]
.
,
localize
(
'chatPet.achievement.unlocked'
,
"Unlocked"
)
)
,
:
.
,
,
}
)
;
}
else
{
DOM
.
append
(
,
DOM
.
$
(
'h3'
)
)
.
=
localize
(
'chatPet.achievement.locked'
,
"Locked"
)
;
DOM
.
append
(
,
DOM
.
$
(
'span.chat-pet-achievement-state'
)
)
.
=
localize
(
'chatPet.achievement.hint'
,
"Hint"
)
;
DOM
.
append
(
,
DOM
.
$
(
'p.chat-pet-achievement-description'
)
)
.
=
.
;
DOM
.
append
(
,
DOM
.
$
(
'p.chat-pet-achievement-reward'
)
)
.
=
localize
(
'chatPet.achievement.rewards'
,
"Rewards: {0}"
,
.
.
join
(
', '
)
)
;
}
this
.
.
add
(
.
onDidClick
(
(
)
=>
this
.
selectAccessory
(
,
.
)
)
)
;
this
.
.
add
(
.
onDidEscape
(
(
)
=>
this
.
onDidRequestClose
(
)
)
)
;
.
set
(
,
)
;
}
const
=
DOM
.
append
(
,
DOM
.
$
(
'li.chat-pet-achievements-list-item'
)
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'article.chat-pet-achievement-card.chat-pet-achievement-roadmap'
)
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'.chat-pet-achievement-roadmap-preview'
)
)
;
.
=
localize
(
'chatPet.achievements.roadmap.preview'
,
"TBD"
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'.chat-pet-achievement-card-content'
)
)
;
DOM
.
append
(
,
DOM
.
$
(
'h3'
)
)
.
=
localize
(
'chatPet.achievements.roadmap.title'
,
"TBD"
)
;
DOM
.
append
(
,
DOM
.
$
(
'span.chat-pet-achievement-state'
)
)
.
=
localize
(
'chatPet.achievements.roadmap.state'
,
"Coming soon"
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'p.chat-pet-achievement-description'
)
)
;
.
=
localize
(
'chatPet.achievements.roadmap.intro'
,
"Upcoming pet features:"
)
;
const
=
DOM
.
append
(
,
DOM
.
$
(
'ul.chat-pet-achievement-roadmap-list'
)
)
;
for
(
const
of
[
localize
(
'chatPet.achievements.roadmap.namingCompetition'
,
"A naming competition"
)
,
localize
(
'chatPet.achievements.roadmap.moreAchievements'
,
"More achievements and built-in hats"
)
,
localize
(
'chatPet.achievements.roadmap.customHats'
,
"Customizable hats that you can upload"
)
,
]
)
{
DOM
.
append
(
,
DOM
.
$
(
'li'
)
)
.
=
;
}
const
=
DOM
.
append
(
,
DOM
.
$
(
'p.chat-pet-achievements-experimental'
)
)
;
.
=
localize
(
'chatPet.achievements.experimental'
,
"The VS Code pet and achievements are experimental. Features and rewards may change."
)
;
this
.
.
scanDomNode
(
)
;
this
.
layout
(
this
.
)
;
this
.
updateNewAchievements
(
this
.
.
.
read
(
undefined
)
)
;
const
=
??
;
this
.
focusTarget
=
(
)
=>
.
get
(
)
?.
focus
(
)
;
if
(
)
{
queueMicrotask
(
(
)
=>
{
if
(
!
this
.
.
)
{
.
get
(
)
?.
focus
(
)
;
}
}
)
;
}
}
private
renderCardPreview
(
:
,
:
<
typeof
>
[
1
]
,
:
boolean
,
:
)
:
void
{
const
=
DOM
.
append
(
,
DOM
.
$
(
'canvas.chat-pet-achievement-preview'
)
)
as
;
.
=
CHAT_PET_ACHIEVEMENT_PREVIEW_SIZE
;
.
=
CHAT_PET_ACHIEVEMENT_PREVIEW_SIZE
;
.
setAttribute
(
'aria-hidden'
,
'true'
)
;
this
.
.
add
(
renderChatPetAchievementPreview
(
,
,
,
,
this
.
,
this
.
)
)
;
}
private
selectAccessory
(
:
|
undefined
,
?
:
)
:
void
{
if
(
)
{
this
.
.
markAchievementSeen
(
)
;
}
if
(
===
this
.
.
.
get
(
)
)
{
return
;
}
this
.
.
setAccessory
(
)
;
status
(
===
undefined
?
localize
(
'chatPet.achievements.hatRemoved'
,
"VS Code pet hat removed"
)
:
localize
(
'chatPet.achievements.hatSelected'
,
"VS Code pet is now wearing {0}"
,
getChatPetAccessory
(
)
.
)
)
;
}
private
updateSelectedAccessory
(
:
|
undefined
)
:
void
{
const
=
??
'none'
;
for
(
const
[
,
]
of
this
.
)
{
const
=
===
;
.
.
.
.
toggle
(
'wearing'
,
)
;
.
.
.
setAttribute
(
'aria-pressed'
,
String
(
)
)
;
const
=
?
.
:
.
;
.
.
setAriaLabel
(
.
&&
this
.
.
has
(
.
)
?
localize
(
'chatPet.achievement.cardNewAriaLabel'
,
"{0}. New"
,
)
:
)
;
.
.
=
?
localize
(
'chatPet.achievement.wearing'
,
"Wearing"
)
:
.
;
}
this
.
focusTarget
=
(
)
=>
this
.
.
get
(
)
?.
.
focus
(
)
;
}
private
updateNewAchievements
(
:
readonly
[
]
)
:
void
{
this
.
=
new
Set
(
)
;
for
(
const
of
this
.
.
values
(
)
)
{
.
?.
.
toggle
(
'hidden'
,
!
.
||
!
this
.
.
has
(
.
)
)
;
}
this
.
updateSelectedAccessory
(
this
.
.
.
read
(
undefined
)
)
;
}
}