@aws/mynah-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +4 -0
- package/CONTRIBUTING.md +59 -0
- package/LICENSE +175 -0
- package/NOTICE +1 -0
- package/README.md +187 -0
- package/THIRD-PARTY-LICENSES +27 -0
- package/dist/components/button.d.ts +20 -0
- package/dist/components/context-item.d.ts +16 -0
- package/dist/components/feedback-form/feedback-form-comment.d.ts +15 -0
- package/dist/components/feedback-form/feedback-form-stars.d.ts +15 -0
- package/dist/components/feedback-form/feedback-form.d.ts +22 -0
- package/dist/components/icon.d.ts +51 -0
- package/dist/components/main-container.d.ts +29 -0
- package/dist/components/notification/notification.d.ts +48 -0
- package/dist/components/overlay/overlay.d.ts +82 -0
- package/dist/components/prioritization-menu.d.ts +18 -0
- package/dist/components/search-block/autocomplete-card.d.ts +20 -0
- package/dist/components/search-block/autocomplete-content.d.ts +33 -0
- package/dist/components/search-block/search-api-help.d.ts +38 -0
- package/dist/components/search-block/search-card-header.d.ts +14 -0
- package/dist/components/search-block/search-card.d.ts +74 -0
- package/dist/components/search-block/search-context.d.ts +31 -0
- package/dist/components/search-block/search-history-card.d.ts +16 -0
- package/dist/components/search-block/search-history-content.d.ts +20 -0
- package/dist/components/search-block/search-input.d.ts +36 -0
- package/dist/components/search-block/search-live-toggle.d.ts +18 -0
- package/dist/components/suggestion-card/suggestion-card-body.d.ts +15 -0
- package/dist/components/suggestion-card/suggestion-card-context-wrapper.d.ts +12 -0
- package/dist/components/suggestion-card/suggestion-card-header.d.ts +19 -0
- package/dist/components/suggestion-card/suggestion-card-relevance-vote.d.ts +16 -0
- package/dist/components/suggestion-card/suggestion-card.d.ts +27 -0
- package/dist/components/syntax-highlighter.d.ts +38 -0
- package/dist/components/toggle.d.ts +27 -0
- package/dist/helper/config.d.ts +15 -0
- package/dist/helper/context-manager.d.ts +34 -0
- package/dist/helper/date-time.d.ts +12 -0
- package/dist/helper/dom.d.ts +52 -0
- package/dist/helper/find-language.d.ts +17 -0
- package/dist/helper/guid.d.ts +5 -0
- package/dist/main.d.ts +26 -0
- package/dist/main.js +3 -0
- package/dist/main.js.LICENSE.txt +13 -0
- package/dist/main.js.map +1 -0
- package/dist/static.d.ts +276 -0
- package/dist/translations/en.d.ts +9 -0
- package/dist/translations/i18n.d.ts +13 -0
- package/package.json +62 -0
package/dist/static.d.ts
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
export interface ServiceConnector {
|
|
6
|
+
liveSearchHandler?: (searchPayload?: SearchPayload, suggestions?: Suggestion[]) => void;
|
|
7
|
+
liveSearchStateExternalChangeHandler?: (state: LiveSearchState) => void;
|
|
8
|
+
uiReady: () => void;
|
|
9
|
+
once: () => Promise<Suggestion[]>;
|
|
10
|
+
requestSuggestions: (searchPayload: SearchPayload, isFromHistory?: boolean, isFromAutocomplete?: boolean) => Promise<Suggestion[] | undefined>;
|
|
11
|
+
updateVoteOfSuggestion: (suggestion: Suggestion, vote: RelevancyVoteType) => void;
|
|
12
|
+
clickCodeDetails: (code: string, fileName?: string, range?: {
|
|
13
|
+
start: {
|
|
14
|
+
row: string;
|
|
15
|
+
column?: string;
|
|
16
|
+
};
|
|
17
|
+
end?: {
|
|
18
|
+
row: string;
|
|
19
|
+
column?: string;
|
|
20
|
+
};
|
|
21
|
+
}) => void;
|
|
22
|
+
recordContextChange: (changeType: ContextChangeType, queryContext: ContextType) => void;
|
|
23
|
+
triggerSuggestionEngagement: (engagement: SuggestionEngagement) => void;
|
|
24
|
+
triggerSuggestionClipboardInteraction: (suggestionId: string, type?: string, text?: string) => void;
|
|
25
|
+
triggerSuggestionEvent: (eventName: SuggestionEventName, suggestion: Suggestion) => void;
|
|
26
|
+
sendFeedback: (feedbackPayload: FeedbackPayload) => void;
|
|
27
|
+
requestHistoryRecords: (filterPayload: SearchHistoryFilters) => Promise<SearchHistoryItem[]>;
|
|
28
|
+
requestAutocomplete: (input: string) => Promise<AutocompleteItem[]>;
|
|
29
|
+
toggleLiveSearch?: (liveSearchState: LiveSearchState, onFeedReceived: (searchPayload?: SearchPayload, suggestions?: Suggestion[]) => void) => void;
|
|
30
|
+
clickAutocompleteSuggestionItem: (text: string, currSelected?: number, suggestionCount?: number) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface StateManager {
|
|
33
|
+
getState: () => Record<string, any>;
|
|
34
|
+
setState: (state: Record<string, any>) => void;
|
|
35
|
+
}
|
|
36
|
+
export declare const MynahEventNames: {
|
|
37
|
+
CONTEXT_VISIBILITY_CHANGE: string;
|
|
38
|
+
REMOVE_ALL_CONTEXT: string;
|
|
39
|
+
};
|
|
40
|
+
export declare const MynahPortalNames: {
|
|
41
|
+
WRAPPER: string;
|
|
42
|
+
OVERLAY: string;
|
|
43
|
+
FEEDBACK_FORM: string;
|
|
44
|
+
};
|
|
45
|
+
export interface SearchPayloadMatchPolicy {
|
|
46
|
+
must: string[];
|
|
47
|
+
should: string[];
|
|
48
|
+
mustNot: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface SearchPayloadCodeSelection {
|
|
51
|
+
selectedCode: string;
|
|
52
|
+
file?: {
|
|
53
|
+
range: {
|
|
54
|
+
start: {
|
|
55
|
+
row: string;
|
|
56
|
+
column: string;
|
|
57
|
+
};
|
|
58
|
+
end: {
|
|
59
|
+
row: string;
|
|
60
|
+
column: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
name: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface SearchPayloadCodeQuery {
|
|
67
|
+
simpleNames: string[];
|
|
68
|
+
usedFullyQualifiedNames: string[];
|
|
69
|
+
}
|
|
70
|
+
export interface SearchPayload {
|
|
71
|
+
query: string;
|
|
72
|
+
matchPolicy: SearchPayloadMatchPolicy;
|
|
73
|
+
codeSelection: SearchPayloadCodeSelection;
|
|
74
|
+
codeQuery?: SearchPayloadCodeQuery;
|
|
75
|
+
}
|
|
76
|
+
export interface SuggestionMetaData {
|
|
77
|
+
site: string;
|
|
78
|
+
stars?: number;
|
|
79
|
+
forks?: number;
|
|
80
|
+
answers?: number;
|
|
81
|
+
isAccepted?: boolean;
|
|
82
|
+
upVotes?: number;
|
|
83
|
+
lastActivityDate?: number;
|
|
84
|
+
}
|
|
85
|
+
export interface Suggestion {
|
|
86
|
+
id: string;
|
|
87
|
+
title: string;
|
|
88
|
+
url: string;
|
|
89
|
+
body: string;
|
|
90
|
+
context: string[];
|
|
91
|
+
type?: string;
|
|
92
|
+
metaData?: SuggestionMetaData;
|
|
93
|
+
}
|
|
94
|
+
export declare enum KeyMap {
|
|
95
|
+
ESCAPE = "Escape",
|
|
96
|
+
ENTER = "Enter",
|
|
97
|
+
BACKSPACE = "Backspace",
|
|
98
|
+
DELETE = "Delete",
|
|
99
|
+
ARROW_UP = "ArrowUp",
|
|
100
|
+
ARROW_DOWN = "ArrowDown",
|
|
101
|
+
ARROW_LEFT = "ArrowLeft",
|
|
102
|
+
ARROW_RIGHT = "ArrowRight",
|
|
103
|
+
PAGE_UP = "PageUp",
|
|
104
|
+
PAGED_OWN = "PageDown",
|
|
105
|
+
HOME = "Home",
|
|
106
|
+
END = "End",
|
|
107
|
+
META = "Meta",
|
|
108
|
+
TAB = "Tab",
|
|
109
|
+
SHIFT = "Shift",
|
|
110
|
+
CONTROL = "Control",
|
|
111
|
+
ALT = "Alt"
|
|
112
|
+
}
|
|
113
|
+
export declare enum LiveSearchState {
|
|
114
|
+
PAUSE = "pauseLiveSearch",
|
|
115
|
+
RESUME = "resumeLiveSearch",
|
|
116
|
+
STOP = "stopLiveSearch"
|
|
117
|
+
}
|
|
118
|
+
export declare const SupportedCodingLanguages: string[];
|
|
119
|
+
declare type ElementType<T extends readonly unknown[]> = T extends ReadonlyArray<infer ElementType> ? ElementType : never;
|
|
120
|
+
export declare type SupportedCodingLanguagesType = ElementType<typeof SupportedCodingLanguages>;
|
|
121
|
+
export declare const SupportedCodingLanguagesExtensionToTypeMap: {
|
|
122
|
+
ts: string;
|
|
123
|
+
js: string;
|
|
124
|
+
py: string;
|
|
125
|
+
java: string;
|
|
126
|
+
json: string;
|
|
127
|
+
};
|
|
128
|
+
export declare type OnCopiedToClipboardFunction = (type?: 'selection' | 'block', text?: string) => void;
|
|
129
|
+
export declare type OnCopiedToClipboardFunctionWithSuggestionId = (suggestionId: string, type?: 'selection' | 'block', text?: string) => void;
|
|
130
|
+
export interface SearchHistoryFilters {
|
|
131
|
+
/**
|
|
132
|
+
* Flag to define are we looking in global search-history or only in worplace
|
|
133
|
+
*
|
|
134
|
+
* @default - Search will be performed on workplace store
|
|
135
|
+
*/
|
|
136
|
+
isGlobal: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Flag to define are we looking only for queries which were manually typed by the user,
|
|
139
|
+
* or only for quries whic were generated by plugin itself, or it's not important
|
|
140
|
+
*
|
|
141
|
+
* @default - We won't filter records bases on type of input
|
|
142
|
+
*/
|
|
143
|
+
isManualSearch?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Array of language filters. If user chose some, the results would be filtered
|
|
146
|
+
*
|
|
147
|
+
* @default - We won't filter records bases on languages
|
|
148
|
+
*/
|
|
149
|
+
languages: string[];
|
|
150
|
+
/**
|
|
151
|
+
* User text from search bar in search-history part of UI
|
|
152
|
+
*
|
|
153
|
+
* @default - We won't filter records bases on user input in search-history search bar
|
|
154
|
+
*/
|
|
155
|
+
text?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Allow us to skip n-first results
|
|
158
|
+
*
|
|
159
|
+
* @default - The starting offset will be 0
|
|
160
|
+
*/
|
|
161
|
+
resultOffset: number;
|
|
162
|
+
/**
|
|
163
|
+
* Limit of how many results we want to get from store
|
|
164
|
+
*
|
|
165
|
+
* @default - The records count won't be limited
|
|
166
|
+
*/
|
|
167
|
+
resultLimit?: number;
|
|
168
|
+
}
|
|
169
|
+
export interface CodeQuery {
|
|
170
|
+
simpleNames: string[];
|
|
171
|
+
usedFullyQualifiedNames: string[];
|
|
172
|
+
}
|
|
173
|
+
export declare enum ContextChangeType {
|
|
174
|
+
'ADD' = "add",
|
|
175
|
+
'REMOVE' = "remove"
|
|
176
|
+
}
|
|
177
|
+
export declare enum SuggestionEventName {
|
|
178
|
+
CLICK = "click",
|
|
179
|
+
OPEN = "openSuggestion",
|
|
180
|
+
COPY = "copy"
|
|
181
|
+
}
|
|
182
|
+
export declare enum RelevancyVoteType {
|
|
183
|
+
UP = "upvote",
|
|
184
|
+
DOWN = "downvote"
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 'interaction' will be set if there was a potential text selection or a click input was triggered by the user.
|
|
188
|
+
* If this is a selection selectionDistanceTraveled object will also be filled
|
|
189
|
+
* 'timespend' will be set basically if there is no interaction except mouse movements in a time spent longer than the ENGAGEMENT_DURATION_LIMIT
|
|
190
|
+
* Don't forget that in 'timespend' case, user should leave the suggestion card at some point to count it as an interaction.
|
|
191
|
+
* (They need to go back to the code or move to another card instead)
|
|
192
|
+
*/
|
|
193
|
+
export declare enum EngagementType {
|
|
194
|
+
INTERACTION = "interaction",
|
|
195
|
+
TIME = "timespend"
|
|
196
|
+
}
|
|
197
|
+
export interface SuggestionEngagement {
|
|
198
|
+
/**
|
|
199
|
+
* Suggestion information
|
|
200
|
+
*/
|
|
201
|
+
suggestion: Suggestion;
|
|
202
|
+
/**
|
|
203
|
+
* Engagement type
|
|
204
|
+
*/
|
|
205
|
+
engagementType: EngagementType;
|
|
206
|
+
/**
|
|
207
|
+
* Total duration in ms till the engagement triggered.
|
|
208
|
+
*/
|
|
209
|
+
engagementDurationTillTrigger: number;
|
|
210
|
+
/**
|
|
211
|
+
* This is a little bit more than what you might expect on a normal scroll position of the suggestion card.
|
|
212
|
+
* This attribute gives the value for how much the users traveled their mouses and additionally how much they scrolled to focus on that suggestion
|
|
213
|
+
*/
|
|
214
|
+
scrollDistanceToEngage: number;
|
|
215
|
+
/**
|
|
216
|
+
* Total mouse movement in x and y directions till the engagament triggered.
|
|
217
|
+
* To avoid confusion: this is not the distance between start and end points, this is the total traveled distance.
|
|
218
|
+
*/
|
|
219
|
+
totalMouseDistanceTraveled: {
|
|
220
|
+
x: number;
|
|
221
|
+
y: number;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* If the engagementType is "interaction" and this object has a value, you can assume it as a text selection.
|
|
225
|
+
* If the engagementType is "interaction" but this object is not defined, you can assume it as a click
|
|
226
|
+
*/
|
|
227
|
+
selectionDistanceTraveled?: {
|
|
228
|
+
x: number;
|
|
229
|
+
y: number;
|
|
230
|
+
selectedText?: string;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
export interface SearchHistoryItem {
|
|
234
|
+
query: {
|
|
235
|
+
input: string;
|
|
236
|
+
queryContext: SearchPayloadMatchPolicy;
|
|
237
|
+
queryId?: string;
|
|
238
|
+
trigger: string;
|
|
239
|
+
codeQuery: CodeQuery;
|
|
240
|
+
codeSelection: SearchPayloadCodeSelection;
|
|
241
|
+
};
|
|
242
|
+
recordDate?: number;
|
|
243
|
+
suggestions: Suggestion[];
|
|
244
|
+
}
|
|
245
|
+
export declare enum ContextTypes {
|
|
246
|
+
MUST = "must",
|
|
247
|
+
SHOULD = "should",
|
|
248
|
+
MUST_NOT = "mustNot"
|
|
249
|
+
}
|
|
250
|
+
export declare enum ContextSource {
|
|
251
|
+
AUTO = "auto",
|
|
252
|
+
USER = "user",
|
|
253
|
+
SUGGESTION = "suggestion"
|
|
254
|
+
}
|
|
255
|
+
export declare enum ContextTypeClassNames {
|
|
256
|
+
should = "mynah-should-contain",
|
|
257
|
+
must = "mynah-must-contain",
|
|
258
|
+
mustNot = "mynah-must-not-contain"
|
|
259
|
+
}
|
|
260
|
+
export interface ContextType {
|
|
261
|
+
context: string;
|
|
262
|
+
type?: ContextTypes;
|
|
263
|
+
availableInSuggestion?: boolean;
|
|
264
|
+
visible?: boolean;
|
|
265
|
+
source: ContextSource;
|
|
266
|
+
}
|
|
267
|
+
export declare type FeedbackStars = 1 | 2 | 3 | 4 | 5;
|
|
268
|
+
export interface FeedbackPayload {
|
|
269
|
+
stars?: FeedbackStars;
|
|
270
|
+
comment?: string;
|
|
271
|
+
}
|
|
272
|
+
export interface AutocompleteItem {
|
|
273
|
+
suggestion: string;
|
|
274
|
+
highlight: string;
|
|
275
|
+
}
|
|
276
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
export declare class I18N {
|
|
6
|
+
private static instance;
|
|
7
|
+
texts: {
|
|
8
|
+
searchInputAPIHelpPlaceholder: string;
|
|
9
|
+
searchInputMynahPlaceholder: string;
|
|
10
|
+
};
|
|
11
|
+
private constructor();
|
|
12
|
+
static getInstance(localLanguage?: string): I18N;
|
|
13
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws/mynah-ui",
|
|
3
|
+
"displayName": "AWS Mynah UI",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "AWS Tookit VSCode and Intellij IDE Extension Mynah UI",
|
|
6
|
+
"publisher": "Amazon Web Services",
|
|
7
|
+
"license": "Apache License 2.0",
|
|
8
|
+
"readme": "README.md",
|
|
9
|
+
"main": "./dist/main.js",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/aws/mynah-ui"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"clean": "rm -rf dist node_modules",
|
|
16
|
+
"build": "rm -rf dist && webpack --config webpack.config.js --mode production",
|
|
17
|
+
"watch": "webpack --config webpack.config.js --mode development --watch",
|
|
18
|
+
"lint-fix": "npx eslint \"./**\" --fix",
|
|
19
|
+
"lint": "npx eslint \"./**\""
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"i18n-ts": "1.0.5",
|
|
23
|
+
"prismjs": "1.29.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/eslint": "7.2.13",
|
|
27
|
+
"@types/eslint-scope": "3.7.0",
|
|
28
|
+
"@types/estree": "0.0.49",
|
|
29
|
+
"@types/glob": "7.1.3",
|
|
30
|
+
"@types/json-schema": "7.0.7",
|
|
31
|
+
"@types/node": "12.20.12",
|
|
32
|
+
"@types/prismjs": "1.26.0",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "5.34.0",
|
|
34
|
+
"css-loader": "6.6.0",
|
|
35
|
+
"eslint": "8.22.0",
|
|
36
|
+
"eslint-config-prettier": "^8.5.0",
|
|
37
|
+
"eslint-config-standard-with-typescript": "22.0.0",
|
|
38
|
+
"eslint-plugin-header": "^3.1.1",
|
|
39
|
+
"eslint-plugin-import": "2.26.0",
|
|
40
|
+
"eslint-plugin-n": "15.2.5",
|
|
41
|
+
"eslint-plugin-no-null": "^1.0.2",
|
|
42
|
+
"eslint-plugin-promise": "6.0.0",
|
|
43
|
+
"sass": "1.49.8",
|
|
44
|
+
"sass-loader": "12.6.0",
|
|
45
|
+
"style-loader": "3.3.1",
|
|
46
|
+
"ts-loader": "9.2.6",
|
|
47
|
+
"ts-node": "10.4.0",
|
|
48
|
+
"typescript": "4.5.2",
|
|
49
|
+
"webpack": "5.42.0",
|
|
50
|
+
"webpack-cli": "4.7.2"
|
|
51
|
+
},
|
|
52
|
+
"prettier": {
|
|
53
|
+
"printWidth": 120,
|
|
54
|
+
"trailingComma": "es5",
|
|
55
|
+
"tabWidth": 4,
|
|
56
|
+
"singleQuote": true,
|
|
57
|
+
"semi": false,
|
|
58
|
+
"bracketSpacing": true,
|
|
59
|
+
"arrowParens": "avoid",
|
|
60
|
+
"endOfLine": "lf"
|
|
61
|
+
}
|
|
62
|
+
}
|