100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.

0 downloads

dbbasic-web-native/complete-demo.html
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-web-native.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-web-native.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-web-native.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add canonical.html v1.0 - The single source of truth for usability standards fb6e650 1 year ago History
complete-demo.html · 23.3 KB · 675 lines
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>Complete Semantic Components Demo</title>
7 <script src="semantic-components.js"></script>
8 <script src="voice-system.js"></script>
9 <script src="context-detection.js"></script>
10 <script src="attention-ml.js"></script>
11 <script src="gesture-recognition.js"></script>
12 <script src="devtools.js"></script>
13 <style>
14 * {
15 margin: 0;
16 padding: 0;
17 box-sizing: border-box;
18 }
19
20 body {
21 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
22 background: #000;
23 color: #fff;
24 line-height: 1.6;
25 }
26
27 .app-container {
28 display: grid;
29 grid-template-columns: 250px 1fr;
30 height: 100vh;
31 }
32
33 .sidebar {
34 background: #1c1c1e;
35 border-right: 1px solid #38383a;
36 display: flex;
37 flex-direction: column;
38 }
39
40 .logo {
41 padding: 24px;
42 font-size: 20px;
43 font-weight: 700;
44 background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
45 -webkit-background-clip: text;
46 -webkit-text-fill-color: transparent;
47 background-clip: text;
48 }
49
50 .main-content {
51 overflow-y: auto;
52 padding: 32px;
53 }
54
55 section {
56 margin-bottom: 48px;
57 }
58
59 h1 {
60 font-size: 36px;
61 margin-bottom: 32px;
62 }
63
64 h2 {
65 font-size: 24px;
66 margin-bottom: 16px;
67 color: #007aff;
68 }
69
70 .demo-section {
71 background: #1c1c1e;
72 border: 1px solid #38383a;
73 border-radius: 12px;
74 padding: 24px;
75 margin-bottom: 24px;
76 }
77
78 .grid {
79 display: grid;
80 gap: 24px;
81 }
82
83 .grid-2 {
84 grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
85 }
86
87 .grid-3 {
88 grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
89 }
90
91 .button-group {
92 display: flex;
93 gap: 12px;
94 flex-wrap: wrap;
95 margin-bottom: 16px;
96 }
97
98 .status-bar {
99 position: fixed;
100 bottom: 0;
101 left: 250px;
102 right: 0;
103 background: #2c2c2e;
104 border-top: 1px solid #38383a;
105 padding: 12px 24px;
106 display: flex;
107 justify-content: space-between;
108 align-items: center;
109 font-size: 14px;
110 color: #98989d;
111 }
112
113 .status-item {
114 display: flex;
115 align-items: center;
116 gap: 8px;
117 }
118
119 nav-item {
120 display: flex;
121 align-items: center;
122 gap: 12px;
123 padding: 12px 16px;
124 color: #98989d;
125 text-decoration: none;
126 cursor: pointer;
127 font-size: 14px;
128 }
129
130 nav-item:hover {
131 color: #fff;
132 }
133
134 list-item {
135 display: flex;
136 align-items: center;
137 justify-content: space-between;
138 gap: 12px;
139 }
140
141 list-item-content {
142 flex: 1;
143 }
144
145 list-item-title {
146 font-weight: 600;
147 display: block;
148 margin-bottom: 4px;
149 }
150
151 list-item-meta {
152 font-size: 13px;
153 color: #98989d;
154 }
155
156 menu-item {
157 display: flex;
158 align-items: center;
159 gap: 12px;
160 }
161
162 .card-actions {
163 display: flex;
164 gap: 8px;
165 }
166
167 semantic-modal h3 {
168 margin: 0;
169 font-size: 20px;
170 }
171
172 .modal-content {
173 line-height: 1.8;
174 color: #98989d;
175 }
176
177 .form-row {
178 margin-bottom: 16px;
179 }
180
181 .toolbar {
182 display: flex;
183 justify-content: space-between;
184 align-items: center;
185 margin-bottom: 24px;
186 padding: 16px;
187 background: #1c1c1e;
188 border-radius: 8px;
189 }
190
191 .badge {
192 background: #ff3b30;
193 color: white;
194 padding: 2px 8px;
195 border-radius: 12px;
196 font-size: 11px;
197 font-weight: 700;
198 }
199
200 .voice-toggle {
201 position: fixed;
202 bottom: 80px;
203 right: 24px;
204 width: 64px;
205 height: 64px;
206 border-radius: 50%;
207 background: #007aff;
208 border: none;
209 color: white;
210 font-size: 28px;
211 cursor: pointer;
212 box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
213 transition: all 0.3s;
214 z-index: 9998;
215 }
216
217 .voice-toggle:hover {
218 transform: scale(1.1);
219 box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
220 }
221
222 .voice-toggle.active {
223 background: #ff3b30;
224 animation: pulse 1.5s infinite;
225 }
226
227 @keyframes pulse {
228 0%, 100% { box-shadow: 0 4px 16px rgba(255, 59, 48, 0.3); }
229 50% { box-shadow: 0 4px 24px rgba(255, 59, 48, 0.6); }
230 }
231 </style>
232</head>
233<body>
234 <div class="app-container">
235 <!-- Sidebar with Navigator -->
236 <div class="sidebar">
237 <div class="logo">Semantic UI</div>
238 <semantic-navigator type="vertical">
239 <nav-item data-nav-id="home" aria-current="page">
240 <span>🏠</span> Home
241 </nav-item>
242 <nav-item data-nav-id="projects">
243 <span>📁</span> Projects <span class="badge">3</span>
244 </nav-item>
245 <nav-item data-nav-id="tasks">
246 <span>✓</span> Tasks
247 </nav-item>
248 <nav-item data-nav-id="team">
249 <span>👥</span> Team
250 </nav-item>
251 <nav-item data-nav-id="settings">
252 <span>⚙️</span> Settings
253 </nav-item>
254 </semantic-navigator>
255 </div>
256
257 <!-- Main Content -->
258 <div class="main-content">
259 <h1>Complete Component Showcase</h1>
260
261 <!-- Actions & Modals -->
262 <section>
263 <h2>01. Actions & Modals</h2>
264 <div class="demo-section">
265 <div class="button-group">
266 <semantic-action intent="primary" onclick="showModal('welcome')">
267 Open Welcome Dialog
268 </semantic-action>
269 <semantic-action intent="secondary" onclick="showModal('settings')">
270 Settings
271 </semantic-action>
272 <semantic-action intent="secondary" sentiment="destructive" onclick="showModal('delete')">
273 Delete Project
274 </semantic-action>
275 <semantic-action intent="tertiary" onclick="showNotification()">
276 Show Notification
277 </semantic-action>
278 </div>
279 </div>
280 </section>
281
282 <!-- Forms & Inputs -->
283 <section>
284 <h2>02. Forms & Inputs</h2>
285 <div class="demo-section">
286 <h3 style="margin-bottom: 16px; font-size: 16px;">Project Creation Form</h3>
287 <div class="form-row">
288 <semantic-input
289 type="text"
290 label="Project Name"
291 placeholder="Enter project name"
292 required>
293 </semantic-input>
294 </div>
295 <div class="form-row">
296 <semantic-input
297 type="textarea"
298 label="Description"
299 placeholder="Describe your project">
300 </semantic-input>
301 </div>
302 <div class="grid grid-2">
303 <semantic-input
304 type="email"
305 label="Team Email"
306 placeholder="team@example.com">
307 </semantic-input>
308 <semantic-input
309 type="url"
310 label="Repository URL"
311 placeholder="https://github.com/...">
312 </semantic-input>
313 </div>
314 <div style="margin-top: 24px;">
315 <semantic-action intent="primary" sentiment="constructive">
316 Create Project
317 </semantic-action>
318 <semantic-action intent="tertiary" style="margin-left: 12px;">
319 Cancel
320 </semantic-action>
321 </div>
322 </div>
323 </section>
324
325 <!-- Cards Grid -->
326 <section>
327 <h2>03. Project Cards</h2>
328 <div class="toolbar">
329 <div>3 active projects</div>
330 <semantic-action intent="secondary">
331 + New Project
332 </semantic-action>
333 </div>
334 <div class="grid grid-3">
335 <semantic-card>
336 <span slot="media-icon">🚀</span>
337 <card-title slot="title">Launch Campaign</card-title>
338 <card-description slot="description">
339 Marketing initiative for Q4
340 </card-description>
341 <div slot="preview">
342 <strong>Status:</strong> In Progress<br>
343 <strong>Team:</strong> 5 members<br>
344 <strong>Due:</strong> Dec 15, 2024
345 </div>
346 <div slot="actions" class="card-actions">
347 <semantic-action intent="tertiary">View</semantic-action>
348 <semantic-action intent="tertiary">Edit</semantic-action>
349 </div>
350 </semantic-card>
351
352 <semantic-card>
353 <span slot="media-icon">💻</span>
354 <card-title slot="title">Platform Redesign</card-title>
355 <card-description slot="description">
356 Complete UI/UX overhaul
357 </card-description>
358 <div slot="preview">
359 <strong>Status:</strong> Planning<br>
360 <strong>Team:</strong> 8 members<br>
361 <strong>Due:</strong> Jan 30, 2025
362 </div>
363 <div slot="actions" class="card-actions">
364 <semantic-action intent="tertiary">View</semantic-action>
365 <semantic-action intent="tertiary">Edit</semantic-action>
366 </div>
367 </semantic-card>
368
369 <semantic-card>
370 <span slot="media-icon">📊</span>
371 <card-title slot="title">Analytics Dashboard</card-title>
372 <card-description slot="description">
373 Real-time metrics and reporting
374 </card-description>
375 <div slot="preview">
376 <strong>Status:</strong> Testing<br>
377 <strong>Team:</strong> 3 members<br>
378 <strong>Due:</strong> Nov 30, 2024
379 </div>
380 <div slot="actions" class="card-actions">
381 <semantic-action intent="tertiary">View</semantic-action>
382 <semantic-action intent="tertiary">Edit</semantic-action>
383 </div>
384 </semantic-card>
385 </div>
386 </section>
387
388 <!-- Selectable List -->
389 <section>
390 <h2>04. Task List</h2>
391 <div class="demo-section">
392 <semantic-list selectable>
393 <list-item data-item-id="task-1" tabindex="0">
394 <list-item-content>
395 <list-item-title>Design new landing page</list-item-title>
396 <list-item-meta>Due today • High priority</list-item-meta>
397 </list-item-content>
398 <span>🔴</span>
399 </list-item>
400 <list-item data-item-id="task-2" tabindex="0">
401 <list-item-content>
402 <list-item-title>Review pull requests</list-item-title>
403 <list-item-meta>Due tomorrow • Medium priority</list-item-meta>
404 </list-item-content>
405 <span>🟡</span>
406 </list-item>
407 <list-item data-item-id="task-3" tabindex="0">
408 <list-item-content>
409 <list-item-title>Update documentation</list-item-title>
410 <list-item-meta>Due next week • Low priority</list-item-meta>
411 </list-item-content>
412 <span>🟢</span>
413 </list-item>
414 <list-item data-item-id="task-4" tabindex="0">
415 <list-item-content>
416 <list-item-title>Team meeting preparation</list-item-title>
417 <list-item-meta>Due Friday • Medium priority</list-item-meta>
418 </list-item-content>
419 <span>🟡</span>
420 </list-item>
421 </semantic-list>
422 </div>
423 </section>
424
425 <!-- Adjusters -->
426 <section>
427 <h2>05. Settings & Controls</h2>
428 <div class="demo-section">
429 <div class="grid grid-2">
430 <semantic-adjuster
431 label="Notification Volume"
432 value="60"
433 min="0"
434 max="100"
435 step="10">
436 </semantic-adjuster>
437 <semantic-adjuster
438 label="Auto-save Interval (min)"
439 value="5"
440 min="1"
441 max="30"
442 step="1">
443 </semantic-adjuster>
444 </div>
445 </div>
446 </section>
447
448 <!-- Right-click menu demo -->
449 <section>
450 <h2>06. Context Menu</h2>
451 <div class="demo-section">
452 <p style="margin-bottom: 16px; color: #98989d;">
453 Right-click anywhere in this box to open context menu
454 </p>
455 <div id="contextArea" style="padding: 48px; background: #2c2c2e; border-radius: 8px; text-align: center; cursor: pointer;">
456 Right-click here
457 </div>
458 </div>
459 </section>
460
461 <div style="height: 100px;"></div>
462 </div>
463 </div>
464
465 <!-- Modals -->
466 <semantic-modal id="welcomeModal">
467 <h3 slot="header">Welcome to Semantic UI</h3>
468 <div class="modal-content">
469 <p>This is a complete demonstration of intent-based, context-aware components.</p>
470 <p style="margin-top: 16px;">All interactions work across mouse, touch, keyboard, and voice without additional code.</p>
471 </div>
472 <div slot="actions">
473 <semantic-action intent="primary" onclick="closeModal('welcome')">
474 Get Started
475 </semantic-action>
476 <semantic-action intent="tertiary" onclick="closeModal('welcome')">
477 Maybe Later
478 </semantic-action>
479 </div>
480 </semantic-modal>
481
482 <semantic-modal id="settingsModal">
483 <h3 slot="header">Settings</h3>
484 <div class="modal-content">
485 <semantic-input
486 type="text"
487 label="Display Name"
488 value="John Doe"
489 style="margin-bottom: 16px;">
490 </semantic-input>
491 <semantic-input
492 type="email"
493 label="Email"
494 value="john@example.com">
495 </semantic-input>
496 </div>
497 <div slot="actions">
498 <semantic-action intent="primary" sentiment="constructive" onclick="closeModal('settings')">
499 Save Changes
500 </semantic-action>
501 <semantic-action intent="tertiary" onclick="closeModal('settings')">
502 Cancel
503 </semantic-action>
504 </div>
505 </semantic-modal>
506
507 <semantic-modal id="deleteModal" urgency="critical" dismissible="false">
508 <h3 slot="header" style="color: #ff3b30;">⚠️ Delete Project</h3>
509 <div class="modal-content">
510 <p>Are you sure you want to delete this project? This action cannot be undone.</p>
511 <p style="margin-top: 16px; color: #ff3b30; font-weight: 600;">All data will be permanently lost.</p>
512 </div>
513 <div slot="actions">
514 <semantic-action intent="secondary" sentiment="destructive" onclick="closeModal('delete')">
515 Delete Forever
516 </semantic-action>
517 <semantic-action intent="tertiary" onclick="closeModal('delete')">
518 Cancel
519 </semantic-action>
520 </div>
521 </semantic-modal>
522
523 <!-- Context Menu -->
524 <semantic-menu id="contextMenu">
525 <menu-item data-menu-id="open">
526 <span>📂</span> Open
527 </menu-item>
528 <menu-item data-menu-id="edit">
529 <span>✏️</span> Edit
530 </menu-item>
531 <menu-item data-menu-id="share">
532 <span>🔗</span> Share
533 </menu-item>
534 <div style="height: 1px; background: #38383a; margin: 4px 0;"></div>
535 <menu-item data-menu-id="delete">
536 <span>🗑️</span> Delete
537 </menu-item>
538 </semantic-menu>
539
540 <!-- Voice Toggle Button -->
541 <button class="voice-toggle" id="voiceToggle" title="Toggle Voice Commands (Ctrl+Shift+V)">
542 🎤
543 </button>
544
545 <!-- Status Bar -->
546 <div class="status-bar">
547 <div class="status-item">
548 <span>✓</span> All systems operational
549 </div>
550 <div class="status-item">
551 Last saved: Just now
552 </div>
553 <div class="status-item">
554 <span id="voiceStatus">Voice: Off</span>
555 </div>
556 </div>
557
558 <script>
559 // Modal controls
560 function showModal(type) {
561 const modals = {
562 'welcome': 'welcomeModal',
563 'settings': 'settingsModal',
564 'delete': 'deleteModal'
565 };
566 const modal = document.getElementById(modals[type]);
567 if (modal) modal.open();
568 }
569
570 function closeModal(type) {
571 const modals = {
572 'welcome': 'welcomeModal',
573 'settings': 'settingsModal',
574 'delete': 'deleteModal'
575 };
576 const modal = document.getElementById(modals[type]);
577 if (modal) modal.close();
578 }
579
580 // Notification
581 function showNotification() {
582 const notification = document.createElement('semantic-feedback');
583 notification.setAttribute('urgency', 'medium');
584 notification.setAttribute('auto-dismiss', '');
585 notification.textContent = 'This is a sample notification that will auto-dismiss in 5 seconds.';
586
587 notification.style.position = 'fixed';
588 notification.style.top = '24px';
589 notification.style.right = '24px';
590 notification.style.zIndex = '10000';
591 notification.style.minWidth = '400px';
592
593 document.body.appendChild(notification);
594 }
595
596 // Context menu
597 const contextArea = document.getElementById('contextArea');
598 const contextMenu = document.getElementById('contextMenu');
599
600 contextArea.addEventListener('contextmenu', (e) => {
601 e.preventDefault();
602 contextMenu.open(e.clientX, e.clientY);
603 });
604
605 // Listen to all intents
606 document.addEventListener('intent', (e) => {
607 console.log('Intent:', e.detail.type, e.detail);
608
609 // Update status bar
610 const statusBar = document.querySelector('.status-bar .status-item:last-child');
611 const activeCount = document.querySelectorAll('[attention-state="allocated"]').length;
612 statusBar.textContent = `${activeCount} components active`;
613 });
614
615 // Navigator intent
616 document.querySelector('semantic-navigator').addEventListener('intent', (e) => {
617 if (e.detail.type === 'navigate') {
618 console.log('Navigate to:', e.detail.id);
619
620 // Update current item
621 document.querySelectorAll('nav-item').forEach(item => {
622 item.removeAttribute('aria-current');
623 });
624 document.querySelector(`[data-nav-id="${e.detail.id}"]`)?.setAttribute('aria-current', 'page');
625 }
626 });
627
628 // List selection
629 document.querySelector('semantic-list').addEventListener('intent', (e) => {
630 if (e.detail.type === 'select') {
631 console.log('Selected task:', e.detail.id, 'Selected:', e.detail.selected);
632 }
633 });
634
635 // Menu selection
636 contextMenu.addEventListener('intent', (e) => {
637 if (e.detail.type === 'select') {
638 console.log('Menu action:', e.detail.id);
639 showNotification();
640 }
641 });
642
643 // Voice control
644 const voiceToggle = document.getElementById('voiceToggle');
645 const voiceStatus = document.getElementById('voiceStatus');
646
647 voiceToggle.addEventListener('click', () => {
648 if (window.voiceSystem) {
649 window.voiceSystem.toggle();
650 updateVoiceStatus();
651 }
652 });
653
654 function updateVoiceStatus() {
655 if (window.voiceSystem && window.voiceSystem.isListening) {
656 voiceToggle.classList.add('active');
657 voiceStatus.textContent = '🎤 Voice: Listening';
658 voiceStatus.style.color = '#ff3b30';
659 } else {
660 voiceToggle.classList.remove('active');
661 voiceStatus.textContent = 'Voice: Off';
662 voiceStatus.style.color = '#98989d';
663 }
664 }
665
666 // Check voice status periodically
667 setInterval(updateVoiceStatus, 500);
668
669 // Show welcome modal on load
670 setTimeout(() => {
671 showModal('welcome');
672 }, 500);
673 </script>
674</body>
675</html>