@gravitee/ui-components 3.25.3-typescript-8a53edf → 3.25.3-typescript-9a4271f

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.
Files changed (188) hide show
  1. package/package.json +1 -1
  2. package/src/atoms/gv-autocomplete.js +1 -461
  3. package/src/atoms/gv-button.js +1 -410
  4. package/src/atoms/gv-checkbox.js +1 -187
  5. package/src/atoms/gv-date-picker-calendar.js +1 -894
  6. package/src/atoms/gv-date-picker-cell.js +1 -190
  7. package/src/atoms/gv-date-picker.js +1 -671
  8. package/src/atoms/gv-file-upload.js +1 -367
  9. package/src/atoms/gv-icon.js +1 -103
  10. package/src/atoms/gv-image.js +1 -144
  11. package/src/atoms/gv-input-message.js +1 -84
  12. package/src/atoms/gv-input.js +1 -561
  13. package/src/atoms/gv-link.js +1 -210
  14. package/src/atoms/gv-message.js +1 -128
  15. package/src/atoms/gv-metric.js +1 -117
  16. package/src/atoms/gv-relative-time.js +1 -156
  17. package/src/atoms/gv-select-native.js +1 -388
  18. package/src/atoms/gv-select.js +1 -437
  19. package/src/atoms/gv-spinner.js +1 -57
  20. package/src/atoms/gv-state.js +1 -130
  21. package/src/atoms/gv-switch.js +1 -243
  22. package/src/atoms/gv-tag.js +1 -168
  23. package/src/atoms/gv-text.js +1 -168
  24. package/src/charts/gv-chart-bar.js +1 -103
  25. package/src/charts/gv-chart-gauge.js +1 -100
  26. package/src/charts/gv-chart-histogram.js +1 -83
  27. package/src/charts/gv-chart-line.js +1 -224
  28. package/src/charts/gv-chart-map.js +1 -112
  29. package/src/charts/gv-chart-pie.js +1 -91
  30. package/src/index.js +1 -77
  31. package/src/lib/cron-expression.js +1 -205
  32. package/src/lib/date.js +1 -44
  33. package/src/lib/events.js +1 -26
  34. package/src/lib/http-client-schema-form.js +1 -67
  35. package/src/lib/http.js +1 -237
  36. package/src/lib/i18n.js +1 -103
  37. package/src/lib/item.js +1 -118
  38. package/src/lib/properties.js +1 -189
  39. package/src/lib/schema-form.js +1 -44
  40. package/src/lib/studio.js +1 -141
  41. package/src/lib/style.js +1 -41
  42. package/src/lib/text-format.js +1 -69
  43. package/src/lib/theme.js +1 -63
  44. package/src/lib/utils.js +1 -111
  45. package/src/mixins/chart-element.js +1 -165
  46. package/src/mixins/input-element.js +1 -144
  47. package/src/mixins/item-resource.js +1 -120
  48. package/src/mixins/keyboard-element.js +1 -69
  49. package/src/mixins/update-after-browser.js +1 -30
  50. package/src/mixins/with-resize-observer.js +1 -68
  51. package/src/mixins/with-skeleton-attribute.js +1 -112
  52. package/src/molecules/gv-card-full.js +1 -218
  53. package/src/molecules/gv-card-list.js +1 -113
  54. package/src/molecules/gv-card.js +1 -133
  55. package/src/molecules/gv-category-list.js +1 -60
  56. package/src/molecules/gv-category.js +1 -170
  57. package/src/molecules/gv-code.js +1 -359
  58. package/src/molecules/gv-confirm.js +1 -188
  59. package/src/molecules/gv-cron-editor.js +1 -710
  60. package/src/molecules/gv-dropdown-menu.js +1 -116
  61. package/src/molecules/gv-expandable.js +1 -122
  62. package/src/molecules/gv-expression-language.js +1 -270
  63. package/src/molecules/gv-identity-picture.js +1 -148
  64. package/src/molecules/gv-list.js +1 -227
  65. package/src/molecules/gv-metrics.js +1 -162
  66. package/src/molecules/gv-modal.js +1 -213
  67. package/src/molecules/gv-nav.js +1 -196
  68. package/src/molecules/gv-option.js +1 -242
  69. package/src/molecules/gv-plans.js +1 -429
  70. package/src/molecules/gv-popover.js +1 -351
  71. package/src/molecules/gv-promote.js +1 -209
  72. package/src/molecules/gv-rating-list.js +1 -365
  73. package/src/molecules/gv-rating.js +1 -253
  74. package/src/molecules/gv-row-expandable.js +1 -45
  75. package/src/molecules/gv-row.js +1 -210
  76. package/src/molecules/gv-stats.js +1 -121
  77. package/src/molecules/gv-stepper.js +1 -288
  78. package/src/molecules/gv-table.js +1 -685
  79. package/src/molecules/gv-tree.js +1 -250
  80. package/src/organisms/gv-documentation.js +1 -215
  81. package/src/organisms/gv-header.js +1 -288
  82. package/src/organisms/gv-http-client.js +1 -275
  83. package/src/organisms/gv-menu.js +1 -263
  84. package/src/organisms/gv-newsletter-subscription.js +1 -271
  85. package/src/organisms/gv-pagination.js +1 -198
  86. package/src/organisms/gv-properties.js +1 -920
  87. package/src/organisms/gv-resizable-views.js +1 -396
  88. package/src/organisms/gv-resources.js +1 -535
  89. package/src/organisms/gv-schema-form-array.js +1 -250
  90. package/src/organisms/gv-schema-form-control-object.js +1 -154
  91. package/src/organisms/gv-schema-form-control.js +1 -443
  92. package/src/organisms/gv-schema-form.js +1 -751
  93. package/src/organisms/gv-tabs.js +1 -210
  94. package/src/organisms/gv-user-menu.js +1 -314
  95. package/src/organisms/gv-vertical-menu.js +1 -123
  96. package/src/policy-studio/gv-flow-step.js +1 -464
  97. package/src/policy-studio/gv-flow.js +1 -621
  98. package/src/policy-studio/gv-policy-studio-menu.js +1 -750
  99. package/src/policy-studio/gv-policy-studio.js +1 -1842
  100. package/src/styles/empty.js +1 -36
  101. package/src/styles/input.js +1 -263
  102. package/src/styles/link.js +1 -32
  103. package/src/styles/shapes.js +1 -17
  104. package/src/styles/skeleton.js +1 -53
  105. package/src/styles/zoom.js +1 -40
  106. package/src/theme/gv-theme.js +1 -203
  107. package/wc/gv-autocomplete.js +1 -1
  108. package/wc/gv-button.js +1 -1
  109. package/wc/gv-card-full.js +1 -1
  110. package/wc/gv-card-list.js +1 -1
  111. package/wc/gv-card.js +1 -1
  112. package/wc/gv-category-list.js +1 -1
  113. package/wc/gv-category.js +1 -1
  114. package/wc/gv-chart-bar.js +1 -1
  115. package/wc/gv-chart-gauge.js +1 -1
  116. package/wc/gv-chart-histogram.js +1 -1
  117. package/wc/gv-chart-line.js +1 -1
  118. package/wc/gv-chart-map.js +1 -1
  119. package/wc/gv-chart-pie.js +1 -1
  120. package/wc/gv-checkbox.js +1 -1
  121. package/wc/gv-code.js +1 -1
  122. package/wc/gv-confirm.js +1 -1
  123. package/wc/gv-cron-editor.js +1 -1
  124. package/wc/gv-date-picker-calendar.js +1 -1
  125. package/wc/gv-date-picker-cell.js +1 -1
  126. package/wc/gv-date-picker.js +1 -1
  127. package/wc/gv-documentation.js +1 -1
  128. package/wc/gv-dropdown-menu.js +1 -1
  129. package/wc/gv-expandable.js +1 -1
  130. package/wc/gv-expression-language.js +1 -1
  131. package/wc/gv-file-upload.js +1 -1
  132. package/wc/gv-flow-step.js +1 -1
  133. package/wc/gv-flow.js +1 -1
  134. package/wc/gv-header.js +1 -1
  135. package/wc/gv-http-client.js +1 -1
  136. package/wc/gv-icon.js +1 -1
  137. package/wc/gv-identity-picture.js +1 -1
  138. package/wc/gv-image.js +1 -1
  139. package/wc/gv-input-message.js +1 -1
  140. package/wc/gv-input.js +1 -1
  141. package/wc/gv-link.js +1 -1
  142. package/wc/gv-list.js +1 -1
  143. package/wc/gv-menu.js +1 -1
  144. package/wc/gv-message.js +1 -1
  145. package/wc/gv-metric.js +1 -1
  146. package/wc/gv-metrics.js +1 -1
  147. package/wc/gv-modal.js +1 -1
  148. package/wc/gv-nav.js +1 -1
  149. package/wc/gv-newsletter-subscription.js +1 -1
  150. package/wc/gv-option.js +1 -1
  151. package/wc/gv-pagination.js +1 -1
  152. package/wc/gv-plans.js +1 -1
  153. package/wc/gv-policy-studio-menu.js +1 -1
  154. package/wc/gv-policy-studio.js +1 -1
  155. package/wc/gv-popover.js +1 -1
  156. package/wc/gv-promote.js +1 -1
  157. package/wc/gv-properties.js +1 -1
  158. package/wc/gv-rating-list.js +1 -1
  159. package/wc/gv-rating.js +1 -1
  160. package/wc/gv-relative-time.js +1 -1
  161. package/wc/gv-resizable-views.js +1 -1
  162. package/wc/gv-resources.js +1 -1
  163. package/wc/gv-row-expandable.js +1 -1
  164. package/wc/gv-row.js +1 -1
  165. package/wc/gv-schema-form-array.js +1 -1
  166. package/wc/gv-schema-form-control-object.js +1 -1
  167. package/wc/gv-schema-form-control.js +1 -1
  168. package/wc/gv-schema-form.js +1 -1
  169. package/wc/gv-select-native.js +1 -1
  170. package/wc/gv-select.js +1 -1
  171. package/wc/gv-spinner.js +1 -1
  172. package/wc/gv-state.js +1 -1
  173. package/wc/gv-stats.js +1 -1
  174. package/wc/gv-stepper.js +1 -1
  175. package/wc/gv-switch.js +1 -1
  176. package/wc/gv-table.js +1 -1
  177. package/wc/gv-tabs.js +1 -1
  178. package/wc/gv-tag.js +1 -1
  179. package/wc/gv-text.js +1 -1
  180. package/wc/gv-theme.js +1 -1
  181. package/wc/gv-tree.js +1 -1
  182. package/wc/gv-user-menu.js +1 -1
  183. package/wc/gv-vertical-menu.js +1 -1
  184. package/CHANGELOG.md +0 -1292
  185. package/LICENSE.txt +0 -202
  186. package/README.md +0 -195
  187. package/src/.eslintrc.js +0 -19
  188. package/src/theme/definition.json +0 -1762
