nexmo-oas-renderer 0.10.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +135 -0
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +15 -0
  5. data/Gemfile +2 -2
  6. data/Gemfile.lock +94 -74
  7. data/README.md +8 -0
  8. data/Rakefile +2 -2
  9. data/bin/console +3 -3
  10. data/lib/nexmo/oas/engine.rb +2 -0
  11. data/lib/nexmo/oas/renderer.rb +5 -5
  12. data/lib/nexmo/oas/renderer/app.rb +79 -40
  13. data/lib/nexmo/oas/renderer/config.ru +4 -2
  14. data/lib/nexmo/oas/renderer/decorators/response_parser_decorator.rb +18 -18
  15. data/lib/nexmo/oas/renderer/helpers/navigation.rb +2 -2
  16. data/lib/nexmo/oas/renderer/helpers/render.rb +2 -1
  17. data/lib/nexmo/oas/renderer/helpers/summary.rb +4 -1
  18. data/lib/nexmo/oas/renderer/helpers/url.rb +2 -0
  19. data/lib/nexmo/oas/renderer/presenters/api_specification.rb +2 -1
  20. data/lib/nexmo/oas/renderer/presenters/endpoint.rb +2 -0
  21. data/lib/nexmo/oas/renderer/presenters/groups.rb +4 -0
  22. data/lib/nexmo/oas/renderer/presenters/navigation.rb +2 -0
  23. data/lib/nexmo/oas/renderer/presenters/open_api_specification.rb +5 -2
  24. data/lib/nexmo/oas/renderer/presenters/request_body_raw.rb +141 -0
  25. data/lib/nexmo/oas/renderer/presenters/response_format.rb +4 -2
  26. data/lib/nexmo/oas/renderer/presenters/response_tab/link.rb +3 -0
  27. data/lib/nexmo/oas/renderer/presenters/response_tab/panel.rb +8 -5
  28. data/lib/nexmo/oas/renderer/presenters/response_tabs.rb +6 -2
  29. data/lib/nexmo/oas/renderer/presenters/versions.rb +11 -10
  30. data/lib/nexmo/oas/renderer/public/assets/javascripts/components/format.js +12 -7
  31. data/lib/nexmo/oas/renderer/public/assets/javascripts/nexmo-oas-renderer.js +51 -24
  32. data/lib/nexmo/oas/renderer/public/assets/javascripts/popper.min.js +5 -0
  33. data/lib/nexmo/oas/renderer/public/assets/javascripts/tooltip.min.js +5 -0
  34. data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.accordion.js +301 -243
  35. data/lib/nexmo/oas/renderer/public/assets/javascripts/volta.tooltip.js +76 -0
  36. data/lib/nexmo/oas/renderer/public/assets/stylesheets/nexmo-oas-renderer.css +255 -823
  37. data/lib/nexmo/oas/renderer/public/assets/stylesheets/nexmo-oas-renderer.css.map +2 -2
  38. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/api.scss +287 -90
  39. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/style.scss +2 -6
  40. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/themes/dark.scss +89 -0
  41. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/themes/light.scss +68 -0
  42. data/lib/nexmo/oas/renderer/public/assets/stylesheets/volta-prism.min.css +1 -1
  43. data/lib/nexmo/oas/renderer/public/assets/stylesheets/volta.min.css +1 -1
  44. data/lib/nexmo/oas/renderer/services/oas_parser.rb +2 -0
  45. data/lib/nexmo/oas/renderer/services/open_api_definition_resolver.rb +3 -1
  46. data/lib/nexmo/oas/renderer/version.rb +3 -1
  47. data/lib/nexmo/oas/renderer/views/layouts/_head.erb +1 -0
  48. data/lib/nexmo/oas/renderer/views/layouts/_javascripts.erb +5 -4
  49. data/lib/nexmo/oas/renderer/views/layouts/open_api.erb +3 -1
  50. data/lib/nexmo/oas/renderer/views/open_api/_auth.erb +74 -0
  51. data/lib/nexmo/oas/renderer/views/open_api/_available_endpoints.erb +25 -0
  52. data/lib/nexmo/oas/renderer/views/open_api/_callback_endpoint.erb +18 -27
  53. data/lib/nexmo/oas/renderer/views/open_api/_callbacks.erb +5 -0
  54. data/lib/nexmo/oas/renderer/views/open_api/_endpoint.erb +39 -124
  55. data/lib/nexmo/oas/renderer/views/open_api/_header.erb +71 -0
  56. data/lib/nexmo/oas/renderer/views/open_api/_model.erb +31 -26
  57. data/lib/nexmo/oas/renderer/views/open_api/_navigation.erb +54 -78
  58. data/lib/nexmo/oas/renderer/views/open_api/_parameter_groups.erb +2 -5
  59. data/lib/nexmo/oas/renderer/views/open_api/_parameters.erb +98 -153
  60. data/lib/nexmo/oas/renderer/views/open_api/_request_json.erb +4 -0
  61. data/lib/nexmo/oas/renderer/views/open_api/_request_one_of.erb +70 -0
  62. data/lib/nexmo/oas/renderer/views/open_api/_request_single.erb +53 -0
  63. data/lib/nexmo/oas/renderer/views/open_api/_requests.erb +22 -0
  64. data/lib/nexmo/oas/renderer/views/open_api/_response_description_parameters.erb +88 -90
  65. data/lib/nexmo/oas/renderer/views/open_api/_response_descriptions.erb +17 -12
  66. data/lib/nexmo/oas/renderer/views/open_api/_response_fields.erb +1 -16
  67. data/lib/nexmo/oas/renderer/views/open_api/_response_tabs.erb +2 -2
  68. data/lib/nexmo/oas/renderer/views/open_api/_responses.erb +35 -0
  69. data/lib/nexmo/oas/renderer/views/open_api/_tabbed_parameters.erb +15 -4
  70. data/lib/nexmo/oas/renderer/views/open_api/_tabbed_single_parameter.erb +56 -0
  71. data/lib/nexmo/oas/renderer/views/open_api/_webhooks.erb +30 -0
  72. data/lib/nexmo/oas/renderer/views/open_api/show.erb +10 -115
  73. data/nexmo-oas-renderer.gemspec +26 -26
  74. metadata +59 -48
  75. data/lib/nexmo/oas/renderer/public/assets/javascripts/components/scroll.js +0 -21
  76. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/core.scss +0 -137
  77. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/navigation.scss +0 -102
  78. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/nexmo.scss +0 -61
  79. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/syntax.scss +0 -63
  80. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/typography.scss +0 -248
  81. data/lib/nexmo/oas/renderer/public/assets/stylesheets/sass/volta-templates.scss +0 -119
