@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,116 +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 { css, LitElement, html } from 'lit';
17
-
18
- /**
19
- * Dropdown menu
20
- *
21
- * @slot - The element which must be clicked to open the actions
22
- * @slot actions - Element that contains actions
23
- *
24
- * @attr {Boolean} open - true, if menu should be open
25
- * @attr {Boolean} right - true, if actions should at right of container when opened
26
- */
27
- export class GvDropdownMenu extends LitElement {
28
- static get properties() {
29
- return {
30
- open: { type: Boolean, reflect: true },
31
- right: { type: Boolean, reflect: true },
32
- };
33
- }
34
-
35
- static get styles() {
36
- return [
37
- // language=CSS
38
- css`
39
- :host {
40
- box-sizing: border-box;
41
- display: block;
42
- }
43
-
44
- .actions {
45
- position: absolute;
46
- background-color: white;
47
- transition: all 300ms ease-in-out;
48
- border-style: solid;
49
- border-color: #bfbfbf;
50
- border-width: var(--gv-dropdown-menu--bdw, 1px 1px 1px 1px);
51
- z-index: 201;
52
- padding: var(--gv-dropdown-menu--p, 0.5rem);
53
- visibility: hidden;
54
- opacity: 0;
55
- display: grid;
56
- grid-gap: var(--gv-dropdown-menu--gg, 0.2rem);
57
- bottom: 0;
58
- top: 0;
59
- }
60
-
61
- :host([open]) .actions {
62
- opacity: 1;
63
- visibility: visible;
64
- cursor: pointer;
65
- }
66
-
67
- :host([right]) .actions {
68
- right: 0px;
69
- }
70
- `,
71
- ];
72
- }
73
-
74
- constructor() {
75
- super();
76
- this.open = false;
77
- this.right = false;
78
- this._handleDocumentClick = this._onDocumentClick.bind(this);
79
- }
80
-
81
- connectedCallback() {
82
- super.connectedCallback();
83
- }
84
-
85
- disconnectedCallback() {
86
- window.removeEventListener('click', this._handleDocumentClick);
87
- super.disconnectedCallback();
88
- }
89
-
90
- _onDocumentClick() {
91
- this.open = false;
92
- window.removeEventListener('click', this._handleDocumentClick);
93
- }
94
-
95
- toggle() {
96
- this.open = !this.open;
97
- setTimeout(() => {
98
- if (this.open) {
99
- window.addEventListener('click', this._handleDocumentClick);
100
- } else {
101
- window.removeEventListener('click', this._handleDocumentClick);
102
- }
103
- }, 0);
104
- }
105
-
106
- render() {
107
- return html`<div class="box">
108
- <slot @click="${this.toggle}"></slot>
109
- <div class="actions">
110
- <slot name="action" class="action"></slot>
111
- </div>
112
- </div>`;
113
- }
114
- }
115
-
116
- window.customElements.define('gv-dropdown-menu', GvDropdownMenu);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvDropdownMenu=void 0;const e=require("lit");class t extends e.LitElement{static get properties(){return{open:{type:Boolean,reflect:!0},right:{type:Boolean,reflect:!0}}}static get styles(){return[e.css`:host{box-sizing:border-box;display:block}.actions{position:absolute;background-color:#fff;transition:all .3s ease-in-out;border-style:solid;border-color:#bfbfbf;border-width:var(--gv-dropdown-menu--bdw,1px 1px 1px 1px);z-index:201;padding:var(--gv-dropdown-menu--p,.5rem);visibility:hidden;opacity:0;display:grid;grid-gap:var(--gv-dropdown-menu--gg,.2rem);bottom:0;top:0}:host([open]) .actions{opacity:1;visibility:visible;cursor:pointer}:host([right]) .actions{right:0}`]}constructor(){super(),this.open=!1,this.right=!1,this._handleDocumentClick=this._onDocumentClick.bind(this)}connectedCallback(){super.connectedCallback()}disconnectedCallback(){window.removeEventListener("click",this._handleDocumentClick),super.disconnectedCallback()}_onDocumentClick(){this.open=!1,window.removeEventListener("click",this._handleDocumentClick)}toggle(){this.open=!this.open,setTimeout((()=>{this.open?window.addEventListener("click",this._handleDocumentClick):window.removeEventListener("click",this._handleDocumentClick)}),0)}render(){return e.html`<div class="box"><slot @click="${this.toggle}"></slot><div class="actions"><slot name="action" class="action"></slot></div></div>`}}exports.GvDropdownMenu=t,window.customElements.define("gv-dropdown-menu",t);
@@ -1,122 +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 { css, html, LitElement } from 'lit';
17
- import { link } from '../styles/link';
18
- import { classMap } from 'lit/directives/class-map';
19
- import { dispatchCustomEvent } from '../lib/events';
20
-
21
- /**
22
- * Expandable component
23
- *
24
- * @fires gv-expandable:toggle - When user toggle
25
- *
26
- * @attr {Boolean} open - When true, opens details by default
27
- * @attr {String} icon - An icon to show open feature
28
- * @attr {String} icon-opened - An icon to show close feature
29
- * @attr {Boolean} clickable - When true, details is clickable like summary
30
- *
31
- * @cssprop {String} [--gv-expandable--bdb=var(--gv-expandable--bdb, thin solid var(--gv-theme-color, #5a7684)] - Border bottom
32
- */
33
- export class GvExpandable extends LitElement {
34
- constructor() {
35
- super();
36
- this.open = false;
37
- this.icon = 'navigation:angle-left';
38
- this.iconOpened = 'navigation:angle-down';
39
- this.clickable = false;
40
- }
41
-
42
- static get properties() {
43
- return {
44
- open: { type: Boolean, reflect: true },
45
- icon: { type: String },
46
- iconOpened: { type: String, attribute: 'icon-opened' },
47
- clickable: { type: Boolean },
48
- };
49
- }
50
-
51
- static get styles() {
52
- return [
53
- link,
54
- // language=CSS
55
- css`
56
- :host {
57
- box-sizing: border-box;
58
- }
59
-
60
- .box {
61
- padding: 0.2rem;
62
- line-height: 23px;
63
- border-bottom: var(--gv-expandable--bdb, thin solid var(--gv-theme-color, #5a7684));
64
- }
65
-
66
- :host([open]) .details {
67
- visibility: visible;
68
- opacity: 1;
69
- height: auto;
70
- overflow: visible;
71
- }
72
-
73
- .details {
74
- display: block;
75
- overflow: hidden;
76
- opacity: 0;
77
- visibility: hidden;
78
- transition: all 150ms ease-in-out;
79
- height: 0;
80
- }
81
-
82
- .summary {
83
- display: flex;
84
- flex-direction: row;
85
- align-content: center;
86
- justify-content: space-between;
87
- }
88
-
89
- .expand {
90
- align-self: center;
91
- margin-left: 5px;
92
- --gv-icon--s: 16px;
93
- }
94
- `,
95
- ];
96
- }
97
-
98
- _onClick(event) {
99
- if (!this.clickable) {
100
- const summary = this.shadowRoot.querySelector('.summary');
101
- if (!summary.contains(event.target) && event.target.slot !== 'summary') {
102
- return;
103
- }
104
- }
105
- this.open = !this.open;
106
- dispatchCustomEvent(this, 'toggle', { open: this.open });
107
- }
108
-
109
- render() {
110
- const icon = this.open ? this.iconOpened : this.icon;
111
- return html`<div class="${classMap({ box: true, link: this.clickable })}" @click=${this._onClick}>
112
- <div class="${classMap({ summary: true, link: !this.clickable })}">
113
- <slot name="summary"></slot>
114
-
115
- <gv-icon shape="${icon}" class="expand"></gv-icon>
116
- </div>
117
- <slot name="details" class="details"></slot>
118
- </div>`;
119
- }
120
- }
121
-
122
- window.customElements.define('gv-expandable', GvExpandable);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvExpandable=void 0;const e=require("lit"),i=require("../styles/link"),t=require("lit/directives/class-map"),s=require("../lib/events");class n extends e.LitElement{constructor(){super(),this.open=!1,this.icon="navigation:angle-left",this.iconOpened="navigation:angle-down",this.clickable=!1}static get properties(){return{open:{type:Boolean,reflect:!0},icon:{type:String},iconOpened:{type:String,attribute:"icon-opened"},clickable:{type:Boolean}}}static get styles(){return[i.link,e.css`:host{box-sizing:border-box}.box{padding:.2rem;line-height:23px;border-bottom:var(--gv-expandable--bdb,thin solid var(--gv-theme-color,#5a7684))}:host([open]) .details{visibility:visible;opacity:1;height:auto;overflow:visible}.details{display:block;overflow:hidden;opacity:0;visibility:hidden;transition:all 150ms ease-in-out;height:0}.summary{display:flex;flex-direction:row;align-content:center;justify-content:space-between}.expand{align-self:center;margin-left:5px;--gv-icon--s:16px}`]}_onClick(e){if(!this.clickable){if(!this.shadowRoot.querySelector(".summary").contains(e.target)&&"summary"!==e.target.slot)return}this.open=!this.open,(0,s.dispatchCustomEvent)(this,"toggle",{open:this.open})}render(){const i=this.open?this.iconOpened:this.icon;return e.html`<div class="${(0,t.classMap)({box:!0,link:this.clickable})}" @click="${this._onClick}"><div class="${(0,t.classMap)({summary:!0,link:!this.clickable})}"><slot name="summary"></slot><gv-icon shape="${i}" class="expand"></gv-icon></div><slot name="details" class="details"></slot></div>`}}exports.GvExpandable=n,window.customElements.define("gv-expandable",n);
@@ -1,270 +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 { GvCode } from '../molecules/gv-code';
17
- import { dispatchCustomEvent } from '../lib/events';
18
- import { pickedCompletion, startCompletion } from '@codemirror/autocomplete';
19
- import { keymap } from '@codemirror/view';
20
- import { EditorSelection, Prec } from '@codemirror/state';
21
- import { get } from 'object-path';
22
-
23
- /**
24
- * Expression Language component
25
- *
26
- * @fires gv-expression-language:input - input events with the `value` on `detail`
27
- * @fires gv-expression-language:ready - event dispatch when component is ready
28
- * @fires gv-expression-language:clipboard-copy - event dispatch when component the `value` has been copied to clipboard
29
- *
30
- * @attr {String} label - code language
31
- * @attr {String} value - code content to be highlighted
32
- * @attr {options} Object - options based on codemirror
33
- * @attr {String} placeholder - an example value to display in the input when empty
34
- * @attr {Number} rows - number of rows of the text element
35
- * @attr {Boolean} large - for a large input (only if the field has one row)
36
- * @attr {Boolean} medium - for a medium input (only if the field has one row) (Default)
37
- * @attr {Boolean} small - for a small input (only if the field has one row)
38
- * @attr {Object} grammar - The grammar for Expression Language support
39
- *
40
- * @attr {Boolean} [clipboard=false]- true if field has clipboard button
41
- * @attr {Boolean} [autofocus=false] - true to put the focus on the input
42
- * @attr {Boolean} [readonly=false] - true if field is readonly mode
43
- */
44
- export class GvExpressionLanguage extends GvCode {
45
- static get properties() {
46
- return {
47
- ...super.properties,
48
- grammar: { type: Object },
49
- };
50
- }
51
-
52
- firstUpdated() {
53
- super.firstUpdated();
54
- dispatchCustomEvent(this, 'ready', { currentTarget: this });
55
- }
56
-
57
- getExtensions() {
58
- return [Prec.high(this.insertELKeymap())];
59
- }
60
-
61
- insertELKeymap() {
62
- return keymap.of([
63
- {
64
- key: 'Ctrl-Shift-e',
65
- mac: 'Cmd-Shift-e',
66
- run(view) {
67
- view.dispatch(
68
- view.state.changeByRange((range) => ({
69
- changes: [{ from: range.from, to: range.to, insert: '{#}' }],
70
- range: EditorSelection.range(range.from + 2, range.from + 2),
71
- })),
72
- );
73
- startCompletion(view);
74
- return true;
75
- },
76
- },
77
- ]);
78
- }
79
-
80
- buildMethods(type) {
81
- const modelType = this.getModelType(type);
82
- return modelType.methods.map(({ name, params = [], returnType }) => {
83
- const command = `${name}()`;
84
- const displayParams = params.map((p) => `${p.type} ${p.name}`);
85
- const label = `${name}(${displayParams.join(', ')})`;
86
- const detail = `return ${returnType}`;
87
- return {
88
- type: 'method',
89
- command,
90
- apply: (view, completion, from, to) => {
91
- const anchor = from + name.length + 1;
92
- view.dispatch({
93
- changes: { from, to, insert: completion.command },
94
- selection: { anchor },
95
- userEvent: 'input.complete',
96
- annotations: pickedCompletion.of(view),
97
- });
98
- },
99
- label,
100
- detail,
101
- };
102
- });
103
- }
104
-
105
- findBestAutocompleteHandler(completionContext) {
106
- return this.expressionLanguageCompletionHandlers
107
- .filter((handler) => (this.grammar != null && handler.supportEL === true) || handler.supportEL !== true)
108
- .map((handler) => {
109
- const match = handler.expr ? completionContext.matchBefore(handler.expr) : true;
110
- return { handler, match };
111
- })
112
- .find(({ match, expr }) => match);
113
- }
114
-
115
- getModelType(typeId) {
116
- if (this.grammar != null) {
117
- return get(this.grammar, `_types.${typeId}`);
118
- }
119
- return null;
120
- }
121
-
122
- isMap(typeId) {
123
- return ['Map', 'HttpHeaders', 'MultiValueMap'].includes(typeId);
124
- }
125
-
126
- getEnum(typeId) {
127
- if (this.grammar != null) {
128
- return get(this.grammar, `_enums.${typeId}`);
129
- }
130
- return [''];
131
- }
132
-
133
- convertType(type) {
134
- if (type) {
135
- const lowerType = type.toLowerCase();
136
- if (lowerType === 'string') {
137
- return 'text';
138
- } else if (lowerType === 'httpheaders' || lowerType === 'multivaluemap') {
139
- return 'type';
140
- } else if (lowerType === 'int' || lowerType === 'long') {
141
- return 'variable';
142
- } else if (lowerType.includes('[]')) {
143
- return 'enum';
144
- }
145
- }
146
- return 'variable';
147
- }
148
-
149
- get expressionLanguageCompletionHandlers() {
150
- return [
151
- {
152
- expr: /{#[a-z]*/,
153
- supportEL: true,
154
- run(completionContext, match) {
155
- const prefix = match.text.replaceAll('{#', '');
156
- const from = completionContext.pos - prefix.length;
157
- const options = Object.keys(this.grammar)
158
- .filter((command) => !command.startsWith('_') && command.startsWith(prefix))
159
- .map((command) => {
160
- return {
161
- type: 'variable',
162
- command,
163
- apply: command,
164
- label: command,
165
- };
166
- });
167
- return { from, options };
168
- },
169
- },
170
- {
171
- expr: /{#[a-z]*.[a-zA-Z]*/,
172
- supportEL: true,
173
- run(completionContext, match) {
174
- const tokens = match.text.split('.');
175
- const key = tokens[0].replaceAll('{#', '');
176
- const prefix = tokens[1];
177
- let candidate = this.grammar[key][prefix];
178
- let options = [];
179
- let from = completionContext.pos;
180
- if (candidate) {
181
- if (this.isMap(candidate._type)) {
182
- options = this.getEnum(candidate._type).map((value) => {
183
- const type = this.convertType(candidate._type);
184
- const command = `['${value}'][0]`;
185
- return {
186
- type,
187
- command,
188
- apply: command,
189
- label: value,
190
- };
191
- });
192
- }
193
- } else {
194
- from -= prefix.length;
195
- candidate = this.grammar[key];
196
- if (candidate._type) {
197
- options = this.buildMethods(candidate._type);
198
- } else {
199
- options = Object.keys(candidate)
200
- .filter((command) => !command.startsWith('_') && command.startsWith(prefix))
201
- .map((command) => ({
202
- type: this.convertType(candidate[command]._type),
203
- command,
204
- apply: command,
205
- label: command,
206
- }));
207
- }
208
- }
209
- return { from, options };
210
- },
211
- },
212
- {
213
- expr: /{#[a-z]*.[a-zA-Z]*.[a-zA-Z]*/,
214
- supportEL: true,
215
- run(completionContext, match) {
216
- const tokens = match.text.split('.');
217
- const key = tokens[0].replaceAll('{#', '');
218
- const word = tokens[1];
219
- const prefix = tokens[2];
220
- const candidate = this.grammar[key][word];
221
- let options = [];
222
- let from = completionContext.pos;
223
- if (candidate) {
224
- if (this.isMap(candidate._type)) {
225
- options = this.getEnum(candidate._type)
226
- .filter((command) => !command.startsWith('_') && command.startsWith(prefix))
227
- .map((label) => {
228
- const type = this.convertType(candidate._type);
229
- return {
230
- type,
231
- command: `['${label}'][0]`,
232
- apply(view, completion, _from, to) {
233
- from = _from - prefix.length - 1;
234
- view.dispatch({
235
- changes: { from, to, insert: completion.command },
236
- selection: { anchor: from + completion.command.length },
237
- userEvent: 'input.complete',
238
- annotations: pickedCompletion.of(view),
239
- });
240
- },
241
- label,
242
- };
243
- });
244
- } else {
245
- if (candidate._type) {
246
- options = this.buildMethods(candidate._type);
247
- } else {
248
- from -= prefix.length;
249
- options = Object.keys(candidate)
250
- .filter((command) => command.startsWith(prefix))
251
- .map((command) => {
252
- return {
253
- type: this.convertType(candidate[command]._type),
254
- command,
255
- apply: command,
256
- label: command,
257
- };
258
- });
259
- }
260
- }
261
- }
262
- return { from, options };
263
- },
264
- },
265
- this.defaultCompletionHandler,
266
- ];
267
- }
268
- }
269
-
270
- window.customElements.define('gv-expression-language', GvExpressionLanguage);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvExpressionLanguage=void 0;const e=require("../molecules/gv-code"),t=require("../lib/events"),r=require("@codemirror/autocomplete"),a=require("@codemirror/view"),s=require("@codemirror/state"),n=require("object-path");class p extends e.GvCode{static get properties(){return{...super.properties,grammar:{type:Object}}}firstUpdated(){super.firstUpdated(),(0,t.dispatchCustomEvent)(this,"ready",{currentTarget:this})}getExtensions(){return[s.Prec.high(this.insertELKeymap())]}insertELKeymap(){return a.keymap.of([{key:"Ctrl-Shift-e",mac:"Cmd-Shift-e",run:e=>(e.dispatch(e.state.changeByRange((e=>({changes:[{from:e.from,to:e.to,insert:"{#}"}],range:s.EditorSelection.range(e.from+2,e.from+2)})))),(0,r.startCompletion)(e),!0)}])}buildMethods(e){return this.getModelType(e).methods.map((({name:e,params:t=[],returnType:a})=>{const s=`${e}()`,n=t.map((e=>`${e.type} ${e.name}`));return{type:"method",command:s,apply:(t,a,s,n)=>{const p=s+e.length+1;t.dispatch({changes:{from:s,to:n,insert:a.command},selection:{anchor:p},userEvent:"input.complete",annotations:r.pickedCompletion.of(t)})},label:`${e}(${n.join(", ")})`,detail:`return ${a}`}}))}findBestAutocompleteHandler(e){return this.expressionLanguageCompletionHandlers.filter((e=>null!=this.grammar&&!0===e.supportEL||!0!==e.supportEL)).map((t=>({handler:t,match:!t.expr||e.matchBefore(t.expr)}))).find((({match:e,expr:t})=>e))}getModelType(e){return null!=this.grammar?(0,n.get)(this.grammar,`_types.${e}`):null}isMap(e){return["Map","HttpHeaders","MultiValueMap"].includes(e)}getEnum(e){return null!=this.grammar?(0,n.get)(this.grammar,`_enums.${e}`):[""]}convertType(e){if(e){const t=e.toLowerCase();if("string"===t)return"text";if("httpheaders"===t||"multivaluemap"===t)return"type";if("int"===t||"long"===t)return"variable";if(t.includes("[]"))return"enum"}return"variable"}get expressionLanguageCompletionHandlers(){return[{expr:/{#[a-z]*/,supportEL:!0,run(e,t){const r=t.text.replaceAll("{#","");return{from:e.pos-r.length,options:Object.keys(this.grammar).filter((e=>!e.startsWith("_")&&e.startsWith(r))).map((e=>({type:"variable",command:e,apply:e,label:e})))}}},{expr:/{#[a-z]*.[a-zA-Z]*/,supportEL:!0,run(e,t){const r=t.text.split("."),a=r[0].replaceAll("{#",""),s=r[1];let n=this.grammar[a][s],p=[],i=e.pos;return n?this.isMap(n._type)&&(p=this.getEnum(n._type).map((e=>{const t=`['${e}'][0]`;return{type:this.convertType(n._type),command:t,apply:t,label:e}}))):(i-=s.length,n=this.grammar[a],p=n._type?this.buildMethods(n._type):Object.keys(n).filter((e=>!e.startsWith("_")&&e.startsWith(s))).map((e=>({type:this.convertType(n[e]._type),command:e,apply:e,label:e})))),{from:i,options:p}}},{expr:/{#[a-z]*.[a-zA-Z]*.[a-zA-Z]*/,supportEL:!0,run(e,t){const a=t.text.split("."),s=a[0].replaceAll("{#",""),n=a[1],p=a[2],i=this.grammar[s][n];let o=[],l=e.pos;return i&&(this.isMap(i._type)?o=this.getEnum(i._type).filter((e=>!e.startsWith("_")&&e.startsWith(p))).map((e=>({type:this.convertType(i._type),command:`['${e}'][0]`,apply(e,t,a,s){l=a-p.length-1,e.dispatch({changes:{from:l,to:s,insert:t.command},selection:{anchor:l+t.command.length},userEvent:"input.complete",annotations:r.pickedCompletion.of(e)})},label:e}))):i._type?o=this.buildMethods(i._type):(l-=p.length,o=Object.keys(i).filter((e=>e.startsWith(p))).map((e=>({type:this.convertType(i[e]._type),command:e,apply:e,label:e}))))),{from:l,options:o}}},this.defaultCompletionHandler]}}exports.GvExpressionLanguage=p,window.customElements.define("gv-expression-language",p);
@@ -1,148 +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 { css, LitElement, html } from 'lit';
17
- import jdenticon from 'jdenticon';
18
- import { skeleton } from '../styles/skeleton';
19
- import { styleMap } from 'lit/directives/style-map';
20
- import '../atoms/gv-image';
21
-
22
- /**
23
- * Identity picture component
24
- *
25
- * ## Details
26
- * * has @theme facet
27
- *
28
- * @attr {String} picture - the picture
29
- * @attr {String} display_name - the display_name of the picture
30
- * @attr {Boolean} notification - true to display a notification info
31
- * @attr {Boolean} rounded - true for rounded image/icon
32
- *
33
- * @cssprop {Color} [--gv-identity-picture-notification--bgc=var(--gv-theme-color-light, #86c3d0)] - Notification background color
34
- */
35
- export class GvIdentityPicture extends LitElement {
36
- static get properties() {
37
- return {
38
- picture: { type: String },
39
- display_name: { type: String },
40
- _error: { type: Boolean, attribute: false },
41
- notification: { type: Boolean },
42
- rounded: { type: Boolean, reflect: true },
43
- skeleton: { type: Boolean },
44
- };
45
- }
46
-
47
- static get styles() {
48
- return [
49
- skeleton,
50
- // language=CSS
51
- css`
52
- :host {
53
- display: block;
54
- position: relative;
55
- }
56
-
57
- div {
58
- text-align: center;
59
- }
60
-
61
- svg,
62
- .skeleton {
63
- width: auto;
64
- height: auto;
65
- max-width: 100%;
66
- max-height: 100%;
67
- }
68
-
69
- gv-image {
70
- width: 100%;
71
- height: 100%;
72
- --gv-image--of: contain;
73
- }
74
-
75
- :host([rounded]) gv-image,
76
- :host([rounded]) svg {
77
- border: 2px solid var(--gv-theme-neutral-color-lighter, #fafafa);
78
- border-radius: 50%;
79
- box-sizing: border-box;
80
- --gv-image--of: cover;
81
- }
82
-
83
- .notification {
84
- position: absolute;
85
- width: 8px;
86
- height: 8px;
87
- background-clip: padding-box;
88
- border-radius: 50%;
89
- background-color: var(--gv-identity-picture-notification--bgc, var(--gv-theme-color-light, #86c3d0));
90
- }
91
- `,
92
- ];
93
- }
94
-
95
- _onError() {
96
- this._error = true;
97
- }
98
-
99
- _toNumber(size) {
100
- return parseInt(size.replace('px', ''), 10);
101
- }
102
-
103
- _onLoaded() {
104
- this._error = false;
105
- }
106
-
107
- _getMaxSize(width, height) {
108
- return Math.min(this._toNumber(width), this._toNumber(height));
109
- }
110
-
111
- updated(properties) {
112
- if (properties.has('picture')) {
113
- this._error = false;
114
- }
115
- }
116
-
117
- render() {
118
- const { width, height } = window.getComputedStyle(this);
119
- if ((!this.picture || this._error) && width && height) {
120
- const size = this._getMaxSize(width, height);
121
- const container = document.createElement('div');
122
- if (this.skeleton) {
123
- container.classList.add('skeleton');
124
- }
125
- container.title = this.display_name;
126
- container.innerHTML = jdenticon.toSvg(this.display_name, size, { backColor: '#FFF' });
127
- if (this.notification) {
128
- const notification = document.createElement('span');
129
- notification.className = 'notification';
130
- notification.style.left = width;
131
- container.appendChild(notification);
132
- }
133
- return html`${container}`;
134
- }
135
- return html`
136
- <gv-image
137
- src="${this.picture}"
138
- alt="${this.display_name}"
139
- title="${this.display_name}"
140
- @error="${this._onError}"
141
- @gv-image:loaded="${this._onLoaded}"
142
- ></gv-image>
143
- ${this.notification ? html`<span class="notification" style="${styleMap({ left: width })}"></span>` : ''}
144
- `;
145
- }
146
- }
147
-
148
- window.customElements.define('gv-identity-picture', GvIdentityPicture);
1
+ var e=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvIdentityPicture=void 0;const t=require("lit"),i=e(require("jdenticon")),r=require("../styles/skeleton"),o=require("lit/directives/style-map");require("../atoms/gv-image");class n extends t.LitElement{static get properties(){return{picture:{type:String},display_name:{type:String},_error:{type:Boolean,attribute:!1},notification:{type:Boolean},rounded:{type:Boolean,reflect:!0},skeleton:{type:Boolean}}}static get styles(){return[r.skeleton,t.css`:host{display:block;position:relative}div{text-align:center}.skeleton,svg{width:auto;height:auto;max-width:100%;max-height:100%}gv-image{width:100%;height:100%;--gv-image--of:contain}:host([rounded]) gv-image,:host([rounded]) svg{border:2px solid var(--gv-theme-neutral-color-lighter,#fafafa);border-radius:50%;box-sizing:border-box;--gv-image--of:cover}.notification{position:absolute;width:8px;height:8px;background-clip:padding-box;border-radius:50%;background-color:var(--gv-identity-picture-notification--bgc,var(--gv-theme-color-light,#86c3d0))}`]}_onError(){this._error=!0}_toNumber(e){return parseInt(e.replace("px",""),10)}_onLoaded(){this._error=!1}_getMaxSize(e,t){return Math.min(this._toNumber(e),this._toNumber(t))}updated(e){e.has("picture")&&(this._error=!1)}render(){const{width:e,height:r}=window.getComputedStyle(this);if((!this.picture||this._error)&&e&&r){const o=this._getMaxSize(e,r),n=document.createElement("div");if(this.skeleton&&n.classList.add("skeleton"),n.title=this.display_name,n.innerHTML=i.default.toSvg(this.display_name,o,{backColor:"#FFF"}),this.notification){const t=document.createElement("span");t.className="notification",t.style.left=e,n.appendChild(t)}return t.html`${n}`}return t.html`<gv-image src="${this.picture}" alt="${this.display_name}" title="${this.display_name}" @error="${this._onError}" @gv-image:loaded="${this._onLoaded}"></gv-image>${this.notification?t.html`<span class="notification" style="${(0,o.styleMap)({left:e})}"></span>`:""}`}}exports.GvIdentityPicture=n,window.customElements.define("gv-identity-picture",n);