@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
@@ -1,44 +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
- export function isCodemirror(control) {
17
- return control['x-schema-form'] && control['x-schema-form'].type === 'codemirror';
18
- }
19
-
20
- export function isObject(control) {
21
- return control.type === 'object';
22
- }
23
-
24
- export function isComplexArray(control) {
25
- return control.type === 'array' && !control.items.enum;
26
- }
27
-
28
- export function canInline(schema) {
29
- if (schema.properties) {
30
- const keys = Object.keys(schema.properties);
31
- return keys.length === 2 && keys.filter((key) => _canInline(schema, key)).length === keys.length;
32
- }
33
- return true;
34
- }
35
-
36
- function _canInline(schema, key) {
37
- const property = schema.properties[key];
38
- return !isCodemirror(property) && !isObject(property) && !isComplexArray(property);
39
- }
40
-
41
- export function canGrid(schema) {
42
- const keys = Object.keys(schema.properties);
43
- return keys.length > 2 && keys.filter((key) => _canInline(schema, key)).length === keys.length;
44
- }
1
+ function e(e){return e["x-schema-form"]&&"codemirror"===e["x-schema-form"].type}function r(e){return"object"===e.type}function t(e){return"array"===e.type&&!e.items.enum}function n(n,o){const s=n.properties[o];return!e(s)&&!r(s)&&!t(s)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.canGrid=exports.canInline=exports.isComplexArray=exports.isObject=exports.isCodemirror=void 0,exports.isCodemirror=e,exports.isObject=r,exports.isComplexArray=t,exports.canInline=function(e){if(e.properties){const r=Object.keys(e.properties);return 2===r.length&&r.filter((r=>n(e,r))).length===r.length}return!0},exports.canGrid=function(e){const r=Object.keys(e.properties);return r.length>2&&r.filter((r=>n(e,r))).length===r.length};
package/src/lib/studio.js CHANGED
@@ -1,141 +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 { html, css } from 'lit';
17
- import { classMap } from 'lit/directives/class-map';
18
- import '../atoms/gv-icon';
19
- import '../atoms/gv-tag';
20
-
21
- // language=CSS
22
- export const methods = css`
23
- gv-tag {
24
- font-family: monospace;
25
- }
26
-
27
- gv-tag.ALL {
28
- --gv-tag--bdc: #262626;
29
- --gv-tag--bgc: #262626;
30
- --gv-tag--c: white;
31
- }
32
-
33
- gv-tag.POST {
34
- --gv-tag--bdc: #fb8c00;
35
- --gv-tag--bgc: #fb8c00;
36
- --gv-tag--c: white;
37
- }
38
-
39
- gv-tag.PUT {
40
- --gv-tag--bdc: #039be5;
41
- --gv-tag--bgc: #039be5;
42
- --gv-tag--c: white;
43
- }
44
-
45
- gv-tag.GET {
46
- --gv-tag--bdc: #43a047;
47
- --gv-tag--bgc: #43a047;
48
- --gv-tag--c: white;
49
- }
50
-
51
- gv-tag.DELETE {
52
- --gv-tag--bdc: #e53935;
53
- --gv-tag--bgc: #e53935;
54
- --gv-tag--c: white;
55
- }
56
-
57
- .flow-path,
58
- .plan-name {
59
- margin-left: 0.2rem;
60
- display: flex;
61
- align-items: center;
62
- }
63
-
64
- .collection-name {
65
- margin-right: 0.5rem;
66
- --gv-icon--s: 26px;
67
- --gv-icon--c: #5a7684;
68
- --gv-icon-opacity--c: #5a7684;
69
- }
70
-
71
- .icon-type {
72
- --gv-icon--s: 26px;
73
- --gv-icon--c: #383e3f;
74
- --gv-icon-opacity--c: #5a7684;
75
- }
76
- `;
77
-
78
- export function getFlowName(flow, collectionName, withMethods = true, draggable = false, compact = true) {
79
- let rendering = [];
80
- if (flow) {
81
- if (draggable) {
82
- rendering.push(html`<gv-icon title="Drag for reorder" class="draggable-icon" shape="general:sort"></gv-icon>`);
83
- }
84
- const methods = flow.methods || [];
85
- if (flow.type != null) {
86
- let shape = null;
87
- if (flow.type.toUpperCase() === 'ROOT') {
88
- shape = 'home:earth';
89
- } else if (flow.type.toUpperCase() === 'LOGIN') {
90
- shape = 'general:shield-protected';
91
- } else if (flow.type.toUpperCase() === 'CONSENT') {
92
- shape = 'general:shield-check';
93
- } else if (flow.type.toUpperCase() === 'REGISTER') {
94
- shape = 'communication:shield-user';
95
- }
96
-
97
- if (shape != null) {
98
- rendering = [...rendering, html`<gv-icon title="${flow.type}" shape="${shape}" class="icon-type"></gv-icon>`];
99
- }
100
- } else if (withMethods) {
101
- const renderingMethods = methods.map((method) => html`<gv-tag class="${method.toUpperCase()}">${method.toUpperCase()}</gv-tag>`);
102
- if (compact && (renderingMethods.length === 9 || renderingMethods.length === 0)) {
103
- rendering = [...rendering, html`<gv-tag major title="${methods.join('\n')}">ALL</gv-tag>`];
104
- } else if (compact && renderingMethods.length >= 3) {
105
- const renderingMethodsCompact = renderingMethods.slice(0, 2);
106
- renderingMethodsCompact.push(html`<gv-tag minor title="${methods.join('\n')}">+${renderingMethods.length - 2}</gv-tag>`);
107
- rendering = [...rendering, ...renderingMethodsCompact];
108
- } else {
109
- rendering = [...rendering, ...renderingMethods];
110
- }
111
- }
112
-
113
- const classes = {
114
- 'flow-path': true,
115
- disabled: flow.disabled,
116
- };
117
-
118
- if (flow.name != null && flow.name.trim() !== '') {
119
- if (flow._dirty) {
120
- rendering.push(html`<div class="${classMap(classes)}"><mark>${flow.name}</mark></div>`);
121
- } else {
122
- rendering.push(html`<div class="${classMap(classes)}">${flow.name}</div>`);
123
- }
124
- } else if (flow['path-operator']) {
125
- const path = flow['path-operator'].path || '/';
126
- if (path) {
127
- const pathWithOperator = flow['path-operator'].operator === 'STARTS_WITH' ? `${path.endsWith('/') ? path : `${path}/`}**` : path;
128
- if (flow._dirty) {
129
- rendering.push(html`<div class="${classMap(classes)}"><mark>${pathWithOperator}</mark></div>`);
130
- } else {
131
- rendering.push(html`<div class="${classMap(classes)}">${pathWithOperator}</div>`);
132
- }
133
- }
134
- }
135
-
136
- if (collectionName) {
137
- rendering.push(html`<div class="collection-name">${collectionName}</div>`);
138
- }
139
- }
140
- return rendering;
141
- }
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFlowName=exports.methods=void 0;const t=require("lit"),e=require("lit/directives/class-map");require("../atoms/gv-icon"),require("../atoms/gv-tag"),exports.methods=t.css`gv-tag{font-family:monospace}gv-tag.ALL{--gv-tag--bdc:#262626;--gv-tag--bgc:#262626;--gv-tag--c:white}gv-tag.POST{--gv-tag--bdc:#fb8c00;--gv-tag--bgc:#fb8c00;--gv-tag--c:white}gv-tag.PUT{--gv-tag--bdc:#039be5;--gv-tag--bgc:#039be5;--gv-tag--c:white}gv-tag.GET{--gv-tag--bdc:#43a047;--gv-tag--bgc:#43a047;--gv-tag--c:white}gv-tag.DELETE{--gv-tag--bdc:#e53935;--gv-tag--bgc:#e53935;--gv-tag--c:white}.flow-path,.plan-name{margin-left:.2rem;display:flex;align-items:center}.collection-name{margin-right:.5rem;--gv-icon--s:26px;--gv-icon--c:#5a7684;--gv-icon-opacity--c:#5a7684}.icon-type{--gv-icon--s:26px;--gv-icon--c:#383e3f;--gv-icon-opacity--c:#5a7684}`,exports.getFlowName=function(a,g,s=!0,i=!1,c=!0){let l=[];if(a){i&&l.push(t.html`<gv-icon title="Drag for reorder" class="draggable-icon" shape="general:sort"></gv-icon>`);const o=a.methods||[];if(null!=a.type){let e=null;"ROOT"===a.type.toUpperCase()?e="home:earth":"LOGIN"===a.type.toUpperCase()?e="general:shield-protected":"CONSENT"===a.type.toUpperCase()?e="general:shield-check":"REGISTER"===a.type.toUpperCase()&&(e="communication:shield-user"),null!=e&&(l=[...l,t.html`<gv-icon title="${a.type}" shape="${e}" class="icon-type"></gv-icon>`])}else if(s){const e=o.map((e=>t.html`<gv-tag class="${e.toUpperCase()}">${e.toUpperCase()}</gv-tag>`));if(!c||9!==e.length&&0!==e.length)if(c&&e.length>=3){const a=e.slice(0,2);a.push(t.html`<gv-tag minor title="${o.join("\n")}">+${e.length-2}</gv-tag>`),l=[...l,...a]}else l=[...l,...e];else l=[...l,t.html`<gv-tag major title="${o.join("\n")}">ALL</gv-tag>`]}const n={"flow-path":!0,disabled:a.disabled};if(null!=a.name&&""!==a.name.trim())a._dirty?l.push(t.html`<div class="${(0,e.classMap)(n)}"><mark>${a.name}</mark></div>`):l.push(t.html`<div class="${(0,e.classMap)(n)}">${a.name}</div>`);else if(a["path-operator"]){const g=a["path-operator"].path||"/";if(g){const s="STARTS_WITH"===a["path-operator"].operator?`${g.endsWith("/")?g:`${g}/`}**`:g;a._dirty?l.push(t.html`<div class="${(0,e.classMap)(n)}"><mark>${s}</mark></div>`):l.push(t.html`<div class="${(0,e.classMap)(n)}">${s}</div>`)}}g&&l.push(t.html`<div class="collection-name">${g}</div>`)}return l};
package/src/lib/style.js CHANGED
@@ -1,41 +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
- function getPropertyValue(element, propertyName, defaultValue) {
17
- /* global getComputedStyle */
18
- const value = getComputedStyle(element).getPropertyValue(propertyName);
19
- return value.trim() || defaultValue;
20
- }
21
-
22
- export const getCssVar = function getCssVar(element, variableName, defaultValue) {
23
- if (element) {
24
- if (variableName.startsWith('--')) {
25
- return getPropertyValue(element, variableName, defaultValue);
26
- }
27
- return getPropertyValue(element, `--${variableName}`, defaultValue);
28
- }
29
- return defaultValue;
30
- };
31
-
32
- export function hexToRGB(hex) {
33
- const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex.trim());
34
- return result
35
- ? {
36
- r: parseInt(result[1], 16),
37
- g: parseInt(result[2], 16),
38
- b: parseInt(result[3], 16),
39
- }
40
- : null;
41
- }
1
+ function e(e,t,r){return getComputedStyle(e).getPropertyValue(t).trim()||r}Object.defineProperty(exports,"__esModule",{value:!0}),exports.hexToRGB=exports.getCssVar=void 0;exports.getCssVar=function(t,r,o){return t?r.startsWith("--")?e(t,r,o):e(t,`--${r}`,o):o},exports.hexToRGB=function(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e.trim());return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null};
@@ -1,69 +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
- export function loadAsciiDoctor() {
18
- if (window._gvAsciidoctor == null) {
19
- return Promise.all([import('asciidoctor'), import('asciidoctor-highlight.js')]).then(([asciidoctor, highlightJsExt]) => {
20
- window._gvAsciidoctor = asciidoctor.default();
21
- highlightJsExt.default.register(window._gvAsciidoctor.Extensions);
22
- return setAsciiDoctorAsGlobal(asciidoctor.default, highlightJsExt.default);
23
- });
24
- }
25
- return Promise.resolve(window._gvAsciidoctor);
26
- }
27
-
28
- export function setAsciiDoctorAsGlobal(asciidoctor, highlightJsExt) {
29
- if (window._gvAsciidoctor == null) {
30
- window._gvAsciidoctor = asciidoctor();
31
- highlightJsExt.register(window._gvAsciidoctor.Extensions);
32
- }
33
- return window._gvAsciidoctor;
34
- }
35
-
36
- export function toDom(text, type = 'adoc', small = false) {
37
- return loadAsciiDoctor().then((asciidoctor) => {
38
- if (text) {
39
- let innerHTML = '';
40
- if (type === 'adoc') {
41
- innerHTML = asciidoctor.convert(text, {
42
- attributes: {
43
- showtitle: true,
44
- 'source-highlighter': 'highlightjs-ext',
45
- },
46
- });
47
- } else {
48
- throw new Error(`Library not found for type : '${type}' | ${text}`);
49
- }
50
-
51
- const element = document.createElement('div');
52
- element.innerHTML = innerHTML;
53
- element.style.width = '100%';
54
- element.style.maxWidth = '1000px';
55
- element.style.margin = '0 auto';
56
- element.classList.add('markdown-body');
57
- if (small) {
58
- element.classList.add('small');
59
- }
60
- const titleElement = element.querySelector('h1');
61
- let title = '';
62
- if (titleElement) {
63
- title = titleElement.textContent;
64
- }
65
-
66
- return { title, element };
67
- }
68
- });
69
- }
1
+ var e=Object.create?function(e,t,o,r){void 0===r&&(r=o),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[o]}})}:function(e,t,o,r){void 0===r&&(r=o),e[r]=t[o]},t=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},o=function(o){if(o&&o.__esModule)return o;var r={};if(null!=o)for(var i in o)"default"!==i&&Object.prototype.hasOwnProperty.call(o,i)&&e(r,o,i);return t(r,o),r};function r(){return null==window._gvAsciidoctor?Promise.all([Promise.resolve().then((()=>o(require("asciidoctor")))),Promise.resolve().then((()=>o(require("asciidoctor-highlight.js"))))]).then((([e,t])=>(window._gvAsciidoctor=e.default(),t.default.register(window._gvAsciidoctor.Extensions),i(e.default,t.default)))):Promise.resolve(window._gvAsciidoctor)}function i(e,t){return null==window._gvAsciidoctor&&(window._gvAsciidoctor=e(),t.register(window._gvAsciidoctor.Extensions)),window._gvAsciidoctor}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toDom=exports.setAsciiDoctorAsGlobal=exports.loadAsciiDoctor=void 0,exports.loadAsciiDoctor=r,exports.setAsciiDoctorAsGlobal=i,exports.toDom=function(e,t="adoc",o=!1){return r().then((r=>{if(e){let i="";if("adoc"!==t)throw new Error(`Library not found for type : '${t}' | ${e}`);i=r.convert(e,{attributes:{showtitle:!0,"source-highlighter":"highlightjs-ext"}});const n=document.createElement("div");n.innerHTML=i,n.style.width="100%",n.style.maxWidth="1000px",n.style.margin="0 auto",n.classList.add("markdown-body"),o&&n.classList.add("small");const s=n.querySelector("h1");let c="";return s&&(c=s.textContent),{title:c,element:n}}}))};
package/src/lib/theme.js CHANGED
@@ -1,63 +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
- export function applyTheme(theme) {
17
- if (theme) {
18
- const logo = theme._links ? theme._links.logo : theme.logo;
19
- const optionalLogo = theme._links ? theme._links.optionalLogo : theme.optionalLogo;
20
- const backgroundImage = theme._links ? theme._links.backgroundImage : theme.backgroundImage;
21
- updateImage('--gv-theme-logo', logo, `url('/images/gravitee-logo-cyan.svg')`);
22
- updateImage('--gv-theme-optional-logo', optionalLogo, `url('/images/gravitee-logo-white.svg')`);
23
- updateImage('--gv-theme-homepage-background-image', backgroundImage, `none`);
24
- const favicon = theme._links ? theme._links.favicon : theme.favicon;
25
- updateFavicon(favicon, 'images/gravitee-favicon.png');
26
- theme.definition.data.forEach((component) => {
27
- component.css.forEach((cssProperty) => {
28
- document.documentElement.style.setProperty(cssProperty.name, cssProperty.value);
29
- });
30
- });
31
- }
32
- }
33
-
34
- export function updateImage(name, value, defaultValue) {
35
- setTimeout(() => {
36
- const propertyValue = value ? `url(${value})` : 'none';
37
- document.documentElement.style.setProperty(name, propertyValue);
38
- }, 0);
39
- }
40
-
41
- export function updateFavicon(value, defaultValue) {
42
- let link = document.querySelector("link[rel~='icon']");
43
- if (!link) {
44
- link = document.createElement('link');
45
- link.rel = 'icon';
46
- document.getElementsByTagName('head')[0].appendChild(link);
47
- }
48
- link.href = value || defaultValue;
49
- }
50
-
51
- export function getApplicationTypeIcon(type) {
52
- switch (type.toLowerCase()) {
53
- case 'browser':
54
- case 'web':
55
- return 'devices:laptop';
56
- case 'native':
57
- return 'devices:android';
58
- case 'backend_to_backend':
59
- return 'devices:server';
60
- default:
61
- return 'layout:layout-top-panel-2';
62
- }
63
- }
1
+ function e(e,o,t){setTimeout((()=>{const t=o?`url(${o})`:"none";document.documentElement.style.setProperty(e,t)}),0)}function o(e,o){let t=document.querySelector("link[rel~='icon']");t||(t=document.createElement("link"),t.rel="icon",document.getElementsByTagName("head")[0].appendChild(t)),t.href=e||o}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getApplicationTypeIcon=exports.updateFavicon=exports.updateImage=exports.applyTheme=void 0,exports.applyTheme=function(t){if(t){const n=t._links?t._links.logo:t.logo,a=t._links?t._links.optionalLogo:t.optionalLogo,i=t._links?t._links.backgroundImage:t.backgroundImage;e("--gv-theme-logo",n),e("--gv-theme-optional-logo",a),e("--gv-theme-homepage-background-image",i);o(t._links?t._links.favicon:t.favicon,"images/gravitee-favicon.png"),t.definition.data.forEach((e=>{e.css.forEach((e=>{document.documentElement.style.setProperty(e.name,e.value)}))}))}},exports.updateImage=e,exports.updateFavicon=o,exports.getApplicationTypeIcon=function(e){switch(e.toLowerCase()){case"browser":case"web":return"devices:laptop";case"native":return"devices:android";case"backend_to_backend":return"devices:server";default:return"layout:layout-top-panel-2"}};
package/src/lib/utils.js CHANGED
@@ -1,111 +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
- export function truncate(text, limit = 250, suffix = '...') {
17
- return text && text.length > limit ? `${text.substring(0, limit)}${suffix}` : text;
18
- }
19
-
20
- export function isSameRoutes(routes, futureRoutes) {
21
- if (routes && futureRoutes) {
22
- return JSON.stringify(routes.map((r) => r.path + r.active)) === JSON.stringify(futureRoutes.map((r) => r.path + r.active));
23
- }
24
- return false;
25
- }
26
-
27
- export function appendDraggableImage(src, size = 100, defaultIcon = 'communication:shield-thunder') {
28
- // Usefull when image src is svg
29
- const div = document.createElement('div');
30
- div.style.position = 'fixed';
31
- div.style.left = '-999px';
32
- div.style.top = '-999px';
33
- div.style.zIndex = 1000;
34
- if (src != null) {
35
- const image = new Image();
36
- image.src = src;
37
- image.style = `width:${size}px;height:${size}px`;
38
- div.appendChild(image);
39
- } else {
40
- const svgElem = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
41
- const useElem = document.createElementNS('http://www.w3.org/2000/svg', 'use');
42
- useElem.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', defaultIcon);
43
- svgElem.appendChild(useElem);
44
- div.appendChild(svgElem);
45
- }
46
- document.body.appendChild(div);
47
- return div;
48
- }
49
-
50
- export function flatDeep(arr) {
51
- return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatDeep(val) : val), []);
52
- }
53
-
54
- export function flatObject(obj, prefix = '') {
55
- return Object.keys(obj).reduce((acc, k) => {
56
- const pre = prefix.length ? prefix + '.' : '';
57
- if (Array.isArray(obj[k])) acc[pre + k] = obj[k];
58
- else if (typeof obj[k] === 'object') Object.assign(acc, flatObject(obj[k], pre + k));
59
- else acc[pre + k] = obj[k];
60
- return acc;
61
- }, {});
62
- }
63
-
64
- export function deepClone(obj) {
65
- if (obj) {
66
- return JSON.parse(JSON.stringify(obj));
67
- }
68
- return obj;
69
- }
70
-
71
- export function uuid() {
72
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
73
- const r = (Math.random() * 16) | 0;
74
- const v = c === 'x' ? r : (r & 0x3) | 0x8;
75
- return v.toString(16);
76
- });
77
- }
78
-
79
- export function deepEqual(a, b, withoutOrder = false) {
80
- if (Array.isArray(a) && Array.isArray(b) && withoutOrder) {
81
- if (a.length !== b.length) return false;
82
- const uniqueValues = new Set([...a, ...b]);
83
- for (const v of uniqueValues) {
84
- const aCount = a.filter((e) => e === v).length;
85
- const bCount = b.filter((e) => e === v).length;
86
- if (aCount !== bCount) return false;
87
- }
88
- return true;
89
- }
90
-
91
- const keys1 = a != null ? Object.keys(a) : [];
92
- const keys2 = b != null ? Object.keys(b) : [];
93
-
94
- if (keys1.length !== keys2.length) {
95
- return false;
96
- }
97
-
98
- for (const key of keys1) {
99
- const val1 = a[key];
100
- const val2 = b[key];
101
- const areObjects = isObject(val1) && isObject(val2);
102
- if ((areObjects && !deepEqual(val1, val2)) || (!areObjects && val1 !== val2)) {
103
- return false;
104
- }
105
- }
106
- return true;
107
- }
108
-
109
- export function isObject(object) {
110
- return object != null && typeof object === 'object';
111
- }
1
+ function e(e){return null!=e&&"object"==typeof e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isObject=exports.deepEqual=exports.uuid=exports.deepClone=exports.flatObject=exports.flatDeep=exports.appendDraggableImage=exports.isSameRoutes=exports.truncate=void 0,exports.truncate=function(e,t=250,r="..."){return e&&e.length>t?`${e.substring(0,t)}${r}`:e},exports.isSameRoutes=function(e,t){return!(!e||!t)&&JSON.stringify(e.map((e=>e.path+e.active)))===JSON.stringify(t.map((e=>e.path+e.active)))},exports.appendDraggableImage=function(e,t=100,r="communication:shield-thunder"){const n=document.createElement("div");if(n.style.position="fixed",n.style.left="-999px",n.style.top="-999px",n.style.zIndex=1e3,null!=e){const r=new Image;r.src=e,r.style=`width:${t}px;height:${t}px`,n.appendChild(r)}else{const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),t=document.createElementNS("http://www.w3.org/2000/svg","use");t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r),e.appendChild(t),n.appendChild(e)}return document.body.appendChild(n),n},exports.flatDeep=function e(t){return t.reduce(((t,r)=>t.concat(Array.isArray(r)?e(r):r)),[])},exports.flatObject=function e(t,r=""){return Object.keys(t).reduce(((n,o)=>{const s=r.length?r+".":"";return Array.isArray(t[o])?n[s+o]=t[o]:"object"==typeof t[o]?Object.assign(n,e(t[o],s+o)):n[s+o]=t[o],n}),{})},exports.deepClone=function(e){return e?JSON.parse(JSON.stringify(e)):e},exports.uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},exports.deepEqual=function t(r,n,o=!1){if(Array.isArray(r)&&Array.isArray(n)&&o){if(r.length!==n.length)return!1;const e=new Set([...r,...n]);for(const t of e){if(r.filter((e=>e===t)).length!==n.filter((e=>e===t)).length)return!1}return!0}const s=null!=r?Object.keys(r):[],x=null!=n?Object.keys(n):[];if(s.length!==x.length)return!1;for(const o of s){const s=r[o],x=n[o],i=e(s)&&e(x);if(i&&!t(s,x)||!i&&s!==x)return!1}return!0},exports.isObject=e;
@@ -1,165 +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 { html, css } from 'lit';
17
- import { i18n } from '../lib/i18n';
18
- import Highcharts from 'highcharts';
19
- import Highmaps from 'highcharts/highmaps';
20
- import { cache } from 'lit/directives/cache';
21
- import { withSkeletonAttribute } from './with-skeleton-attribute';
22
-
23
- /**
24
- * This is a mixin for ChartElement
25
- * @mixinFunction
26
- */
27
- export function ChartElement(ParentClass) {
28
- /**
29
- * @mixinClass
30
- */
31
- return class extends withSkeletonAttribute(ParentClass) {
32
- static get properties() {
33
- return {
34
- /** @required */
35
- series: { type: Array },
36
- options: { type: Array },
37
- _additionalOptions: { type: Object, attribute: false },
38
- _series: { type: Array, attribute: false },
39
- };
40
- }
41
-
42
- static get styles() {
43
- return [
44
- ...super.styles,
45
- // language=CSS
46
- css`
47
- :host {
48
- box-sizing: border-box;
49
- display: flex;
50
- height: 100%;
51
- width: 100%;
52
- flex-direction: column;
53
- justify-content: center;
54
- align-content: center;
55
- }
56
-
57
- .container {
58
- flex: 1;
59
- }
60
-
61
- .tooltip {
62
- display: grid;
63
- }
64
-
65
- .tooltip-2 {
66
- grid-template-columns: repeat(2, 1fr);
67
- }
68
-
69
- .tooltip-3 {
70
- grid-template-columns: repeat(3, 1fr);
71
- }
72
-
73
- .tooltip-4 {
74
- grid-template-columns: repeat(4, 1fr);
75
- }
76
-
77
- .tooltip-5 {
78
- grid-template-columns: repeat(5, 1fr);
79
- }
80
- `,
81
- ];
82
- }
83
-
84
- constructor() {
85
- super();
86
- this._skeletonAttribute = 'series';
87
- this._eventListener = function eventListener() {
88
- for (let i = 0; i < Highcharts.charts.length; i++) {
89
- Highcharts.charts[i].reflow();
90
- }
91
- };
92
- }
93
-
94
- connectedCallback() {
95
- super.connectedCallback();
96
- window.addEventListener('resize', this._eventListener);
97
- }
98
-
99
- disconnectedCallback() {
100
- super.disconnectedCallback();
101
- window.removeEventListener('resize', this._eventListener);
102
- }
103
-
104
- async getOptions() {}
105
-
106
- updated(changedProperties) {
107
- super.updated(changedProperties);
108
- if (changedProperties.has('_series')) {
109
- this.getOptions().then((options) => {
110
- this._additionalOptions = options;
111
- });
112
- }
113
- }
114
-
115
- render() {
116
- if (this._error) {
117
- return html` <div class="error">${i18n('gv-chart.error')}</div>`;
118
- }
119
- if (this._empty) {
120
- return html` <div class="empty">${i18n('gv-chart.empty')}</div>`;
121
- }
122
-
123
- const container = document.createElement('div');
124
- container.id = 'container';
125
- container.className = this._skeleton || this._additionalOptions == null ? 'skeleton' : '';
126
- container.classList.add('container');
127
-
128
- if (this._additionalOptions) {
129
- const options = {
130
- ...{
131
- chart: {
132
- height: '100%',
133
- width: '100%',
134
- },
135
- credits: {
136
- enabled: false,
137
- },
138
- title: {
139
- text: '',
140
- },
141
- time: {
142
- useUTC: false,
143
- },
144
- },
145
- ...this._additionalOptions,
146
- };
147
-
148
- const hasData = this._series && this._series.values && this._series.values[0] && this._series.values[0].data;
149
- if (hasData) {
150
- options.series = this._series && this._series.values;
151
- }
152
-
153
- setTimeout(() => {
154
- if (options.chart.map) {
155
- Highmaps.mapChart(container, options);
156
- } else {
157
- Highcharts.chart(container, options);
158
- }
159
- });
160
- }
161
-
162
- return html`${cache(container)}`;
163
- }
164
- };
165
- }
1
+ var e=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChartElement=void 0;const t=require("lit"),i=require("../lib/i18n"),r=e(require("highcharts")),s=e(require("highcharts/highmaps")),n=require("lit/directives/cache"),a=require("./with-skeleton-attribute");exports.ChartElement=function(e){return class extends((0,a.withSkeletonAttribute)(e)){static get properties(){return{series:{type:Array},options:{type:Array},_additionalOptions:{type:Object,attribute:!1},_series:{type:Array,attribute:!1}}}static get styles(){return[...super.styles,t.css`:host{box-sizing:border-box;display:flex;height:100%;width:100%;flex-direction:column;justify-content:center;align-content:center}.container{flex:1}.tooltip{display:grid}.tooltip-2{grid-template-columns:repeat(2,1fr)}.tooltip-3{grid-template-columns:repeat(3,1fr)}.tooltip-4{grid-template-columns:repeat(4,1fr)}.tooltip-5{grid-template-columns:repeat(5,1fr)}`]}constructor(){super(),this._skeletonAttribute="series",this._eventListener=function(){for(let e=0;e<r.default.charts.length;e++)r.default.charts[e].reflow()}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._eventListener)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._eventListener)}async getOptions(){}updated(e){super.updated(e),e.has("_series")&&this.getOptions().then((e=>{this._additionalOptions=e}))}render(){if(this._error)return t.html`<div class="error">${(0,i.i18n)("gv-chart.error")}</div>`;if(this._empty)return t.html`<div class="empty">${(0,i.i18n)("gv-chart.empty")}</div>`;const e=document.createElement("div");if(e.id="container",e.className=this._skeleton||null==this._additionalOptions?"skeleton":"",e.classList.add("container"),this._additionalOptions){const t={chart:{height:"100%",width:"100%"},credits:{enabled:!1},title:{text:""},time:{useUTC:!1},...this._additionalOptions};this._series&&this._series.values&&this._series.values[0]&&this._series.values[0].data&&(t.series=this._series&&this._series.values),setTimeout((()=>{t.chart.map?s.default.mapChart(e,t):r.default.chart(e,t)}))}return t.html`${(0,n.cache)(e)}`}}};