cyclecad 3.0.0 → 3.1.0

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 (66) hide show
  1. package/BILLING-IMPLEMENTATION-SUMMARY.md +425 -0
  2. package/BILLING-INDEX.md +293 -0
  3. package/BILLING-INTEGRATION-GUIDE.md +414 -0
  4. package/COLLABORATION-INDEX.md +440 -0
  5. package/COLLABORATION-SYSTEM-SUMMARY.md +548 -0
  6. package/DOCKER-BUILD-MANIFEST.txt +483 -0
  7. package/DOCKER-FILES-REFERENCE.md +440 -0
  8. package/DOCKER-INFRASTRUCTURE.md +475 -0
  9. package/DOCKER-README.md +435 -0
  10. package/Dockerfile +33 -55
  11. package/PWA-FILES-CREATED.txt +350 -0
  12. package/QUICK-START-TESTING.md +126 -0
  13. package/STEP-IMPORT-QUICKSTART.md +347 -0
  14. package/STEP-IMPORT-SYSTEM-SUMMARY.md +502 -0
  15. package/app/css/mobile.css +1074 -0
  16. package/app/icons/generate-icons.js +203 -0
  17. package/app/js/billing-ui.js +990 -0
  18. package/app/js/brep-kernel.js +933 -981
  19. package/app/js/collab-client.js +750 -0
  20. package/app/js/mobile-nav.js +623 -0
  21. package/app/js/mobile-toolbar.js +476 -0
  22. package/app/js/modules/billing-module.js +724 -0
  23. package/app/js/modules/step-module-enhanced.js +938 -0
  24. package/app/js/offline-manager.js +705 -0
  25. package/app/js/responsive-init.js +360 -0
  26. package/app/js/touch-handler.js +429 -0
  27. package/app/manifest.json +211 -0
  28. package/app/offline.html +508 -0
  29. package/app/sw.js +571 -0
  30. package/app/tests/billing-tests.html +779 -0
  31. package/app/tests/brep-tests.html +980 -0
  32. package/app/tests/collab-tests.html +743 -0
  33. package/app/tests/mobile-tests.html +1299 -0
  34. package/app/tests/pwa-tests.html +1134 -0
  35. package/app/tests/step-tests.html +1042 -0
  36. package/app/tests/test-agent-v3.html +719 -0
  37. package/docker-compose.yml +225 -0
  38. package/docs/BILLING-HELP.json +260 -0
  39. package/docs/BILLING-README.md +639 -0
  40. package/docs/BILLING-TUTORIAL.md +736 -0
  41. package/docs/BREP-HELP.json +326 -0
  42. package/docs/BREP-TUTORIAL.md +802 -0
  43. package/docs/COLLABORATION-HELP.json +228 -0
  44. package/docs/COLLABORATION-TUTORIAL.md +818 -0
  45. package/docs/DOCKER-HELP.json +224 -0
  46. package/docs/DOCKER-TUTORIAL.md +974 -0
  47. package/docs/MOBILE-HELP.json +243 -0
  48. package/docs/MOBILE-RESPONSIVE-README.md +378 -0
  49. package/docs/MOBILE-TUTORIAL.md +747 -0
  50. package/docs/PWA-HELP.json +228 -0
  51. package/docs/PWA-README.md +662 -0
  52. package/docs/PWA-TUTORIAL.md +757 -0
  53. package/docs/STEP-HELP.json +481 -0
  54. package/docs/STEP-IMPORT-TUTORIAL.md +824 -0
  55. package/docs/TESTING-GUIDE.md +528 -0
  56. package/docs/TESTING-HELP.json +182 -0
  57. package/fusion-vs-cyclecad.html +1771 -0
  58. package/nginx.conf +237 -0
  59. package/package.json +1 -1
  60. package/server/Dockerfile.converter +51 -0
  61. package/server/Dockerfile.signaling +28 -0
  62. package/server/billing-server.js +487 -0
  63. package/server/converter-enhanced.py +528 -0
  64. package/server/requirements-converter.txt +29 -0
  65. package/server/signaling-server.js +801 -0
  66. package/tests/docker-tests.sh +389 -0