@@ -4,246 +4,304 @@
4
4
  * Accordions (requires core)
5
5
  */
6
6
 
7
- 'use strict';
8
-
9
- Volta.accordion = function () {
10
- var _class = {
11
- standard: {
12
- container: 'Vlt-accordion',
13
- containerGroup: 'Vlt-accordion--group',
14
- trigger: 'Vlt-accordion__trigger',
15
- triggerActive: 'Vlt-accordion__trigger_active',
16
- content: 'Vlt-accordion__content',
17
- contentOpen: 'Vlt-accordion__content_open',
18
- contentOpening: 'Vlt-accordion__content_opening',
19
- contentClosing: 'Vlt-accordion__content_closing',
20
- },
21
- js: {
22
- content: 'Vlt-js-accordion__content',
23
- contentOpen: 'Vlt-js-accordion__content_open',
24
- contentOpening: 'Vlt-js-accordion__content_opening',
25
- contentClosing: 'Vlt-js-accordion__content_closing',
26
- trigger: 'Vlt-js-accordion__trigger',
27
- triggerActive: 'Vlt-js-accordion__trigger_active'
28
- }
29
- }
30
-
31
- function Accordion() {}
32
-
33
- Accordion.prototype = {
34
- init: function(element, suppressClickHandler, triggerElem) {
35
- if(this.isStandard) {
36
- this._initStandard(element, suppressClickHandler);
37
- } else {
38
- this._initJs(element, suppressClickHandler, triggerElem);
39
- }
40
- },
41
- _initStandard: function(element, suppressClickHandler) {
42
- var self = this;
43
-
44
- if(!suppressClickHandler) {
45
- element.querySelectorAll('.' + _class.standard.trigger).forEach(function(trigger) {
46
- var parent = Volta._closest(trigger, '.' + _class.standard.container, _class.standard.container);
47
-
48
- if(parent && parent == element) {
49
- trigger.addEventListener('click', function(){
50
- self.toggle(trigger);
51
- });
52
- }
53
- });
54
- }
55
- },
56
- _initJs: function(element, suppressClickHandler, triggerElem) {
57
- this._content = element;
58
-
59
- if(triggerElem) {
60
- this.trigger = triggerElem;
61
- } else if(this._content.dataset.trigger) {
62
- var triggerId = this._content.dataset.trigger;
63
- this.trigger = document.querySelector('#' + triggerId);
64
- } else {
65
- console.warn("Volta: js accordion trigger missing");
66
- }
67
-
68
- var self = this;
69
- if(!suppressClickHandler && this.trigger) {
70
- this.trigger.addEventListener('click', function(){
71
- self.toggle();
72
- });
73
- }
74
- },
75
- close: function(trigger) {
76
- var panel = this._content || trigger.nextElementSibling;
77
- var trigger = this.trigger || trigger;
78
- var classes = this.trigger ? _class.js : _class.standard;
79
-
80
- trigger.classList.remove(classes.triggerActive);
81
- panel.classList.add(classes.contentClosing);
82
-
83
- panel.style.height = window.getComputedStyle(panel).height;
84
- panel.offsetHeight; // force repaint
85
- panel.style.height = '0px';
86
- panel.classList.remove(classes.contentOpen);
87
-
88
- var self = this;
89
- panel.addEventListener('transitionend', function closingTransitionEndEvent(event) {
90
- if (event.propertyName == 'height' && Volta._hasClass(panel, classes.contentClosing)) {
91
- panel.classList.remove(classes.contentClosing);
92
- panel.style.height = '0px';
93
- panel.removeEventListener('transitionend', closingTransitionEndEvent, false);
94
-
95
- if(self.isGroup && self._isTriggerActive(trigger, true)){
96
- self._activeGroupTrigger = undefined;
97
- }
98
- }
99
- }, { passive: true, once: true });
100
- },
101
- isOpening: false,
102
- _activeGroupTrigger: undefined,
103
- _isTriggerActive: function(trigger, match) {
104
- return (this.isGroup && this._activeGroupTrigger && (!match || this._activeGroupTrigger === trigger)) || Volta._hasClass(trigger, _class.standard.triggerActive);
105
- },
106
- open: function(trigger) {
107
- if(!this.trigger) {
108
- if(this._isTriggerActive(trigger, false)) {
109
- this.close(this._activeGroupTrigger || trigger);
110
- }
111
- if(this.isGroup) {
112
- this._activeGroupTrigger = trigger;
113
- }
114
- }
115
-
116
- var trig = this.trigger || trigger;
117
- var classes = this.trigger ? _class.js : _class.standard;
118
- var panel = this._content || trig.nextElementSibling;
119
-
120
- this.isOpening = true;
121
-
122
- trig.classList.add(classes.triggerActive);
123
- panel.classList.add(classes.contentOpening);
124
-
125
- var startHeight = panel.style.height;
126
- panel.style.height = 'auto';
127
- var endHeight = window.getComputedStyle(panel).height;
128
- panel.style.height = startHeight;
129
- panel.offsetHeight; // force repaint
130
- panel.style.height = endHeight;
131
-
132
- var self = this;
133
- panel.addEventListener('transitionend', function openingTransitionEndEvent(event) {
134
- if (event.propertyName == 'height' && Volta._hasClass(panel, classes.contentOpening)) {
135
- panel.style.height = 'auto';
136
- panel.classList.remove(classes.contentOpening);
137
- panel.classList.add(classes.contentOpen);
138
- panel.removeEventListener('transitionend', openingTransitionEndEvent, false);
139
- self.isOpening = false;
140
- }
141
- }, { passive: true, once: true });
142
- },
143
- toggle: function(trigger) {
144
- if(this.isOpening) {
145
- return false;
146
- }
147
- if((this.trigger && Volta._hasClass(this._content, _class.js.contentOpen))
148
- || (!this.trigger && this._isTriggerActive(trigger, true))) {
149
- this.close(trigger);
150
- } else {
151
- this.open(trigger);
152
- }
153
- }
154
- }
155
-
156
- return {
157
- create: create,
158
- init: initialise
159
- }
160
-
161
- /**
162
- * @public
163
- *
164
- * @description Create an individual accordion object
165
- * @param {Element|string} elementOrId Reference to the accordion content element or the id
166
- * @param {Boolean} suppressClickHandler Whether click events should be attached on creation
167
- * @param {Element} trigger Private required for legacy accordions
168
- * @param {Boolean} isGroup Private required for legacy accordions
169
- * @return {Object}
170
- */
171
- function create(elementOrId, suppressClickHandler, trigger, isGroup, isStandard) {
172
- if(!elementOrId) {
173
- console.warn("Volta: no parameter supplied to accordion.create()");
174
- }
175
- var accordion = Object.create(Accordion.prototype, {});
176
- var element = getElement(elementOrId);
177
-
178
- Object.defineProperties(accordion, {
179
- 'isStandard': {
180
- value: isStandard || Volta._hasClass(element, _class.standard.container),
181
- writable: false
182
- }
183
- });
184
-
185
- Object.defineProperties(accordion, {
186
- 'isGroup': {
187
- value: isGroup,
188
- writable: false
189
- }
190
- });
191
-
192
- accordion.init(element, suppressClickHandler, trigger);
193
-
194
- return accordion;
195
- }
196
-
197
- /**
198
- * @public
199
- *
200
- * @description Initialise all the accordions on the current screen
201
- */
202
- function initialise() {
203
- //standard
204
- var standardAccordions = document.querySelectorAll('.' + _class.standard.container);
205
-
206
- if(standardAccordions.length) {
207
- standardAccordions.forEach(function(accordion){
208
- create(accordion, false, null, Volta._hasClass(accordion, _class.standard.containerGroup), true);
209
- });
210
- }
211
-
212
- //js
213
- var triggers = document.querySelectorAll('.' + _class.js.trigger + '[data-accordion]');
214
- if(triggers.length > 0) {
215
- triggers.forEach(function(trigger) {
216
- var accordionId = trigger.dataset.accordion;
217
- if(!accordionId) {
218
- return;
219
- }
220
- create(accordionId, false, trigger);
221
- });
222
- }
223
-
224
- //js - legacy
225
- var jsAccordions = document.querySelectorAll('.' + _class.js.content + '[data-trigger]');
226
- if(jsAccordions.length > 0) {
227
- jsAccordions.forEach(function(jsLegacy) {
228
- create(jsLegacy);
229
- });
230
- }
231
- }
232
-
233
- /**
234
- * @private
235
- */
236
- function getElement(elementOrId) {
237
- var element;
238
-
239
- if(elementOrId.classList) {
240
- element = elementOrId;
241
- } else if (elementOrId.substring(0, 1) === "#") {
242
- element = document.querySelector(elementOrId);
243
- } else {
244
- element = document.querySelector('#' + elementOrId);
245
- }
246
-
247
- return element;
248
- }
249
- }();
7
+ "use strict";
8
+
9
+ Volta.accordion = (function () {
10
+ var _class = {
11
+ standard: {
12
+ container: "Vlt-accordion",
13
+ containerGroup: "Vlt-accordion--group",
14
+ trigger: "Vlt-accordion__trigger",
15
+ triggerActive: "Vlt-accordion__trigger_active",
16
+ content: "Vlt-accordion__content",
17
+ contentOpen: "Vlt-accordion__content_open",
18
+ contentOpening: "Vlt-accordion__content_opening",
19
+ contentClosing: "Vlt-accordion__content_closing",
20
+ },
21
+ js: {
22
+ content: "Vlt-js-accordion__content",
23
+ contentOpen: "Vlt-js-accordion__content_open",
24
+ contentOpening: "Vlt-js-accordion__content_opening",
25
+ contentClosing: "Vlt-js-accordion__content_closing",
26
+ trigger: "Vlt-js-accordion__trigger",
27
+ triggerActive: "Vlt-js-accordion__trigger_active",
28
+ },
29
+ };
30
+
31
+ function Accordion() {}
32
+
33
+ Accordion.prototype = {
34
+ init: function (element, suppressClickHandler, triggerElem) {
35
+ if (this.isStandard) {
36
+ this._initStandard(element, suppressClickHandler);
37
+ } else {
38
+ this._initJs(element, suppressClickHandler, triggerElem);
39
+ }
40
+ },
41
+ _initStandard: function (element, suppressClickHandler) {
42
+ var self = this;
43
+
44
+ if (!suppressClickHandler) {
45
+ element
46
+ .querySelectorAll("." + _class.standard.trigger)
47
+ .forEach(function (trigger) {
48
+ var parent = Volta._closest(
49
+ trigger,
50
+ "." + _class.standard.container,
51
+ _class.standard.container
52
+ );
53
+
54
+ if (parent && parent == element) {
55
+ trigger.addEventListener("click", function () {
56
+ self.toggle(trigger);
57
+ });
58
+ trigger.addEventListener("toggle", function () {
59
+ self.toggle(trigger);
60
+ });
61
+ }
62
+ });
63
+ }
64
+ },
65
+ _initJs: function (element, suppressClickHandler, triggerElem) {
66
+ this._content = element;
67
+
68
+ if (triggerElem) {
69
+ this.trigger = triggerElem;
70
+ } else if (this._content.dataset.trigger) {
71
+ var triggerId = this._content.dataset.trigger;
72
+ this.trigger = document.querySelector("#" + triggerId);
73
+ } else {
74
+ console.warn("Volta: js accordion trigger missing");
75
+ }
76
+
77
+ var self = this;
78
+ if (!suppressClickHandler && this.trigger) {
79
+ this.trigger.addEventListener("click", function () {
80
+ self.toggle();
81
+ });
82
+ }
83
+ },
84
+ close: function (trigger) {
85
+ var panel = this._content || trigger.nextElementSibling;
86
+ var trigger = this.trigger || trigger;
87
+ var classes = this.trigger ? _class.js : _class.standard;
88
+
89
+ trigger.classList.remove(classes.triggerActive);
90
+ panel.classList.add(classes.contentClosing);
91
+
92
+ panel.style.height = window.getComputedStyle(panel).height;
93
+ panel.offsetHeight; // force repaint
94
+ panel.style.height = "0px";
95
+ panel.classList.remove(classes.contentOpen);
96
+
97
+ var self = this;
98
+ panel.addEventListener(
99
+ "transitionend",
100
+ function closingTransitionEndEvent(event) {
101
+ if (
102
+ event.propertyName == "height" &&
103
+ Volta._hasClass(panel, classes.contentClosing)
104
+ ) {
105
+ panel.classList.remove(classes.contentClosing);
106
+ panel.style.height = "0px";
107
+ panel.removeEventListener(
108
+ "transitionend",
109
+ closingTransitionEndEvent,
110
+ false
111
+ );
112
+
113
+ if (self.isGroup && self._isTriggerActive(trigger, true)) {
114
+ self._activeGroupTrigger = undefined;
115
+ }
116
+ }
117
+ },
118
+ { passive: true, once: true }
119
+ );
120
+ },
121
+ isOpening: false,
122
+ _activeGroupTrigger: undefined,
123
+ _isTriggerActive: function (trigger, match) {
124
+ return (
125
+ (this.isGroup &&
126
+ this._activeGroupTrigger &&
127
+ (!match || this._activeGroupTrigger === trigger)) ||
128
+ Volta._hasClass(trigger, _class.standard.triggerActive)
129
+ );
130
+ },
131
+ open: function (trigger) {
132
+ if (!this.trigger) {
133
+ if (this._isTriggerActive(trigger, false)) {
134
+ this.close(this._activeGroupTrigger || trigger);
135
+ }
136
+ if (this.isGroup) {
137
+ this._activeGroupTrigger = trigger;
138
+ }
139
+ }
140
+
141
+ var trig = this.trigger || trigger;
142
+ var classes = this.trigger ? _class.js : _class.standard;
143
+ var panel = this._content || trig.nextElementSibling;
144
+
145
+ this.isOpening = true;
146
+
147
+ trig.classList.add(classes.triggerActive);
148
+ panel.classList.add(classes.contentOpening);
149
+
150
+ var startHeight = panel.style.height;
151
+ panel.style.height = "auto";
152
+ var endHeight = window.getComputedStyle(panel).height;
153
+ panel.style.height = startHeight;
154
+ panel.offsetHeight; // force repaint
155
+ panel.style.height = endHeight;
156
+
157
+ var self = this;
158
+ panel.addEventListener(
159
+ "transitionend",
160
+ function openingTransitionEndEvent(event) {
161
+ if (
162
+ event.propertyName == "height" &&
163
+ Volta._hasClass(panel, classes.contentOpening)
164
+ ) {
165
+ panel.style.height = "auto";
166
+ panel.classList.remove(classes.contentOpening);
167
+ panel.classList.add(classes.contentOpen);
168
+ panel.removeEventListener(
169
+ "transitionend",
170
+ openingTransitionEndEvent,
171
+ false
172
+ );
173
+ self.isOpening = false;
174
+ }
175
+ },
176
+ { passive: true, once: true }
177
+ );
178
+ },
179
+ toggle: function (trigger) {
180
+ if (this.isOpening) {
181
+ return false;
182
+ }
183
+ if (
184
+ (this.trigger &&
185
+ Volta._hasClass(this._content, _class.js.contentOpen)) ||
186
+ (!this.trigger && this._isTriggerActive(trigger, true))
187
+ ) {
188
+ this.close(trigger);
189
+ } else {
190
+ this.open(trigger);
191
+ }
192
+ },
193
+ };
194
+
195
+ return {
196
+ create: create,
197
+ init: initialise,
198
+ };
199
+
200
+ /**
201
+ * @public
202
+ *
203
+ * @description Create an individual accordion object
204
+ * @param {Element|string} elementOrId Reference to the accordion content element or the id
205
+ * @param {Boolean} suppressClickHandler Whether click events should be attached on creation
206
+ * @param {Element} trigger Private required for legacy accordions
207
+ * @param {Boolean} isGroup Private required for legacy accordions
208
+ * @return {Object}
209
+ */
210
+ function create(
211
+ elementOrId,
212
+ suppressClickHandler,
213
+ trigger,
214
+ isGroup,
215
+ isStandard
216
+ ) {
217
+ if (!elementOrId) {
218
+ console.warn("Volta: no parameter supplied to accordion.create()");
219
+ }
220
+ var accordion = Object.create(Accordion.prototype, {});
221
+ var element = getElement(elementOrId);
222
+
223
+ Object.defineProperties(accordion, {
224
+ isStandard: {
225
+ value:
226
+ isStandard || Volta._hasClass(element, _class.standard.container),
227
+ writable: false,
228
+ },
229
+ });
230
+
231
+ Object.defineProperties(accordion, {
232
+ isGroup: {
233
+ value: isGroup,
234
+ writable: false,
235
+ },
236
+ });
237
+
238
+ accordion.init(element, suppressClickHandler, trigger);
239
+
240
+ return accordion;
241
+ }
242
+
243
+ /**
244
+ * @public
245
+ *
246
+ * @description Initialise all the accordions on the current screen
247
+ */
248
+ function initialise() {
249
+ //standard
250
+ var standardAccordions = document.querySelectorAll(
251
+ "." + _class.standard.container
252
+ );
253
+
254
+ if (standardAccordions.length) {
255
+ standardAccordions.forEach(function (accordion) {
256
+ create(
257
+ accordion,
258
+ false,
259
+ null,
260
+ Volta._hasClass(accordion, _class.standard.containerGroup),
261
+ true
262
+ );
263
+ });
264
+ }
265
+
266
+ //js
267
+ var triggers = document.querySelectorAll(
268
+ "." + _class.js.trigger + "[data-accordion]"
269
+ );
270
+ if (triggers.length > 0) {
271
+ triggers.forEach(function (trigger) {
272
+ var accordionId = trigger.dataset.accordion;
273
+ if (!accordionId) {
274
+ return;
275
+ }
276
+ create(accordionId, false, trigger);
277
+ });
278
+ }
279
+
280
+ //js - legacy
281
+ var jsAccordions = document.querySelectorAll(
282
+ "." + _class.js.content + "[data-trigger]"
283
+ );
284
+ if (jsAccordions.length > 0) {
285
+ jsAccordions.forEach(function (jsLegacy) {
286
+ create(jsLegacy);
287
+ });
288
+ }
289
+ }
290
+
291
+ /**
292
+ * @private
293
+ */
294
+ function getElement(elementOrId) {
295
+ var element;
296
+
297
+ if (elementOrId.classList) {
298
+ element = elementOrId;
299
+ } else if (elementOrId.substring(0, 1) === "#") {
300
+ element = document.querySelector(elementOrId);
301
+ } else {
302
+ element = document.querySelector("#" + elementOrId);
303
+ }
304
+
305
+ return element;
306
+ }
307
+ })();