package/src/lib/http.js CHANGED
@@ -1,237 +1 @@
1
- /*
2
- * Copyright (C) 2021 The Gravitee team (http://gravitee.io)
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export const statusCode = {
17
- 100: {
18
- description: 'Continue',
19
- constant: 'CONTINUE',
20
- },
21
- 101: {
22
- description: 'Switching Protocols',
23
- constant: 'SWITCHING_PROTOCOLS',
24
- },
25
- 102: {
26
- description: 'Processing',
27
- constant: 'PROCESSING',
28
- },
29
- 200: {
30
- description: 'OK',
31
- constant: 'OK',
32
- },
33
- 201: {
34
- description: 'Created',
35
- constant: 'CREATED',
36
- },
37
- 202: {
38
- description: 'Accepted',
39
- constant: 'ACCEPTED',
40
- },
41
- 203: {
42
- description: 'Non Authoritative Information',
43
- constant: 'NON_AUTHORITATIVE_INFORMATION',
44
- },
45
- 204: {
46
- description: 'No Content',
47
- constant: 'NO_CONTENT',
48
- },
49
- 205: {
50
- description: 'Reset Content',
51
- constant: 'RESET_CONTENT',
52
- },
53
- 206: {
54
- description: 'Partial Content',
55
- constant: 'PARTIAL_CONTENT',
56
- },
57
- 207: {
58
- description: 'Multi-Status',
59
- constant: 'MULTI_STATUS',
60
- },
61
- 300: {
62
- description: 'Multiple Choices',
63
- constant: 'MULTIPLE_CHOICES',
64
- },
65
- 301: {
66
- description: 'Moved Permanently',
67
- constant: 'MOVED_PERMANENTLY',
68
- },
69
- 302: {
70
- description: 'Moved Temporarily',
71
- constant: 'MOVED_TEMPORARILY',
72
- },
73
- 303: {
74
- description: 'See Other',
75
- constant: 'SEE_OTHER',
76
- },
77
- 304: {
78
- description: 'Not Modified',
79
- constant: 'NOT_MODIFIED',
80
- },
81
- 305: {
82
- description: 'Use Proxy',
83
- constant: 'USE_PROXY',
84
- },
85
- 307: {
86
- description: 'Temporary Redirect',
87
- constant: 'TEMPORARY_REDIRECT',
88
- },
89
- 308: {
90
- description: 'Permanent Redirect',
91
- constant: 'PERMANENT_REDIRECT',
92
- },
93
- 400: {
94
- description: 'Bad Request',
95
- constant: 'BAD_REQUEST',
96
- },
97
- 401: {
98
- description: 'Unauthorized',
99
- constant: 'UNAUTHORIZED',
100
- },
101
- 402: {
102
- description: 'Payment Required',
103
- constant: 'PAYMENT_REQUIRED',
104
- },
105
- 403: {
106
- description: 'Forbidden',
107
- constant: 'FORBIDDEN',
108
- },
109
- 404: {
110
- description: 'Not Found',
111
- constant: 'NOT_FOUND',
112
- },
113
- 405: {
114
- description: 'Method Not Allowed',
115
- constant: 'METHOD_NOT_ALLOWED',
116
- },
117
- 406: {
118
- description: 'Not Acceptable',
119
- constant: 'NOT_ACCEPTABLE',
120
- },
121
- 407: {
122
- description: 'Proxy Authentication Required',
123
- constant: 'PROXY_AUTHENTICATION_REQUIRED',
124
- },
125
- 408: {
126
- description: 'Request Timeout',
127
- constant: 'REQUEST_TIMEOUT',
128
- },
129
- 409: {
130
- description: 'Conflict',
131
- constant: 'CONFLICT',
132
- },
133
- 410: {
134
- description: 'Gone',
135
- constant: 'GONE',
136
- },
137
- 411: {
138
- description: 'Length Required',
139
- constant: 'LENGTH_REQUIRED',
140
- },
141
- 412: {
142
- description: 'Precondition Failed',
143
- constant: 'PRECONDITION_FAILED',
144
- },
145
- 413: {
146
- description: 'Request Entity Too Large',
147
- constant: 'REQUEST_ENTITY_TOO_LARGE',
148
- },
149
- 414: {
150
- description: 'Request-URI Too Long',
151
- constant: 'REQUEST_URI_TOO_LONG',
152
- },
153
- 415: {
154
- description: 'Unsupported Media Type',
155
- constant: 'UNSUPPORTED_MEDIA_TYPE',
156
- },
157
- 416: {
158
- description: 'Requested Range Not Satisfiable',
159
- constant: 'REQUESTED_RANGE_NOT_SATISFIABLE',
160
- },
161
- 417: {
162
- description: 'Expectation Failed',
163
- constant: 'EXPECTATION_FAILED',
164
- },
165
- 418: {
166
- description: "I'm a teapot",
167
- constant: "I'M_A_TEAPOT",
168
- },
169
- 419: {
170
- description: 'Insufficient Space on Resource',
171
- constant: 'INSUFFICIENT_SPACE_ON_RESOURCE',
172
- },
173
- 420: {
174
- description: 'Method Failure',
175
- constant: 'METHOD_FAILURE',
176
- },
177
- 422: {
178
- description: 'Unprocessable Entity',
179
- constant: 'UNPROCESSABLE_ENTITY',
180
- },
181
- 423: {
182
- description: 'Locked',
183
- constant: 'LOCKED',
184
- },
185
- 424: {
186
- description: 'Failed Dependency',
187
- constant: 'FAILED_DEPENDENCY',
188
- },
189
- 428: {
190
- description: 'Precondition Required',
191
- constant: 'PRECONDITION_REQUIRED',
192
- },
193
- 429: {
194
- description: 'Too Many Requests',
195
- constant: 'TOO_MANY_REQUESTS',
196
- },
197
- 431: {
198
- description: 'Request Header Fields Too Large',
199
- constant: 'REQUEST_HEADER_FIELDS_TOO_LARGE',
200
- },
201
- 451: {
202
- description: 'Unavailable For Legal Reasons',
203
- constant: 'UNAVAILABLE_FOR_LEGAL_REASONS',
204
- },
205
- 500: {
206
- description: 'Internal Server Error',
207
- constant: 'INTERNAL_SERVER_ERROR',
208
- },
209
- 501: {
210
- description: 'Not Implemented',
211
- constant: 'NOT_IMPLEMENTED',
212
- },
213
- 502: {
214
- description: 'Bad Gateway',
215
- constant: 'BAD_GATEWAY',
216
- },
217
- 503: {
218
- description: 'Service Unavailable',
219
- constant: 'SERVICE_UNAVAILABLE',
220
- },
221
- 504: {
222
- description: 'Gateway Timeout',
223
- constant: 'GATEWAY_TIMEOUT',
224
- },
225
- 505: {
226
- description: 'HTTP Version Not Supported',
227
- constant: 'HTTP_VERSION_NOT_SUPPORTED',
228
- },
229
- 507: {
230
- description: 'Insufficient Storage',
231
- constant: 'INSUFFICIENT_STORAGE',
232
- },
233
- 511: {
234
- description: 'Network Authentication Required',
235
- constant: 'NETWORK_AUTHENTICATION_REQUIRED',
236
- },
237
- };
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.statusCode=void 0,exports.statusCode={100:{description:"Continue",constant:"CONTINUE"},101:{description:"Switching Protocols",constant:"SWITCHING_PROTOCOLS"},102:{description:"Processing",constant:"PROCESSING"},200:{description:"OK",constant:"OK"},201:{description:"Created",constant:"CREATED"},202:{description:"Accepted",constant:"ACCEPTED"},203:{description:"Non Authoritative Information",constant:"NON_AUTHORITATIVE_INFORMATION"},204:{description:"No Content",constant:"NO_CONTENT"},205:{description:"Reset Content",constant:"RESET_CONTENT"},206:{description:"Partial Content",constant:"PARTIAL_CONTENT"},207:{description:"Multi-Status",constant:"MULTI_STATUS"},300:{description:"Multiple Choices",constant:"MULTIPLE_CHOICES"},301:{description:"Moved Permanently",constant:"MOVED_PERMANENTLY"},302:{description:"Moved Temporarily",constant:"MOVED_TEMPORARILY"},303:{description:"See Other",constant:"SEE_OTHER"},304:{description:"Not Modified",constant:"NOT_MODIFIED"},305:{description:"Use Proxy",constant:"USE_PROXY"},307:{description:"Temporary Redirect",constant:"TEMPORARY_REDIRECT"},308:{description:"Permanent Redirect",constant:"PERMANENT_REDIRECT"},400:{description:"Bad Request",constant:"BAD_REQUEST"},401:{description:"Unauthorized",constant:"UNAUTHORIZED"},402:{description:"Payment Required",constant:"PAYMENT_REQUIRED"},403:{description:"Forbidden",constant:"FORBIDDEN"},404:{description:"Not Found",constant:"NOT_FOUND"},405:{description:"Method Not Allowed",constant:"METHOD_NOT_ALLOWED"},406:{description:"Not Acceptable",constant:"NOT_ACCEPTABLE"},407:{description:"Proxy Authentication Required",constant:"PROXY_AUTHENTICATION_REQUIRED"},408:{description:"Request Timeout",constant:"REQUEST_TIMEOUT"},409:{description:"Conflict",constant:"CONFLICT"},410:{description:"Gone",constant:"GONE"},411:{description:"Length Required",constant:"LENGTH_REQUIRED"},412:{description:"Precondition Failed",constant:"PRECONDITION_FAILED"},413:{description:"Request Entity Too Large",constant:"REQUEST_ENTITY_TOO_LARGE"},414:{description:"Request-URI Too Long",constant:"REQUEST_URI_TOO_LONG"},415:{description:"Unsupported Media Type",constant:"UNSUPPORTED_MEDIA_TYPE"},416:{description:"Requested Range Not Satisfiable",constant:"REQUESTED_RANGE_NOT_SATISFIABLE"},417:{description:"Expectation Failed",constant:"EXPECTATION_FAILED"},418:{description:"I'm a teapot",constant:"I'M_A_TEAPOT"},419:{description:"Insufficient Space on Resource",constant:"INSUFFICIENT_SPACE_ON_RESOURCE"},420:{description:"Method Failure",constant:"METHOD_FAILURE"},422:{description:"Unprocessable Entity",constant:"UNPROCESSABLE_ENTITY"},423:{description:"Locked",constant:"LOCKED"},424:{description:"Failed Dependency",constant:"FAILED_DEPENDENCY"},428:{description:"Precondition Required",constant:"PRECONDITION_REQUIRED"},429:{description:"Too Many Requests",constant:"TOO_MANY_REQUESTS"},431:{description:"Request Header Fields Too Large",constant:"REQUEST_HEADER_FIELDS_TOO_LARGE"},451:{description:"Unavailable For Legal Reasons",constant:"UNAVAILABLE_FOR_LEGAL_REASONS"},500:{description:"Internal Server Error",constant:"INTERNAL_SERVER_ERROR"},501:{description:"Not Implemented",constant:"NOT_IMPLEMENTED"},502:{description:"Bad Gateway",constant:"BAD_GATEWAY"},503:{description:"Service Unavailable",constant:"SERVICE_UNAVAILABLE"},504:{description:"Gateway Timeout",constant:"GATEWAY_TIMEOUT"},505:{description:"HTTP Version Not Supported",constant:"HTTP_VERSION_NOT_SUPPORTED"},507:{description:"Insufficient Storage",constant:"INSUFFICIENT_STORAGE"},511:{description:"Network Authentication Required",constant:"NETWORK_AUTHENTICATION_REQUIRED"}};
package/src/lib/i18n.js CHANGED
@@ -1,103 +1 @@
1
- /*
2
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import 'whatwg-fetch';
17
-
18
- /**
19
- * @param {string} key - The translation key
20
- * @param {object} data - The translation data
21
- * @returns {string} - The translated
22
- */
23
- export function i18n(key, data) {
24
- const translation = getTranslation(key);
25
- if (translation == null) {
26
- return 'unknown';
27
- }
28
-
29
- if (data) {
30
- const msg = i18n._messageFormatter.compile(translation);
31
- return msg(data);
32
- }
33
-
34
- return translation;
35
- }
36
-
37
- /**
38
- * @param {string} key - The translation key
39
- * @returns {null|string|function} - The translation string or function
40
- */
41
- function getTranslation(key) {
42
- try {
43
- return key.split('.').reduce((prev, curr) => prev && prev[curr], i18n._translations[i18n._lang]);
44
- } catch (e) {
45
- return null;
46
- }
47
- }
48
-
49
- // Init private translation storage
50
- i18n._translations = {};
51
-
52
- const MessageFormat = require('messageformat');
53
- i18n._messageFormatter = new MessageFormat(i18n._lang);
54
-
55
- /**
56
- * @param {string} lang - Translation language code
57
- */
58
- export function setLanguage(lang) {
59
- i18n._lang = lang;
60
- }
61
-
62
- /**
63
- * @returns {string} - Translation language code
64
- */
65
- export function getLanguage() {
66
- return i18n._lang;
67
- }
68
-
69
- /**
70
- * @param {string} lang - Translation language code
71
- * @param {object} translations - Translation values by key
72
- * @param {object} label - Lang label
73
- */
74
- export function addTranslations(lang, translations, label) {
75
- i18n._translations[lang] = { ...{ LANGUAGE: label }, ...translations };
76
- }
77
-
78
- /**
79
- * @returns {object} - All defined languages (key: human name and value: code)
80
- */
81
- export function getAvailableLanguages() {
82
- const availableLanguages = {};
83
- for (const lang in i18n._translations) {
84
- const { LANGUAGE } = i18n._translations[lang];
85
- availableLanguages[LANGUAGE] = lang;
86
- }
87
- return availableLanguages;
88
- }
89
-
90
- export function loadDefaultTranslations() {
91
- setLanguage('en');
92
- return fetch(`i18n/${i18n._lang}.json`)
93
- .then((response) => {
94
- return response.json();
95
- })
96
- .then((translations) => {
97
- addTranslations(i18n._lang, translations);
98
- })
99
- .catch((ex) => {
100
- // eslint-disable-next-line no-console
101
- console.error('[ui-components] loadDefaultTranslations - parsing failed ', ex);
102
- });
103
- }
1
+ function n(t,e){const a=function(t){try{return t.split(".").reduce(((n,t)=>n&&n[t]),n._translations[n._lang])}catch(n){return null}}(t);if(null==a)return"unknown";if(e){return n._messageFormatter.compile(a)(e)}return a}Object.defineProperty(exports,"__esModule",{value:!0}),exports.loadDefaultTranslations=exports.getAvailableLanguages=exports.addTranslations=exports.getLanguage=exports.setLanguage=exports.i18n=void 0,require("whatwg-fetch"),exports.i18n=n,n._translations={};const t=require("messageformat");function e(t){n._lang=t}function a(t,e,a){n._translations[t]={LANGUAGE:a,...e}}n._messageFormatter=new t(n._lang),exports.setLanguage=e,exports.getLanguage=function(){return n._lang},exports.addTranslations=a,exports.getAvailableLanguages=function(){const t={};for(const e in n._translations){const{LANGUAGE:a}=n._translations[e];t[a]=e}return t},exports.loadDefaultTranslations=function(){return e("en"),fetch(`i18n/${n._lang}.json`).then((n=>n.json())).then((t=>{a(n._lang,t)})).catch((n=>{console.error("[ui-components] loadDefaultTranslations - parsing failed ",n)}))};
package/src/lib/item.js CHANGED
@@ -1,118 +1 @@
1
- /*
2
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { getApplicationTypeIcon } from './theme';
17
- import { html } from 'lit';
18
-
19
- export function getVersion(item) {
20
- if (item) {
21
- if (item.version) {
22
- return item.version;
23
- } else if (item.applicationType) {
24
- const icon = getApplicationTypeIcon(item.applicationType);
25
- return html`<gv-icon shape="${icon}"></gv-icon>`;
26
- }
27
- }
28
- return null;
29
- }
30
-
31
- export function getTitle(item) {
32
- if (item) {
33
- return item.name;
34
- }
35
- return '';
36
- }
37
-
38
- export function getPicture(item) {
39
- if (item) {
40
- if (item.picture) {
41
- return item.picture;
42
- } else if (item._links && item._links.picture) {
43
- return item._links.picture;
44
- }
45
- }
46
- return null;
47
- }
48
-
49
- export function getBackground(item) {
50
- if (item) {
51
- if (item.background) {
52
- return item.background;
53
- } else if (item._links && item._links.background) {
54
- return item._links.background;
55
- }
56
- }
57
- return null;
58
- }
59
-
60
- export function getStates(item) {
61
- if (item) {
62
- return item.states;
63
- }
64
- return null;
65
- }
66
-
67
- export function getLabels(item) {
68
- if (item) {
69
- return item.labels;
70
- }
71
- return null;
72
- }
73
-
74
- export function getRating(item) {
75
- if (item) {
76
- return item.rating_summary;
77
- }
78
- return null;
79
- }
80
-
81
- export function getEntrypoints(item) {
82
- if (item) {
83
- return item.entrypoints || [];
84
- }
85
- return [];
86
- }
87
-
88
- export function getDescription(item) {
89
- if (item) {
90
- return item.description;
91
- }
92
- return '';
93
- }
94
-
95
- export function getOwner(item) {
96
- if (item && item.owner) {
97
- return item.owner.display_name;
98
- }
99
- return '';
100
- }
101
-
102
- export function getNbApisInView(item) {
103
- if (item && item.total_apis != null) {
104
- return item.total_apis;
105
- }
106
- return null;
107
- }
108
-
109
- export function getPictureDisplayName(item) {
110
- if (item) {
111
- if (item.version) {
112
- return `${getTitle(item)} ${item.version}`;
113
- } else if (item.applicationType) {
114
- return `${getTitle(item)} ${item.applicationType} ${getOwner(item)}`;
115
- }
116
- }
117
- return getTitle(item);
118
- }
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPictureDisplayName=exports.getNbApisInView=exports.getOwner=exports.getDescription=exports.getEntrypoints=exports.getRating=exports.getLabels=exports.getStates=exports.getBackground=exports.getPicture=exports.getTitle=exports.getVersion=void 0;const t=require("./theme"),e=require("lit");function r(t){return t?t.name:""}function n(t){return t&&t.owner?t.owner.display_name:""}exports.getVersion=function(r){if(r){if(r.version)return r.version;if(r.applicationType){const n=(0,t.getApplicationTypeIcon)(r.applicationType);return e.html`<gv-icon shape="${n}"></gv-icon>`}}return null},exports.getTitle=r,exports.getPicture=function(t){if(t){if(t.picture)return t.picture;if(t._links&&t._links.picture)return t._links.picture}return null},exports.getBackground=function(t){if(t){if(t.background)return t.background;if(t._links&&t._links.background)return t._links.background}return null},exports.getStates=function(t){return t?t.states:null},exports.getLabels=function(t){return t?t.labels:null},exports.getRating=function(t){return t?t.rating_summary:null},exports.getEntrypoints=function(t){return t&&t.entrypoints||[]},exports.getDescription=function(t){return t?t.description:""},exports.getOwner=n,exports.getNbApisInView=function(t){return t&&null!=t.total_apis?t.total_apis:null},exports.getPictureDisplayName=function(t){if(t){if(t.version)return`${r(t)} ${t.version}`;if(t.applicationType)return`${r(t)} ${t.applicationType} ${n(t)}`}return r(t)};
@@ -1,189 +1 @@
1
- /*
2
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Thanks to https://github.com/CleverCloud/clever-client.js
18
- *
19
- * https://stackoverflow.com/questions/2821043/allowed-characters-in-linux-environment-variable-names
20
- * Default bash/Linux rules are:
21
- * letters (upper case only)
22
- * digits (but not for first char)
23
- * underscores
24
- * nothing else
25
- * /^[a-zA-Z_][a-zA-Z0-9_]*$/
26
- */
27
- export const ENV_VAR_NAME_REGEX = /^[a-zA-Z0-9-_.]+$/;
28
-
29
- export function validateName(name) {
30
- // return ENV_VAR_NAME_REGEX.test(name);
31
- return true;
32
- }
33
-
34
- export const ERROR_TYPES = {
35
- INVALID_NAME: 0,
36
- DUPLICATED_NAME: 1,
37
- INVALID_LINE: 2,
38
- INVALID_VALUE: 3,
39
- };
40
-
41
- const NEW_LINE = '\n';
42
- const SIMPLE_QUOTE = "'";
43
- const EQUAL = '=';
44
- const SLASH = '\\';
45
- const SIMPLE_QUOTE_REPLACE = /([\\]*)'/g;
46
- const DOUBLE_QUOTE = '"';
47
- const DOUBLE_QUOTE_REPLACE = /([\\]*)"/g;
48
-
49
- function nextIndex(text, char, start = 0) {
50
- let i = start;
51
- let escaped = false;
52
- while (i < text.length) {
53
- if (text[i] === char && !escaped) {
54
- return i;
55
- }
56
- escaped = text[i] === '\\';
57
- i += 1;
58
- }
59
- return i;
60
- }
61
-
62
- function isEmptyLine(line) {
63
- return line.trim() === '';
64
- }
65
-
66
- function isCommentLine(line) {
67
- return line.trim().startsWith('#');
68
- }
69
-
70
- function getPosition(text, index) {
71
- const lines = text.substring(0, index).split(NEW_LINE);
72
- const line = lines.length;
73
- const column = lines.slice(-1)[0].length;
74
- return { line, column };
75
- }
76
-
77
- // Here we surround a string with double quotes,
78
- // it means we need to escape existing double quotes,
79
- // we need to do so in a way that is compatible with shells and environment variables,
80
- // this is why we have (slashes * 2 + 1).
81
- function doubleQuoteString(str) {
82
- const escapedString = str.replace(DOUBLE_QUOTE_REPLACE, (m, slashes) => {
83
- return SLASH.repeat(slashes.length * 2 + 1) + DOUBLE_QUOTE;
84
- });
85
- return DOUBLE_QUOTE + escapedString + DOUBLE_QUOTE;
86
- }
87
-
88
- // Here we must be able to reverse what doubleQuoteString() does,
89
- // with the same logic,
90
- // we also want it to work with simple quotes.
91
- function unquoteString(firstChar, str) {
92
- if (firstChar === SIMPLE_QUOTE) {
93
- return str.replace(SIMPLE_QUOTE_REPLACE, (match, slashes) => {
94
- return SLASH.repeat((slashes.length - 1) / 2) + SIMPLE_QUOTE;
95
- });
96
- }
97
- if (firstChar === DOUBLE_QUOTE) {
98
- return str.replace(DOUBLE_QUOTE_REPLACE, (match, slashes) => {
99
- return SLASH.repeat((slashes.length - 1) / 2) + DOUBLE_QUOTE;
100
- });
101
- }
102
- return str;
103
- }
104
-
105
- export function parseRaw(rawInput = '') {
106
- const parsedVariables = [];
107
- const parsingErrors = [];
108
- const allNames = new Set();
109
-
110
- let startIdx = 0;
111
- while (startIdx < rawInput.length) {
112
- const nextNewLineIdx = nextIndex(rawInput, NEW_LINE, startIdx);
113
- const line = rawInput.substring(startIdx, nextNewLineIdx);
114
-
115
- if (isEmptyLine(line) || isCommentLine(line)) {
116
- startIdx = nextNewLineIdx + 1;
117
- continue;
118
- }
119
-
120
- if (!line.includes(EQUAL)) {
121
- parsingErrors.push({ type: ERROR_TYPES.INVALID_LINE, pos: getPosition(rawInput, startIdx) });
122
- startIdx = nextNewLineIdx + 1;
123
- continue;
124
- }
125
-
126
- const nextEqualIdx = nextIndex(rawInput, EQUAL, startIdx);
127
- const key = rawInput.substring(startIdx, nextEqualIdx);
128
-
129
- if (!validateName(key)) {
130
- parsingErrors.push({ type: ERROR_TYPES.INVALID_NAME, key, pos: getPosition(rawInput, startIdx) });
131
- }
132
-
133
- if (allNames.has(key)) {
134
- parsingErrors.push({ type: ERROR_TYPES.DUPLICATED_NAME, key, pos: getPosition(rawInput, startIdx) });
135
- } else {
136
- allNames.add(key);
137
- }
138
-
139
- const valueFirstChar = rawInput[nextEqualIdx + 1];
140
- if (valueFirstChar === SIMPLE_QUOTE || valueFirstChar === DOUBLE_QUOTE) {
141
- const nextQuoteIdx = nextIndex(rawInput, valueFirstChar, nextEqualIdx + 2);
142
- const rawValue = rawInput.substring(nextEqualIdx + 2, nextQuoteIdx);
143
- const value = unquoteString(valueFirstChar, rawValue);
144
- parsedVariables.push({ key, value });
145
- if (nextNewLineIdx > nextQuoteIdx + 1 || nextQuoteIdx + 1 > rawInput.length) {
146
- parsingErrors.push({ type: ERROR_TYPES.INVALID_VALUE, key, pos: getPosition(rawInput, nextQuoteIdx + 1) });
147
- startIdx = nextNewLineIdx + 1;
148
- } else {
149
- startIdx = nextQuoteIdx + 1;
150
- }
151
- } else {
152
- const value = rawInput.substring(nextEqualIdx + 1, nextNewLineIdx);
153
- parsedVariables.push({ key, value });
154
- startIdx = nextNewLineIdx + 1;
155
- }
156
- }
157
-
158
- // WARN: Array.prototype.sort edits in place
159
- parsedVariables.sort((a, b) => a.key.localeCompare(b.key));
160
-
161
- return { variables: parsedVariables, errors: parsingErrors };
162
- }
163
-
164
- // automatically merges duplicated named (keeps last value)
165
- // automatically removes variables with invalid names
166
- // always double quote values (with proper escaping)
167
- export function toNameEqualsValueString(variables, options = {}) {
168
- const { addExports = false } = options;
169
- return variables
170
- .sort((a, b) => a.key.localeCompare(b.key))
171
- .map(({ key, value }) => {
172
- const quotedValue = doubleQuoteString(value);
173
- const nameValue = `${key}=${quotedValue}`;
174
- return addExports ? `export ${nameValue};` : nameValue;
175
- })
176
- .join('\n');
177
- }
178
-
179
- // automatically merges duplicated named (keeps last value)
180
- // automatically removes variables with invalid names
181
- export function toNameValueObject(variables) {
182
- const keyValueObject = {};
183
- variables
184
- .filter(({ name }) => validateName(name))
185
- .forEach(({ name, value }) => {
186
- keyValueObject[name] = value;
187
- });
188
- return keyValueObject;
189
- }
1
+ function e(e){return!0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toNameValueObject=exports.toNameEqualsValueString=exports.parseRaw=exports.ERROR_TYPES=exports.validateName=exports.ENV_VAR_NAME_REGEX=void 0,exports.ENV_VAR_NAME_REGEX=/^[a-zA-Z0-9-_.]+$/,exports.validateName=e,exports.ERROR_TYPES={INVALID_NAME:0,DUPLICATED_NAME:1,INVALID_LINE:2,INVALID_VALUE:3};const t=/([\\]*)'/g,r=/([\\]*)"/g;function n(e,t,r=0){let n=r,s=!1;for(;n<e.length;){if(e[n]===t&&!s)return n;s="\\"===e[n],n+=1}return n}function s(e){return""===e.trim()}function o(e){return e.trim().startsWith("#")}function a(e,t){const r=e.substring(0,t).split("\n");return{line:r.length,column:r.slice(-1)[0].length}}exports.parseRaw=function(e=""){const u=[],p=[],l=new Set;let i=0;for(;i<e.length;){const R=n(e,"\n",i),_=e.substring(i,R);if(s(_)||o(_)){i=R+1;continue}if(!_.includes("=")){p.push({type:exports.ERROR_TYPES.INVALID_LINE,pos:a(e,i)}),i=R+1;continue}const N=n(e,"=",i),x=e.substring(i,N);l.has(x)?p.push({type:exports.ERROR_TYPES.DUPLICATED_NAME,key:x,pos:a(e,i)}):l.add(x);const f=e[N+1];if("'"===f||'"'===f){const s=n(e,f,N+2),o=e.substring(N+2,s),l=(E=o,"'"===(c=f)?E.replace(t,((e,t)=>"\\".repeat((t.length-1)/2)+"'")):'"'===c?E.replace(r,((e,t)=>"\\".repeat((t.length-1)/2)+'"')):E);u.push({key:x,value:l}),R>s+1||s+1>e.length?(p.push({type:exports.ERROR_TYPES.INVALID_VALUE,key:x,pos:a(e,s+1)}),i=R+1):i=s+1}else{const t=e.substring(N+1,R);u.push({key:x,value:t}),i=R+1}}var c,E;return u.sort(((e,t)=>e.key.localeCompare(t.key))),{variables:u,errors:p}},exports.toNameEqualsValueString=function(e,t={}){const{addExports:n=!1}=t;return e.sort(((e,t)=>e.key.localeCompare(t.key))).map((({key:e,value:t})=>{const s=`${e}=${'"'+t.replace(r,((e,t)=>"\\".repeat(2*t.length+1)+'"'))+'"'}`;return n?`export ${s};`:s})).join("\n")},exports.toNameValueObject=function(e){const t={};return e.filter((({name:e})=>!0)).forEach((({name:e,value:r})=>{t[e]=r})),t};