codecraftai-integration-runtime 1.3.0__py3-none-any.whl
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.
- ccai/integrationruntime/__init__.py +27 -0
- ccai/integrationruntime/entrypoints.py +59 -0
- ccai/integrationruntime/initialize.py +100 -0
- ccai/integrationruntime/integratedtestjob.py +100 -0
- ccai/integrationruntime/integrationruntimedefaulttypefactory.py +51 -0
- ccai/integrationruntime/py.typed +0 -0
- ccai/integrationruntime/results/__init__.py +13 -0
- ccai/integrationruntime/results/concentrators/__init__.py +13 -0
- ccai/integrationruntime/results/concentrators/progressconcentratorservice.py +526 -0
- ccai/integrationruntime/results/recorders/__init__.py +22 -0
- ccai/integrationruntime/results/recorders/integrationjsonresultrecorder.py +126 -0
- ccai/integrationruntime/results/recorders/streamingresultrecorder.py +271 -0
- ccai/integrationruntime/results/streaming/__init__.py +25 -0
- ccai/integrationruntime/results/streaming/resultstreamer.py +581 -0
- ccai/integrationruntime/runtimeoutputcontext.py +68 -0
- ccai/integrationruntime/runtimerunmetadata.py +165 -0
- ccai/integrationruntime/templates/v2/static/images/test-report-banner-background-image.png +0 -0
- ccai/integrationruntime/templates/v2/static/javascript/d3.v7.js +20625 -0
- ccai/integrationruntime/templates/v2/static/javascript/icon-components.js +510 -0
- ccai/integrationruntime/templates/v2/static/javascript/mojo-components.js +1417 -0
- ccai/integrationruntime/templates/v2/static/javascript/prism.js +1789 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-accessibility.js +704 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-comparison.js +1287 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-components.js +3499 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-helpers.js +426 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-responsive.js +493 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary.js +1128 -0
- ccai/integrationruntime/templates/v2/static/javascript/webcomponent-helpers.js +112 -0
- ccai/integrationruntime/templates/v2/static/styles/branding-theme.css +144 -0
- ccai/integrationruntime/templates/v2/static/styles/icon-styles.css +9 -0
- ccai/integrationruntime/templates/v2/static/styles/mojo-components.css +384 -0
- ccai/integrationruntime/templates/v2/static/styles/prism.css +143 -0
- ccai/integrationruntime/templates/v2/static/styles/tabs-responsive.css +186 -0
- ccai/integrationruntime/templates/v2/static/styles/testsummary-accessibility.css +413 -0
- ccai/integrationruntime/templates/v2/static/styles/testsummary-comparison.css +746 -0
- ccai/integrationruntime/templates/v2/static/styles/testsummary-responsive.css +679 -0
- ccai/integrationruntime/templates/v2/static/styles/testsummary.css +1631 -0
- ccai/integrationruntime/templates/v2/tabs/tab-data.html +870 -0
- ccai/integrationruntime/templates/v2/tabs/tab-images.html +110 -0
- ccai/integrationruntime/templates/v2/tabs/tab-logs.html +594 -0
- ccai/integrationruntime/templates/v2/tabs/tab-sounds.html +112 -0
- ccai/integrationruntime/templates/v2/tabs/tab-timeseries.html +368 -0
- ccai/integrationruntime/templates/v2/tabs/tab-videos.html +372 -0
- ccai/integrationruntime/templates/v2/testsummary.html +81 -0
- codecraftai_integration_runtime-1.3.0.dist-info/METADATA +73 -0
- codecraftai_integration_runtime-1.3.0.dist-info/RECORD +48 -0
- codecraftai_integration_runtime-1.3.0.dist-info/WHEEL +4 -0
- codecraftai_integration_runtime-1.3.0.dist-info/licenses/LICENSE.md +204 -0
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Author: "Myron Walker"
|
|
3
|
+
Copyright: "Copyright 2024, Myron W Walker"
|
|
4
|
+
Version: = "2.0.0"
|
|
5
|
+
Email: myron.walker@gmail.com
|
|
6
|
+
|
|
7
|
+
Responsive Design JavaScript for TestSummary HTML Report Templates
|
|
8
|
+
Provides mobile navigation toggle, collapsible sidebar, and touch interactions.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @fileoverview Responsive design functionality for TestSummary reports.
|
|
13
|
+
* Handles mobile navigation, sidebar toggle, and touch-friendly interactions.
|
|
14
|
+
* @module testsummary-responsive
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Responsive navigation manager for mobile devices.
|
|
19
|
+
* Handles sidebar toggle, overlay, and navigation state.
|
|
20
|
+
*/
|
|
21
|
+
class ResponsiveNavManager {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.isOpen = false;
|
|
24
|
+
this.toggleButton = null;
|
|
25
|
+
this.sidebar = null;
|
|
26
|
+
this.overlay = null;
|
|
27
|
+
this.touchStartX = 0;
|
|
28
|
+
this.touchStartY = 0;
|
|
29
|
+
this.swipeThreshold = 50;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Initializes the responsive navigation system.
|
|
34
|
+
* Creates navigation elements and sets up event listeners.
|
|
35
|
+
*/
|
|
36
|
+
init() {
|
|
37
|
+
this.createNavigationElements();
|
|
38
|
+
this.setupEventListeners();
|
|
39
|
+
this.setupTouchGestures();
|
|
40
|
+
this.updateNavigationLinks();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates the mobile navigation toggle button, sidebar, and overlay.
|
|
45
|
+
*/
|
|
46
|
+
createNavigationElements() {
|
|
47
|
+
// Create mobile nav toggle button
|
|
48
|
+
this.toggleButton = document.createElement('button');
|
|
49
|
+
this.toggleButton.className = 'ts-mobile-nav-toggle';
|
|
50
|
+
this.toggleButton.setAttribute('aria-label', 'Toggle navigation menu');
|
|
51
|
+
this.toggleButton.setAttribute('aria-expanded', 'false');
|
|
52
|
+
this.toggleButton.innerHTML = `
|
|
53
|
+
<div class="ts-mobile-nav-toggle-icon">
|
|
54
|
+
<span></span>
|
|
55
|
+
<span></span>
|
|
56
|
+
<span></span>
|
|
57
|
+
</div>
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
// Create sidebar navigation
|
|
61
|
+
this.sidebar = document.createElement('nav');
|
|
62
|
+
this.sidebar.className = 'ts-sidebar-nav';
|
|
63
|
+
this.sidebar.setAttribute('aria-label', 'Main navigation');
|
|
64
|
+
this.sidebar.innerHTML = `
|
|
65
|
+
<div class="ts-sidebar-nav-header">
|
|
66
|
+
<h2 class="ts-sidebar-nav-title">Test Summary</h2>
|
|
67
|
+
</div>
|
|
68
|
+
<ul class="ts-sidebar-nav-list" role="menu">
|
|
69
|
+
<li class="ts-sidebar-nav-item" role="none">
|
|
70
|
+
<a href="#testsummary-banner" class="ts-sidebar-nav-link" role="menuitem">
|
|
71
|
+
<span class="ts-sidebar-nav-icon">📊</span>
|
|
72
|
+
Summary
|
|
73
|
+
</a>
|
|
74
|
+
</li>
|
|
75
|
+
<li class="ts-sidebar-nav-item" role="none">
|
|
76
|
+
<a href="#testsummary-configuration" class="ts-sidebar-nav-link" role="menuitem">
|
|
77
|
+
<span class="ts-sidebar-nav-icon">⚙️</span>
|
|
78
|
+
Configuration
|
|
79
|
+
</a>
|
|
80
|
+
</li>
|
|
81
|
+
<li class="ts-sidebar-nav-item" role="none">
|
|
82
|
+
<a href="#testsummary-resultdetail" class="ts-sidebar-nav-link" role="menuitem">
|
|
83
|
+
<span class="ts-sidebar-nav-icon">📋</span>
|
|
84
|
+
Results
|
|
85
|
+
</a>
|
|
86
|
+
</li>
|
|
87
|
+
<li class="ts-sidebar-nav-item" role="none">
|
|
88
|
+
<a href="#testsummary-comparison" class="ts-sidebar-nav-link" role="menuitem">
|
|
89
|
+
<span class="ts-sidebar-nav-icon">🔄</span>
|
|
90
|
+
Comparison
|
|
91
|
+
</a>
|
|
92
|
+
</li>
|
|
93
|
+
<li class="ts-sidebar-nav-item" role="none">
|
|
94
|
+
<a href="#testsummary-trend-analysis" class="ts-sidebar-nav-link" role="menuitem">
|
|
95
|
+
<span class="ts-sidebar-nav-icon">📈</span>
|
|
96
|
+
Trends
|
|
97
|
+
</a>
|
|
98
|
+
</li>
|
|
99
|
+
<li class="ts-sidebar-nav-item" role="none">
|
|
100
|
+
<a href="#testsummary-artifacts" class="ts-sidebar-nav-link" role="menuitem">
|
|
101
|
+
<span class="ts-sidebar-nav-icon">📁</span>
|
|
102
|
+
Artifacts
|
|
103
|
+
</a>
|
|
104
|
+
</li>
|
|
105
|
+
<li class="ts-sidebar-nav-item" role="none">
|
|
106
|
+
<a href="#testsummary-importfailures" class="ts-sidebar-nav-link" role="menuitem">
|
|
107
|
+
<span class="ts-sidebar-nav-icon">⚠️</span>
|
|
108
|
+
Import Failures
|
|
109
|
+
</a>
|
|
110
|
+
</li>
|
|
111
|
+
<li class="ts-sidebar-nav-item" role="none">
|
|
112
|
+
<a href="#testsummary-filesandfolders" class="ts-sidebar-nav-link" role="menuitem">
|
|
113
|
+
<span class="ts-sidebar-nav-icon">📂</span>
|
|
114
|
+
Files & Folders
|
|
115
|
+
</a>
|
|
116
|
+
</li>
|
|
117
|
+
</ul>
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
// Create overlay
|
|
121
|
+
this.overlay = document.createElement('div');
|
|
122
|
+
this.overlay.className = 'ts-sidebar-overlay';
|
|
123
|
+
this.overlay.setAttribute('aria-hidden', 'true');
|
|
124
|
+
|
|
125
|
+
// Insert elements into DOM
|
|
126
|
+
document.body.insertBefore(this.toggleButton, document.body.firstChild);
|
|
127
|
+
document.body.insertBefore(this.sidebar, document.body.firstChild);
|
|
128
|
+
document.body.insertBefore(this.overlay, document.body.firstChild);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Sets up event listeners for navigation interactions.
|
|
133
|
+
*/
|
|
134
|
+
setupEventListeners() {
|
|
135
|
+
// Toggle button click
|
|
136
|
+
this.toggleButton.addEventListener('click', (e) => {
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
this.toggle();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// Overlay click to close
|
|
142
|
+
this.overlay.addEventListener('click', () => {
|
|
143
|
+
this.close();
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Navigation link clicks
|
|
147
|
+
const navLinks = this.sidebar.querySelectorAll('.ts-sidebar-nav-link');
|
|
148
|
+
navLinks.forEach(link => {
|
|
149
|
+
link.addEventListener('click', (e) => {
|
|
150
|
+
this.handleNavLinkClick(e, link);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Keyboard navigation
|
|
155
|
+
this.sidebar.addEventListener('keydown', (e) => {
|
|
156
|
+
this.handleKeyboardNavigation(e);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Close on escape key
|
|
160
|
+
document.addEventListener('keydown', (e) => {
|
|
161
|
+
if (e.key === 'Escape' && this.isOpen) {
|
|
162
|
+
this.close();
|
|
163
|
+
this.toggleButton.focus();
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Handle window resize
|
|
168
|
+
window.addEventListener('resize', () => {
|
|
169
|
+
this.handleResize();
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Sets up touch gesture support for swipe navigation.
|
|
175
|
+
*/
|
|
176
|
+
setupTouchGestures() {
|
|
177
|
+
// Track touch start position
|
|
178
|
+
document.addEventListener('touchstart', (e) => {
|
|
179
|
+
this.touchStartX = e.touches[0].clientX;
|
|
180
|
+
this.touchStartY = e.touches[0].clientY;
|
|
181
|
+
}, { passive: true });
|
|
182
|
+
|
|
183
|
+
// Handle swipe gestures
|
|
184
|
+
document.addEventListener('touchend', (e) => {
|
|
185
|
+
const touchEndX = e.changedTouches[0].clientX;
|
|
186
|
+
const touchEndY = e.changedTouches[0].clientY;
|
|
187
|
+
|
|
188
|
+
const deltaX = touchEndX - this.touchStartX;
|
|
189
|
+
const deltaY = touchEndY - this.touchStartY;
|
|
190
|
+
|
|
191
|
+
// Only handle horizontal swipes (ignore vertical scrolling)
|
|
192
|
+
if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > this.swipeThreshold) {
|
|
193
|
+
if (deltaX > 0 && this.touchStartX < 30 && !this.isOpen) {
|
|
194
|
+
// Swipe right from left edge - open sidebar
|
|
195
|
+
this.open();
|
|
196
|
+
} else if (deltaX < 0 && this.isOpen) {
|
|
197
|
+
// Swipe left - close sidebar
|
|
198
|
+
this.close();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}, { passive: true });
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Toggles the sidebar open/closed state.
|
|
206
|
+
*/
|
|
207
|
+
toggle() {
|
|
208
|
+
if (this.isOpen) {
|
|
209
|
+
this.close();
|
|
210
|
+
} else {
|
|
211
|
+
this.open();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Opens the sidebar navigation.
|
|
217
|
+
*/
|
|
218
|
+
open() {
|
|
219
|
+
this.isOpen = true;
|
|
220
|
+
this.sidebar.classList.add('open');
|
|
221
|
+
this.overlay.classList.add('visible');
|
|
222
|
+
this.toggleButton.classList.add('active');
|
|
223
|
+
this.toggleButton.setAttribute('aria-expanded', 'true');
|
|
224
|
+
this.overlay.setAttribute('aria-hidden', 'false');
|
|
225
|
+
|
|
226
|
+
// Prevent body scroll when sidebar is open
|
|
227
|
+
document.body.style.overflow = 'hidden';
|
|
228
|
+
|
|
229
|
+
// Focus first navigation link
|
|
230
|
+
const firstLink = this.sidebar.querySelector('.ts-sidebar-nav-link');
|
|
231
|
+
if (firstLink) {
|
|
232
|
+
firstLink.focus();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Closes the sidebar navigation.
|
|
238
|
+
*/
|
|
239
|
+
close() {
|
|
240
|
+
this.isOpen = false;
|
|
241
|
+
this.sidebar.classList.remove('open');
|
|
242
|
+
this.overlay.classList.remove('visible');
|
|
243
|
+
this.toggleButton.classList.remove('active');
|
|
244
|
+
this.toggleButton.setAttribute('aria-expanded', 'false');
|
|
245
|
+
this.overlay.setAttribute('aria-hidden', 'true');
|
|
246
|
+
|
|
247
|
+
// Restore body scroll
|
|
248
|
+
document.body.style.overflow = '';
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Handles navigation link clicks.
|
|
253
|
+
* @param {Event} e - The click event.
|
|
254
|
+
* @param {HTMLElement} link - The clicked link element.
|
|
255
|
+
*/
|
|
256
|
+
handleNavLinkClick(e, link) {
|
|
257
|
+
const targetId = link.getAttribute('href').substring(1);
|
|
258
|
+
const targetElement = document.getElementById(targetId);
|
|
259
|
+
|
|
260
|
+
if (targetElement) {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
|
|
263
|
+
// Close sidebar first
|
|
264
|
+
this.close();
|
|
265
|
+
|
|
266
|
+
// Smooth scroll to target
|
|
267
|
+
setTimeout(() => {
|
|
268
|
+
targetElement.scrollIntoView({
|
|
269
|
+
behavior: 'smooth',
|
|
270
|
+
block: 'start'
|
|
271
|
+
});
|
|
272
|
+
}, 300);
|
|
273
|
+
|
|
274
|
+
// Update active state
|
|
275
|
+
this.setActiveLink(link);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Sets the active navigation link.
|
|
281
|
+
* @param {HTMLElement} activeLink - The link to mark as active.
|
|
282
|
+
*/
|
|
283
|
+
setActiveLink(activeLink) {
|
|
284
|
+
const allLinks = this.sidebar.querySelectorAll('.ts-sidebar-nav-link');
|
|
285
|
+
allLinks.forEach(link => {
|
|
286
|
+
link.classList.remove('active');
|
|
287
|
+
});
|
|
288
|
+
activeLink.classList.add('active');
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Handles keyboard navigation within the sidebar.
|
|
293
|
+
* @param {KeyboardEvent} e - The keyboard event.
|
|
294
|
+
*/
|
|
295
|
+
handleKeyboardNavigation(e) {
|
|
296
|
+
const links = Array.from(this.sidebar.querySelectorAll('.ts-sidebar-nav-link'));
|
|
297
|
+
const currentIndex = links.indexOf(document.activeElement);
|
|
298
|
+
|
|
299
|
+
switch (e.key) {
|
|
300
|
+
case 'ArrowDown':
|
|
301
|
+
e.preventDefault();
|
|
302
|
+
if (currentIndex < links.length - 1) {
|
|
303
|
+
links[currentIndex + 1].focus();
|
|
304
|
+
}
|
|
305
|
+
break;
|
|
306
|
+
case 'ArrowUp':
|
|
307
|
+
e.preventDefault();
|
|
308
|
+
if (currentIndex > 0) {
|
|
309
|
+
links[currentIndex - 1].focus();
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
case 'Home':
|
|
313
|
+
e.preventDefault();
|
|
314
|
+
links[0].focus();
|
|
315
|
+
break;
|
|
316
|
+
case 'End':
|
|
317
|
+
e.preventDefault();
|
|
318
|
+
links[links.length - 1].focus();
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Handles window resize events.
|
|
325
|
+
* Closes sidebar on larger screens.
|
|
326
|
+
*/
|
|
327
|
+
handleResize() {
|
|
328
|
+
if (window.innerWidth > 768 && this.isOpen) {
|
|
329
|
+
this.close();
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Updates navigation links based on visible sections.
|
|
335
|
+
* Hides links for sections that don't exist or are hidden.
|
|
336
|
+
*/
|
|
337
|
+
updateNavigationLinks() {
|
|
338
|
+
const navLinks = this.sidebar.querySelectorAll('.ts-sidebar-nav-link');
|
|
339
|
+
navLinks.forEach(link => {
|
|
340
|
+
const targetId = link.getAttribute('href').substring(1);
|
|
341
|
+
const targetElement = document.getElementById(targetId);
|
|
342
|
+
const listItem = link.parentElement;
|
|
343
|
+
|
|
344
|
+
if (!targetElement || targetElement.style.display === 'none') {
|
|
345
|
+
listItem.style.display = 'none';
|
|
346
|
+
} else {
|
|
347
|
+
listItem.style.display = '';
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Touch interaction enhancer for better mobile experience.
|
|
355
|
+
*/
|
|
356
|
+
class TouchInteractionManager {
|
|
357
|
+
constructor() {
|
|
358
|
+
this.activeElement = null;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Initializes touch interaction enhancements.
|
|
363
|
+
*/
|
|
364
|
+
init() {
|
|
365
|
+
this.enhanceCollapsibles();
|
|
366
|
+
this.enhanceTabs();
|
|
367
|
+
this.enhanceButtons();
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Enhances collapsible elements for touch interaction.
|
|
372
|
+
*/
|
|
373
|
+
enhanceCollapsibles() {
|
|
374
|
+
const collapsibleButtons = document.querySelectorAll(
|
|
375
|
+
'.mojo-collapsible-button, .mojo-collapsible-lvl2-button, .mojo-collapsible-lvl3-button, ' +
|
|
376
|
+
'.ts-errors-collapsible-button, .ts-failures-collapsible-button'
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
collapsibleButtons.forEach(button => {
|
|
380
|
+
button.classList.add('ts-touch-target', 'ts-touch-feedback', 'ts-no-select');
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Enhances tab elements for touch interaction.
|
|
386
|
+
*/
|
|
387
|
+
enhanceTabs() {
|
|
388
|
+
const tabLabels = document.querySelectorAll('.mojo-tab-label');
|
|
389
|
+
tabLabels.forEach(tab => {
|
|
390
|
+
tab.classList.add('ts-touch-target', 'ts-touch-feedback', 'ts-no-select');
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Enhances button elements for touch interaction.
|
|
396
|
+
*/
|
|
397
|
+
enhanceButtons() {
|
|
398
|
+
const buttons = document.querySelectorAll(
|
|
399
|
+
'.ts-filter-btn, .ts-export-btn, .ts-date-clear, .ts-search-clear'
|
|
400
|
+
);
|
|
401
|
+
buttons.forEach(button => {
|
|
402
|
+
button.classList.add('ts-touch-target', 'ts-touch-feedback');
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Viewport manager for responsive layout adjustments.
|
|
409
|
+
*/
|
|
410
|
+
class ViewportManager {
|
|
411
|
+
constructor() {
|
|
412
|
+
this.viewportMeta = null;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Initializes viewport management.
|
|
417
|
+
*/
|
|
418
|
+
init() {
|
|
419
|
+
this.ensureViewportMeta();
|
|
420
|
+
this.handleOrientationChange();
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Ensures the viewport meta tag exists with proper settings.
|
|
425
|
+
*/
|
|
426
|
+
ensureViewportMeta() {
|
|
427
|
+
this.viewportMeta = document.querySelector('meta[name="viewport"]');
|
|
428
|
+
|
|
429
|
+
if (!this.viewportMeta) {
|
|
430
|
+
this.viewportMeta = document.createElement('meta');
|
|
431
|
+
this.viewportMeta.name = 'viewport';
|
|
432
|
+
this.viewportMeta.content = 'width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes';
|
|
433
|
+
document.head.appendChild(this.viewportMeta);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Handles orientation change events.
|
|
439
|
+
*/
|
|
440
|
+
handleOrientationChange() {
|
|
441
|
+
window.addEventListener('orientationchange', () => {
|
|
442
|
+
// Force layout recalculation after orientation change
|
|
443
|
+
setTimeout(() => {
|
|
444
|
+
window.scrollTo(0, window.scrollY);
|
|
445
|
+
}, 100);
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Global responsive manager instances
|
|
451
|
+
let g_responsiveNavManager = null;
|
|
452
|
+
let g_touchInteractionManager = null;
|
|
453
|
+
let g_viewportManager = null;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Initializes all responsive design functionality.
|
|
457
|
+
* Should be called after page load.
|
|
458
|
+
*/
|
|
459
|
+
function init_responsive_design() {
|
|
460
|
+
// Initialize viewport manager
|
|
461
|
+
g_viewportManager = new ViewportManager();
|
|
462
|
+
g_viewportManager.init();
|
|
463
|
+
|
|
464
|
+
// Initialize responsive navigation
|
|
465
|
+
g_responsiveNavManager = new ResponsiveNavManager();
|
|
466
|
+
g_responsiveNavManager.init();
|
|
467
|
+
|
|
468
|
+
// Initialize touch interactions
|
|
469
|
+
g_touchInteractionManager = new TouchInteractionManager();
|
|
470
|
+
g_touchInteractionManager.init();
|
|
471
|
+
|
|
472
|
+
console.log("Responsive design initialized");
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Updates the responsive navigation based on current page state.
|
|
477
|
+
* Should be called after dynamic content changes.
|
|
478
|
+
*/
|
|
479
|
+
function update_responsive_navigation() {
|
|
480
|
+
if (g_responsiveNavManager) {
|
|
481
|
+
g_responsiveNavManager.updateNavigationLinks();
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
if (g_touchInteractionManager) {
|
|
485
|
+
g_touchInteractionManager.init();
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// Export functions for use in other modules
|
|
490
|
+
if (typeof window !== 'undefined') {
|
|
491
|
+
window.init_responsive_design = init_responsive_design;
|
|
492
|
+
window.update_responsive_navigation = update_responsive_navigation;
|
|
493
|
+
}
|