@@ -0,0 +1,757 @@
1
+ # cycleCAD Progressive Web App (PWA) Tutorial
2
+
3
+ ## Table of Contents
4
+ 1. [What is a PWA?](#what-is-a-pwa)
5
+ 2. [Why PWA for CAD?](#why-pwa-for-cad)
6
+ 3. [Installation Guide](#installation-guide)
7
+ 4. [Offline Mode](#offline-mode)
8
+ 5. [Cache Management](#cache-management)
9
+ 6. [File Handling](#file-handling)
10
+ 7. [Background Sync](#background-sync)
11
+ 8. [Storage & Quota](#storage--quota)
12
+ 9. [Troubleshooting](#troubleshooting)
13
+ 10. [Advanced Features](#advanced-features)
14
+
15
+ ---
16
+
17
+ ## What is a PWA?
18
+
19
+ A **Progressive Web App (PWA)** is a web application that uses modern web technologies to provide an app-like experience directly in your browser. PWAs combine the best of web and native apps:
20
+
21
+ ### Key Characteristics
22
+ - **Installable** — Add to home screen like a native app
23
+ - **Works Offline** — Full functionality without internet
24
+ - **Fast** — Instant loads with service worker caching
25
+ - **Responsive** — Works on desktop, tablet, and mobile
26
+ - **No Installation Required** — No App Store needed
27
+
28
+ ### cycleCAD as a PWA
29
+ cycleCAD is a fully-featured PWA that includes:
30
+ - Complete 3D CAD modeling offline
31
+ - Service worker for intelligent caching
32
+ - File handling integration with your OS
33
+ - Background sync for offline changes
34
+ - Installable as a standalone app
35
+
36
+ ---
37
+
38
+ ## Why PWA for CAD?
39
+
40
+ ### Problem: Traditional CAD Requires Installation
41
+ - Large download sizes (Fusion 360: 2+ GB, SolidWorks: 5+ GB)
42
+ - System requirements and compatibility issues
43
+ - Updates take hours
44
+ - No cross-platform compatibility
45
+ - Licensing tied to specific machines
46
+
47
+ ### Solution: cycleCAD PWA
48
+ - **Instant Start** — Click and start designing (no install)
49
+ - **Works Everywhere** — Windows, Mac, Linux, iPad, Android
50
+ - **Offline-First** — No internet needed for core modeling
51
+ - **Always Updated** — Automatic updates in background
52
+ - **Zero Installation** — Just open in browser or add to home screen
53
+
54
+ ---
55
+
56
+ ## Installation Guide
57
+
58
+ ### Desktop (Windows, macOS, Linux)
59
+
60
+ #### Chrome / Edge / Brave
61
+ 1. Go to [cyclecad.com/app](https://cyclecad.com/app)
62
+ 2. Look for the install prompt (usually top-right):
63
+ ```
64
+ [+] Install
65
+ ```
66
+ 3. Click "Install" or press `Ctrl+Shift+I`
67
+ 4. Choose a location (desktop or app menu)
68
+ 5. cycleCAD appears in your app drawer
69
+
70
+ **After Installation:**
71
+ - Opens in standalone window (no address bar)
72
+ - Pinned to taskbar/dock
73
+ - Keyboard shortcut available
74
+ - Full offline support
75
+
76
+ #### Manual Installation (All Browsers)
77
+ If no install prompt appears:
78
+ 1. Open cycleCAD: [cyclecad.com/app](https://cyclecad.com/app)
79
+ 2. Browser menu → "Install" or "Add to home screen"
80
+ 3. Choose app name and location
81
+
82
+ ### Mobile (iOS, Android)
83
+
84
+ #### Android
85
+ 1. Open [cyclecad.com/app](https://cyclecad.com/app) in Chrome
86
+ 2. Browser menu (⋮) → "Install app" or "Add to Home Screen"
87
+ 3. Confirm name and icon
88
+ 4. App appears on home screen
89
+ 5. Tap to open in standalone mode
90
+
91
+ **On first install, you'll see:**
92
+ ```
93
+ Storage: 500 MB available
94
+ Offline: Full modeling support
95
+ Auto-save: Every operation
96
+ ```
97
+
98
+ #### iOS (Safari)
99
+ 1. Open [cyclecad.com/app](https://cyclecad.com/app) in Safari
100
+ 2. Share button (↑) → "Add to Home Screen"
101
+ 3. Choose name (default: "cycleCAD")
102
+ 4. Tap "Add"
103
+ 5. App appears on home screen
104
+
105
+ **Note:** iOS PWA support requires:
106
+ - iOS 11.3+ (most devices)
107
+ - Full offline modeling support
108
+ - Can't access iCloud Drive directly (use file picker)
109
+
110
+ ### Installation Permissions
111
+ On first visit, cycleCAD requests permissions for:
112
+ - **Service Worker** — Offline functionality and caching
113
+ - **Storage** — Save projects and cache models
114
+ - **Notifications** — Update alerts and sync status (optional)
115
+
116
+ All requests are **optional**. The app works without them, but offline mode requires service worker and storage permissions.
117
+
118
+ ---
119
+
120
+ ## Offline Mode
121
+
122
+ ### What Works Offline
123
+ cycleCAD has **full offline support** for:
124
+
125
+ ✓ **Modeling**
126
+ - Create sketches and 3D features
127
+ - Extrude, revolve, fillet, chamfer
128
+ - Boolean operations
129
+ - Parameters and constraints
130
+ - Assembly mode with mates
131
+ - Part tree and history
132
+
133
+ ✓ **Viewing & Navigation**
134
+ - Rotate, pan, zoom 3D view
135
+ - ViewCube navigation
136
+ - Multiple preset views
137
+ - Wireframe and shaded modes
138
+ - Section cuts and measurements
139
+
140
+ ✓ **Export & File Handling**
141
+ - Export to STL (ASCII and binary)
142
+ - Export to OBJ and glTF
143
+ - Export to DXF (2D drawings)
144
+ - Sketches to PDF (drawing views)
145
+
146
+ ✓ **Productivity**
147
+ - Feature tree with suppress/delete
148
+ - Undo/redo with full history
149
+ - Keyboard shortcuts (25+)
150
+ - Search and filter parts
151
+ - Parameter editing
152
+
153
+ ### What Requires Internet
154
+ ⚠ **Features requiring connectivity:**
155
+ - STEP file import/export (uses cloud converter)
156
+ - AI analysis and design review
157
+ - Sync with cloud projects
158
+ - Share links and collaboration
159
+ - AI chatbot and copilot features
160
+ - Model marketplace
161
+
162
+ ### Offline Workflow
163
+
164
+ **Scenario 1: Design offline, sync later**
165
+ ```
166
+ 1. Go offline (airplane mode or disconnect)
167
+ 2. Create new project or open cached one
168
+ 3. Design for 2+ hours
169
+ 4. Reconnect to internet
170
+ 5. Changes auto-sync to cloud (if enabled)
171
+ ```
172
+
173
+ **Scenario 2: Import STEP, then design offline**
174
+ ```
175
+ 1. Online: Import STEP file (converted on server)
176
+ 2. File is automatically cached
177
+ 3. Go offline
178
+ 4. Open cached model in viewer
179
+ 5. Make notes, measurements, markups
180
+ 6. Back online: sync annotations
181
+ ```
182
+
183
+ **Scenario 3: Collaborate offline, sync together**
184
+ ```
185
+ 1. Two team members open same project
186
+ 2. Both go offline, design independently
187
+ 3. Changes stored locally
188
+ 4. Reconnect together
189
+ 5. Merge strategy: last-write-wins or manual merge
190
+ ```
191
+
192
+ ### Offline Indicators
193
+ cycleCAD shows your connection status in multiple places:
194
+
195
+ - **Top banner (red)** — "You are offline" when disconnected
196
+ - **Status bar** — Connection icon in bottom-right
197
+ - **Dialog boxes** — Operations that require internet show warning
198
+ - **Notifications** — "Will sync when online" on each offline operation
199
+
200
+ ### Manual Sync
201
+ To manually sync offline changes:
202
+ 1. Ensure internet is connected
203
+ 2. Browser detects connection automatically
204
+ 3. Sync dialog appears: "Syncing X changes..."
205
+ 4. Operations upload one-by-one with progress bar
206
+ 5. When done: "All changes synced!"
207
+
208
+ ---
209
+
210
+ ## Cache Management
211
+
212
+ ### What Gets Cached
213
+
214
+ | Item | Cache Size | Strategy |
215
+ |------|-----------|----------|
216
+ | HTML/JS/CSS | 5-10 MB | Cache-first, expires monthly |
217
+ | Models (GLB) | 100-500 MB | LRU eviction when full |
218
+ | STEP files | 50-100 MB | Size-limited cache |
219
+ | CDN resources | 2-5 MB | Long-lived (yearly) |
220
+ | API responses | 1-5 MB | Network-first |
221
+ | Projects | IndexedDB | Unlimited, user-managed |
222
+
223
+ ### Viewing Cache Size
224
+
225
+ **In Settings:**
226
+ 1. Click Settings gear (⚙️)
227
+ 2. Scroll to "Offline & Cache" section
228
+ 3. Shows current cache size: "Cache: 245 MB"
229
+
230
+ **Programmatically:**
231
+ ```javascript
232
+ const size = await window.offlineManager.getCacheSize();
233
+ console.log('Cache:', window.offlineManager.formatBytes(size));
234
+ ```
235
+
236
+ ### Clearing Cache
237
+
238
+ **Option 1: Settings Panel**
239
+ 1. Settings → Offline & Cache
240
+ 2. Click "Clear Cache"
241
+ 3. Confirm dialog: "Clear all cached files?"
242
+ 4. Cache cleared immediately
243
+
244
+ **Option 2: Browser DevTools**
245
+ 1. Open Chrome/Edge DevTools (`F12`)
246
+ 2. Application tab
247
+ 3. Cache Storage
248
+ 4. Delete `cyclecad-static-v3`, `cyclecad-dynamic-v3`, `cyclecad-models-v3`
249
+ 5. Reload page
250
+
251
+ **Option 3: Programmatically**
252
+ ```javascript
253
+ await window.offlineManager.clearCache();
254
+ ```
255
+
256
+ ### Cache Limits
257
+
258
+ cycleCAD respects browser storage quotas:
259
+
260
+ | Browser | Max Storage |
261
+ |---------|------------|
262
+ | Chrome/Edge | 50% of disk (min 100 MB) |
263
+ | Firefox | 10% of available space |
264
+ | Safari (desktop) | 50 MB per domain |
265
+ | Safari (iOS) | 50 MB per app |
266
+
267
+ When cache exceeds limit:
268
+ 1. Oldest cached files are deleted first (LRU)
269
+ 2. User notification: "Cache size reduced to 400 MB"
270
+ 3. Recent projects always kept
271
+ 4. Models removed by access date
272
+
273
+ ---
274
+
275
+ ## File Handling
276
+
277
+ ### Opening Files Directly
278
+
279
+ #### From File Explorer / Finder
280
+ 1. Right-click STEP, STL, or OBJ file
281
+ 2. "Open With" → cycleCAD
282
+ 3. File opens in cycleCAD automatically
283
+ 4. If app not installed, opens web version
284
+
285
+ **Supported file types:**
286
+ - `.step`, `.stp` — STEP assemblies and parts
287
+ - `.stl`, `.STL` — STL models
288
+ - `.obj`, `.OBJ` — OBJ meshes
289
+ - `.glb`, `.GLB` — glTF binaries
290
+ - `.gltf` — glTF with separate resources
291
+
292
+ #### From Drag & Drop
293
+ 1. Drag file from File Explorer onto cycleCAD window
294
+ 2. Automatically opens in import dialog
295
+ 3. Shows preview and import options
296
+ 4. Click "Import"
297
+
298
+ ### Sharing Files to cycleCAD
299
+
300
+ #### Share from File Explorer (Windows)
301
+ 1. Right-click file
302
+ 2. "Share" → cycleCAD
303
+ 3. Opens in cycleCAD immediately
304
+
305
+ #### Share from Finder (macOS)
306
+ 1. Right-click file
307
+ 2. "Share" → More...
308
+ 3. Select cycleCAD
309
+ 4. Opens in cycleCAD
310
+
311
+ #### Share from Android Files App
312
+ 1. Long-press file
313
+ 2. Share → cycleCAD
314
+ 3. Opens in Android cycleCAD app
315
+
316
+ ### Custom URL Schemes
317
+
318
+ cycleCAD supports custom URLs for deep linking:
319
+
320
+ ```
321
+ web+cyclecad:project=abc123
322
+ web+cyclecad:file=imports/bearing.step
323
+ web+cyclecad:action=new
324
+ web+cyclecad:action=open
325
+ ```
326
+
327
+ Registration (automatic):
328
+ 1. First time visiting cyclecad.com/app
329
+ 2. Browser asks: "Allow cycleCAD to open files?"
330
+ 3. Click "Allow"
331
+ 4. Protocol registered globally
332
+
333
+ ---
334
+
335
+ ## Background Sync
336
+
337
+ ### What is Background Sync?
338
+
339
+ When offline operations are queued and you lose internet:
340
+ 1. Changes saved locally in IndexedDB
341
+ 2. When online returns, they **automatically upload**
342
+ 3. User sees progress: "Syncing 3 changes..."
343
+ 4. No manual intervention needed
344
+
345
+ ### How It Works
346
+
347
+ **Offline Operation:**
348
+ ```javascript
349
+ // User: Extrude a feature while offline
350
+ // Result: queued locally
351
+ offlineManager.queueOperation({
352
+ type: 'extrude',
353
+ sketchId: '123',
354
+ depth: 25
355
+ });
356
+ // Shows: "Queued - will sync online"
357
+ ```
358
+
359
+ **Back Online:**
360
+ ```
361
+ 1. Browser detects connection
362
+ 2. Service Worker wakes up
363
+ 3. Retrieves queued operations from IndexedDB
364
+ 4. Sends each one to server: /api/operations
365
+ 5. Removes from queue on success
366
+ 6. Shows: "Synced 3 operations"
367
+ ```
368
+
369
+ ### Sync Reliability
370
+ - **Automatic retry** — Failed ops retry 3 times
371
+ - **Persistent** — Queue survives app crash/refresh
372
+ - **Ordered** — Operations sync in creation order
373
+ - **Transactional** — All-or-nothing per operation
374
+ - **Silent** — No notifications unless error or complete
375
+
376
+ ### Monitoring Sync
377
+
378
+ **In Console:**
379
+ ```javascript
380
+ navigator.serviceWorker.addEventListener('message', (event) => {
381
+ if (event.data.type === 'SYNC_COMPLETE') {
382
+ console.log('Sync done:', event.data);
383
+ }
384
+ });
385
+ ```
386
+
387
+ **In Settings:**
388
+ 1. Settings → Offline & Cache
389
+ 2. Synced operations listed with timestamps
390
+ 3. Failed operations show error details
391
+
392
+ ---
393
+
394
+ ## Storage & Quota
395
+
396
+ ### Understanding Storage Quota
397
+
398
+ Your browser has a **limited storage budget** for all PWAs:
399
+
400
+ ```
401
+ Total Available = Free Disk Space * 50% (Chrome)
402
+ = Device Storage * 10% (Firefox)
403
+ = 50 MB per domain (Safari)
404
+ ```
405
+
406
+ **Example (Chrome on 500GB disk):**
407
+ ```
408
+ Available = 500 GB * 50% = 250 GB
409
+ cycleCAD can use up to 250 GB
410
+ After: 200 MB used
411
+ Remaining: 249.8 GB
412
+ ```
413
+
414
+ ### Checking Quota
415
+
416
+ **In Browser Console:**
417
+ ```javascript
418
+ const estimate = await navigator.storage.estimate();
419
+ console.log('Used:', estimate.usage, 'bytes');
420
+ console.log('Quota:', estimate.quota, 'bytes');
421
+ console.log('Percentage:', (estimate.usage / estimate.quota * 100).toFixed(1), '%');
422
+ ```
423
+
424
+ **In Settings Panel:**
425
+ ```
426
+ Storage Status
427
+ ├─ Used: 245 MB
428
+ ├─ Quota: 250 GB
429
+ └─ Free: 249.7 GB
430
+ ```
431
+
432
+ ### Persistent Storage
433
+
434
+ By default, cache can be cleared by browser without notice:
435
+ 1. Browser running low on disk
436
+ 2. Browser clears caches oldest first
437
+ 3. Your projects might disappear
438
+
439
+ **To Prevent Deletion:**
440
+ 1. Settings → Offline & Cache
441
+ 2. Toggle "Keep Storage" (requests persistent permission)
442
+ 3. Browser asks: "Keep data for cycleCAD?"
443
+ 4. Click "Allow"
444
+ 5. Storage is now persistent (won't auto-clear)
445
+
446
+ ### If Storage Full
447
+
448
+ cycleCAD automatically:
449
+ 1. Removes oldest cached models (LRU)
450
+ 2. Keeps recent projects and exports
451
+ 3. Shows notification: "Cache reduced to 400 MB"
452
+ 4. User can manually delete old projects
453
+
454
+ **Manual Cleanup:**
455
+ 1. Settings → Projects
456
+ 2. Hover over old project
457
+ 3. Click "Delete" (delete icon)
458
+ 4. Confirm
459
+ 5. Frees space immediately
460
+
461
+ ---
462
+
463
+ ## Troubleshooting
464
+
465
+ ### "App won't install"
466
+
467
+ **Causes:**
468
+ - Browser doesn't support PWA (old Safari)
469
+ - HTTPS not enabled on domain
470
+ - Manifest.json has errors
471
+ - Service Worker failed to register
472
+
473
+ **Fixes:**
474
+ 1. Try different browser (Chrome, Edge, Firefox)
475
+ 2. Check URL starts with `https://`
476
+ 3. Press `F12`, look for red errors in Console tab
477
+ 4. Refresh page with `Ctrl+Shift+R` (hard refresh)
478
+ 5. Clear cache and cookies for site, then refresh
479
+
480
+ ### "No offline mode / Internet required"
481
+
482
+ **Causes:**
483
+ - Service Worker not registered
484
+ - Service Worker failed to load
485
+ - Browser private/incognito mode
486
+
487
+ **Fixes:**
488
+ 1. Check Settings → Offline & Cache
489
+ 2. Look for "Service Worker: Ready" indicator
490
+ 3. Try non-private window
491
+ 4. In Console, check for SW errors: `[SW]` logs
492
+ 5. Refresh page: `F5` or `Ctrl+R`
493
+
494
+ ### "Cache stuck / won't clear"
495
+
496
+ **Causes:**
497
+ - Service Worker holding lock
498
+ - Browser caching issue
499
+ - IndexedDB transaction in progress
500
+
501
+ **Fixes:**
502
+ 1. Close all cycleCAD tabs and windows
503
+ 2. Clear browser cache: `Ctrl+Shift+Delete`
504
+ 3. Check DevTools → Application → Clear Storage
505
+ 4. Restart browser completely
506
+ 5. Refresh cycleCAD
507
+
508
+ ### "Offline changes didn't sync"
509
+
510
+ **Causes:**
511
+ - Network unstable during sync
512
+ - Operation failed validation
513
+ - Cloud project locked by another user
514
+
515
+ **Fixes:**
516
+ 1. Go back online and check connection
517
+ 2. Settings → Offline & Cache → Sync Now
518
+ 3. Check notification for errors
519
+ 4. Refresh page: `F5`
520
+ 5. Manually re-do operation if needed
521
+
522
+ ### "Takes forever to load"
523
+
524
+ **Causes:**
525
+ - Large model cached
526
+ - Service Worker updating cache
527
+ - Network slow for first visit
528
+
529
+ **Fixes:**
530
+ 1. Wait 10 seconds (cache building)
531
+ 2. Hard refresh: `Ctrl+Shift+R`
532
+ 3. Clear cache and reload
533
+ 4. Switch to better WiFi
534
+ 5. Download should finish in <30 seconds
535
+
536
+ ### "App keeps asking for permissions"
537
+
538
+ **Causes:**
539
+ - Browser blocking storage
540
+ - Service Worker permissions denied
541
+ - Private browsing mode
542
+
543
+ **Fixes:**
544
+ 1. Check browser settings → Privacy
545
+ 2. Whitelist cyclecad.com:
546
+ - Chrome: Settings → Privacy → Site Settings → Storage
547
+ - Firefox: Privacy → Permissions → Storage
548
+ 3. Exit private browsing mode
549
+ 4. Disable VPN/proxy temporarily
550
+
551
+ ---
552
+
553
+ ## Advanced Features
554
+
555
+ ### Custom Service Worker Events
556
+
557
+ Listen for service worker messages in your app:
558
+
559
+ ```javascript
560
+ navigator.serviceWorker.addEventListener('message', (event) => {
561
+ const { type, message } = event.data;
562
+
563
+ if (type === 'UPDATE_AVAILABLE') {
564
+ // New version available
565
+ console.log(message); // "A new version..."
566
+ // Show update prompt to user
567
+ }
568
+
569
+ if (type === 'SYNC_COMPLETE') {
570
+ // Background sync finished
571
+ console.log(message); // "All changes synced!"
572
+ // Refresh UI from server
573
+ }
574
+
575
+ if (type === 'CACHE_CLEARED') {
576
+ // Cache was cleared
577
+ console.log(message);
578
+ }
579
+ });
580
+ ```
581
+
582
+ ### Caching Strategies
583
+
584
+ cycleCAD uses 4 different caching strategies:
585
+
586
+ 1. **Cache-First** (Static Assets)
587
+ - Check cache first
588
+ - If missing, fetch from network
589
+ - Update cache in background
590
+ - Best for: HTML, JS, CSS, fonts
591
+
592
+ 2. **Network-First** (API Calls)
593
+ - Try network first
594
+ - If fails, fallback to cache
595
+ - Keep cache fresh always
596
+ - Best for: API responses, data
597
+
598
+ 3. **Stale-While-Revalidate** (CDN)
599
+ - Return cache immediately
600
+ - Update cache in background
601
+ - User sees instant + refreshes
602
+ - Best for: Third-party libraries
603
+
604
+ 4. **Cache-Only** (Offline Files)
605
+ - Use cache or fail
606
+ - No network requests
607
+ - Best for: Emergency fallbacks
608
+
609
+ ### Programmatic Access
610
+
611
+ Control PWA features from JavaScript:
612
+
613
+ ```javascript
614
+ // Get offline manager instance
615
+ const om = window.offlineManager;
616
+
617
+ // Check online status
618
+ if (om.isOnline) {
619
+ console.log('Connected!');
620
+ } else {
621
+ console.log('Offline mode');
622
+ }
623
+
624
+ // Queue operation
625
+ await om.queueOperation({
626
+ type: 'extrude',
627
+ depth: 25
628
+ });
629
+
630
+ // Manual sync
631
+ await om.syncOperations();
632
+
633
+ // Cache size
634
+ const bytes = await om.getCacheSize();
635
+ const mb = om.formatBytes(bytes);
636
+ console.log('Cache:', mb);
637
+
638
+ // Clear cache
639
+ await om.clearCache();
640
+ ```
641
+
642
+ ### Performance Monitoring
643
+
644
+ Monitor PWA performance:
645
+
646
+ ```javascript
647
+ // Check service worker status
648
+ navigator.serviceWorker.getRegistration('/app/').then((reg) => {
649
+ console.log('SW Active:', reg.active ? 'Yes' : 'No');
650
+ console.log('SW Updates:', reg.installing ? 'Pending' : 'None');
651
+ });
652
+
653
+ // Check storage quota
654
+ navigator.storage.estimate().then((est) => {
655
+ console.log('Using:', (est.usage / 1024 / 1024).toFixed(1), 'MB');
656
+ console.log('Quota:', (est.quota / 1024 / 1024).toFixed(1), 'MB');
657
+ });
658
+
659
+ // Check cache size
660
+ navigator.storage.getDirectory().then((root) => {
661
+ // Iterate through cache storage
662
+ });
663
+ ```
664
+
665
+ ---
666
+
667
+ ## Best Practices
668
+
669
+ ### For Optimal Offline Experience
670
+
671
+ 1. **Install the App**
672
+ - Use standalone mode for best experience
673
+ - Pinned to dock/taskbar for quick access
674
+
675
+ 2. **Manage Cache**
676
+ - Regularly check cache size in Settings
677
+ - Delete old projects you don't need
678
+ - Keep cache under 1 GB for best performance
679
+
680
+ 3. **Network-Aware Design**
681
+ - Plan offline work before going offline
682
+ - Test with offline mode enabled
683
+ - Understand which features need internet
684
+
685
+ 4. **Update Regularly**
686
+ - Accept update prompts when offered
687
+ - Automatic in background, doesn't interrupt
688
+ - Keeps security and features current
689
+
690
+ 5. **Backup Important Work**
691
+ - Export projects to files regularly
692
+ - Cloud save for critical designs
693
+ - Multiple local copies
694
+
695
+ ### For Teams
696
+
697
+ 1. **Collaboration**
698
+ - Work offline, sync later together
699
+ - Merge changes with conflict resolution
700
+ - Track who made which changes
701
+
702
+ 2. **File Sharing**
703
+ - Use share target to open files directly
704
+ - Team folder in cloud auto-syncs
705
+ - Version history for tracking
706
+
707
+ 3. **Large Assemblies**
708
+ - Cache key models before offline
709
+ - Use viewer mode for lightweight viewing
710
+ - Split large designs into sub-assemblies
711
+
712
+ ---
713
+
714
+ ## Getting Help
715
+
716
+ ### Documentation
717
+ - Full API: [docs.cyclecad.com](https://docs.cyclecad.com)
718
+ - User manual: [cyclecad.com/docs/manual.html](https://cyclecad.com/docs/manual.html)
719
+
720
+ ### Support
721
+ - GitHub Issues: [github.com/vvlars-cmd/cyclecad/issues](https://github.com/vvlars-cmd/cyclecad/issues)
722
+ - Email: hello@cyclecad.com
723
+ - Discord: [discord.gg/cyclecad](https://discord.gg/cyclecad)
724
+
725
+ ### Reporting Bugs
726
+ When reporting PWA issues, include:
727
+ - Browser and version
728
+ - Device (desktop/mobile)
729
+ - Online/offline status
730
+ - Steps to reproduce
731
+ - Console errors (`F12` → Console tab)
732
+
733
+ ---
734
+
735
+ ## Appendix: Browser Compatibility
736
+
737
+ | Browser | Desktop | Mobile | PWA Support |
738
+ |---------|---------|--------|------------|
739
+ | Chrome | ✓ | ✓ | Full |
740
+ | Edge | ✓ | ✓ | Full |
741
+ | Firefox | ✓ | ✓ | Partial* |
742
+ | Safari | ✓ | ✓ | Partial* |
743
+ | Opera | ✓ | ✓ | Full |
744
+
745
+ \* = Limited offline or file handling support
746
+
747
+ ### Minimum Requirements
748
+ - HTTPS enabled
749
+ - Service Worker support
750
+ - IndexedDB (5MB+ quota)
751
+ - 100MB+ available disk space
752
+
753
+ ---
754
+
755
+ **Last Updated:** 2026-03-31
756
+ **Version:** 3.0.0
757
+ **License:** MIT