-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1380 lines (1233 loc) · 66.3 KB
/
Copy pathindex.html
File metadata and controls
1380 lines (1233 loc) · 66.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CodeUChain Python - Async-First Chain Architecture</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
'mono': ['JetBrains Mono', 'monospace'],
'sans': ['Inter', 'system-ui', 'sans-serif'],
},
colors: {
'code-dark': '#0f0f23',
'code-darker': '#0a0a14',
'code-accent': '#00d4ff',
'code-green': '#00ff88',
'code-purple': '#9d4edd',
'code-orange': '#ff6b35',
},
animation: {
'fade-in': 'fadeIn 0.8s ease-out',
'slide-up': 'slideUp 0.6s ease-out',
'glow': 'glow 2s ease-in-out infinite alternate',
},
keyframes: {
fadeIn: {
'0%': { opacity: '0' },
'100%': { opacity: '1' },
},
slideUp: {
'0%': { opacity: '0', transform: 'translateY(30px)' },
'100%': { opacity: '1', transform: 'translateY(0)' },
},
glow: {
'0%': { boxShadow: '0 0 20px rgba(0, 212, 255, 0.3)' },
'100%': { boxShadow: '0 0 30px rgba(0, 212, 255, 0.6)' },
}
}
}
}
}
</script>
<style>
.code-block {
background: linear-gradient(135deg, #0a0a14 0%, #1a1a2e 100%);
border: 1px solid rgba(0, 212, 255, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.hover-lift {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-lift:hover {
transform: translateY(-8px);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}
.gradient-text {
background: linear-gradient(135deg, #00d4ff 0%, #9d4edd 50%, #00ff88 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.glass-morphism {
background: rgba(255, 255, 255, 0.05);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.logo-svg {
width: 20px;
height: 20px;
color: white;
}
</style>
</head>
<body class="bg-gradient-to-br from-code-dark via-code-darker to-black text-gray-100 min-h-screen font-sans">
<!-- Navigation -->
<nav class="fixed top-0 w-full z-50 glass-morphism border-b border-white/10">
<div class="max-w-7xl mx-auto px-6 py-4">
<div class="flex justify-between items-center">
<a href="../" class="flex items-center space-x-2 hover:opacity-80 transition-opacity">
<div class="w-8 h-8 bg-gradient-to-r from-code-accent to-code-purple rounded-lg flex items-center justify-center">
<svg class="w-5 h-5 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"></path>
</svg>
</div>
<span class="text-xl font-semibold gradient-text">CodeUChain</span>
</a>
<div class="hidden md:flex space-x-8">
<a href="../" class="hover:text-code-accent transition-colors">Home</a>
<a href="#concepts" class="hover:text-code-accent transition-colors">Concepts</a>
<a href="#benefits" class="hover:text-code-accent transition-colors">Benefits</a>
<a href="#ai-ready" class="hover:text-code-accent transition-colors">AI-Ready</a>
<a href="#languages" class="hover:text-code-accent transition-colors">Languages</a>
<a href="https://github.com/codeuchain/codeuchain" class="hover:text-code-accent transition-colors">GitHub</a>
</div>
</div>
</div>
</nav>
<!-- Hero Section -->
<section class="pt-24 pb-16 px-6">
<div class="max-w-7xl mx-auto text-center">
<div class="inline-block glass-morphism px-4 py-2 rounded-full text-sm mb-8 animate-fade-in">
<span class="text-code-accent">v2.0.0</span> • Python Edition
</div>
<h1 class="text-6xl lg:text-8xl font-bold mb-6 animate-slide-up">
<span class="gradient-text">Python</span>
</h1>
<p class="text-xl lg:text-2xl text-gray-300 max-w-4xl mx-auto leading-relaxed mb-12 animate-slide-up animate-delay-2">
Beautiful async chains with type hints and runtime flexibility. The same elegant patterns, powered by Python's async ecosystem.
</p>
<div class="flex flex-col sm:flex-row gap-4 justify-center items-center animate-slide-up animate-delay-4">
<a href="#concepts" class="bg-gradient-to-r from-code-accent to-code-purple hover:from-code-purple hover:to-code-accent px-8 py-4 rounded-xl font-semibold text-white transition-all duration-300 hover-lift shadow-lg">
Understand the Concepts →
</a>
<a href="https://github.com/codeuchain/codeuchain/tree/main/packages/python" class="glass-morphism hover:bg-white/10 px-8 py-4 rounded-xl font-semibold transition-all duration-300">
View Source
</a>
</div>
</div>
</section>
<!-- Core Concepts -->
<section id="concepts" class="py-20 px-6">
<div class="max-w-7xl mx-auto">
<div class="text-center mb-16">
<h2 class="text-4xl lg:text-5xl font-bold mb-6 gradient-text">Core Concepts</h2>
<p class="text-xl text-gray-400 max-w-3xl mx-auto">
Four building blocks. Learn them once, use them in any language.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<!-- State -->
<div class="code-block rounded-2xl p-8 hover-lift animate-slide-up">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-code-accent/20 rounded-xl flex items-center justify-center mr-4">
<span class="text-2xl">📦</span>
</div>
<h3 class="text-2xl font-bold text-code-accent">State</h3>
</div>
<p class="text-gray-300 mb-4">Immutable key-value container that carries data through your pipeline.</p>
<div class="bg-black/50 rounded-lg p-4 font-mono text-sm border border-code-accent/20 mb-4">
<div class="text-code-green">ctx = State({ user_id: 101, role: "admin" })</div>
<div class="text-code-green">ctx.get("role") // "admin"</div>
<div class="text-code-green">ctx.set("status", "active") // returns new State</div>
</div>
<p class="text-sm text-gray-400">
Thread-safe. Each <code>.set()</code> returns a new State — no mutation, no surprises.
</p>
</div>
<!-- Link -->
<div class="code-block rounded-2xl p-8 hover-lift animate-slide-up animate-delay-1">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-code-green/20 rounded-xl flex items-center justify-center mr-4">
<span class="text-2xl">🔗</span>
</div>
<h3 class="text-2xl font-bold text-code-green">Link</h3>
</div>
<p class="text-gray-300 mb-4">A single unit of work. Takes State in, returns State out. One job, done well.</p>
<div class="bg-black/50 rounded-lg p-4 font-mono text-sm border border-code-green/20 mb-4">
<div class="text-code-green">Link("validate", ctx => {</div>
<div class="text-code-green"> if (!ctx.get("email").includes("@"))</div>
<div class="text-code-green"> throw Error("bad email");</div>
<div class="text-code-green"> return ctx;</div>
<div class="text-code-green">})</div>
</div>
<p class="text-sm text-gray-400">
Each Link lives in its own file. Easy to test, reuse, and reason about.
</p>
</div>
<!-- Chain -->
<div class="code-block rounded-2xl p-8 hover-lift animate-slide-up animate-delay-2">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-code-purple/20 rounded-xl flex items-center justify-center mr-4">
<span class="text-2xl">⛓️</span>
</div>
<h3 class="text-2xl font-bold text-code-purple">Chain</h3>
</div>
<p class="text-gray-300 mb-4">Composes Links into an ordered pipeline. Handles execution and error propagation.</p>
<div class="bg-black/50 rounded-lg p-4 font-mono text-sm border border-code-purple/20 mb-4">
<div class="text-code-green">chain = Chain()</div>
<div class="text-code-green"> .add(validateEmail)</div>
<div class="text-code-green"> .add(hashPassword)</div>
<div class="text-code-green"> .add(saveUser)</div>
<div class="text-code-green">result = chain.execute(state)</div>
</div>
<p class="text-sm text-gray-400">
If any Link throws, the Chain stops and the error is available on the result.
</p>
</div>
<!-- Hook -->
<div class="code-block rounded-2xl p-8 hover-lift animate-slide-up animate-delay-3">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-code-orange/20 rounded-xl flex items-center justify-center mr-4">
<span class="text-2xl">🪝</span>
</div>
<h3 class="text-2xl font-bold text-code-orange">Hook</h3>
</div>
<p class="text-gray-300 mb-4">Observes execution without modifying business logic. Runs alongside the Chain.</p>
<div class="bg-black/50 rounded-lg p-4 font-mono text-sm border border-code-orange/20 mb-4">
<div class="text-code-green">hook.before(ctx => log("starting"))</div>
<div class="text-code-green">hook.after(ctx => log("done"))</div>
<div class="text-code-green">hook.onError(err => alert(err))</div>
</div>
<p class="text-sm text-gray-400">
Logging, metrics, caching — without touching your Link code.
</p>
</div>
</div>
<!-- How it flows -->
<div class="code-block rounded-2xl p-8 mt-12 hover-lift animate-slide-up">
<div class="text-center">
<h3 class="text-2xl font-bold text-code-accent mb-6">How It Flows</h3>
<div class="bg-black/50 rounded-lg p-6 font-mono text-sm border border-code-accent/20 inline-block">
<div class="text-code-green text-lg">
State → Link 1 → Link 2 → Link 3 → Result
</div>
<div class="text-gray-500 mt-2">
↑ Hook observes each step ↑
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Developer Benefits -->
<section id="benefits" class="py-20 px-6 bg-gradient-to-r from-code-darker to-black">
<div class="max-w-7xl mx-auto">
<div class="text-center mb-16">
<h2 class="text-4xl lg:text-5xl font-bold mb-6 gradient-text">Developer Benefits</h2>
<p class="text-xl text-gray-400">Practical advantages you get from day one</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<!-- Testable -->
<div class="code-block rounded-2xl p-8 border-l-4 border-code-accent hover-lift animate-slide-up">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-code-accent/20 rounded-lg flex items-center justify-center mr-3">
<span class="text-xl">🧪</span>
</div>
<h3 class="text-xl font-bold text-code-accent">Testable by Default</h3>
</div>
<p class="text-gray-300 mb-4">
Each Link is a pure function: State in, State out. Mock nothing — just pass test data.
</p>
<div class="bg-black/50 rounded-lg p-3 font-mono text-xs border border-code-accent/20">
<div class="text-code-green">result = myLink.call(State({ input: "test" }))</div>
<div class="text-code-green">assert result.get("output") == expected</div>
</div>
</div>
<!-- Reusable -->
<div class="code-block rounded-2xl p-8 border-l-4 border-code-green hover-lift animate-slide-up animate-delay-1">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-code-green/20 rounded-lg flex items-center justify-center mr-3">
<span class="text-xl">🔄</span>
</div>
<h3 class="text-xl font-bold text-code-green">Reusable Components</h3>
</div>
<p class="text-gray-300 mb-4">
Write a Link once, drop it into any Chain. Build a library of battle-tested building blocks.
</p>
<div class="bg-black/50 rounded-lg p-3 font-mono text-xs border border-code-green/20">
<div class="text-code-green">orderChain.add(validateEmail) // reuse</div>
<div class="text-code-green">signupChain.add(validateEmail) // reuse</div>
</div>
</div>
<!-- Polyglot -->
<div class="code-block rounded-2xl p-8 border-l-4 border-code-purple hover-lift animate-slide-up animate-delay-2">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-code-purple/20 rounded-lg flex items-center justify-center mr-3">
<span class="text-xl">🌍</span>
</div>
<h3 class="text-xl font-bold text-code-purple">One Pattern, Every Language</h3>
</div>
<p class="text-gray-300 mb-4">
Same State → Link → Chain model in Python, Go, TypeScript, C#, Rust, Java, and C++.
</p>
<div class="bg-black/50 rounded-lg p-3 font-mono text-xs border border-code-purple/20">
<div class="text-code-green">// Learn once, apply everywhere</div>
<div class="text-code-green">chain.add(link).execute(state)</div>
</div>
</div>
<!-- Contained -->
<div class="code-block rounded-2xl p-8 border-l-4 border-code-orange hover-lift animate-slide-up animate-delay-3">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-code-orange/20 rounded-lg flex items-center justify-center mr-3">
<span class="text-xl">🛡️</span>
</div>
<h3 class="text-xl font-bold text-code-orange">Contained Impact</h3>
</div>
<p class="text-gray-300 mb-4">
Changes to one Link cannot break another. Errors stop the Chain without side effects.
</p>
<div class="bg-black/50 rounded-lg p-3 font-mono text-xs border border-code-orange/20">
<div class="text-code-green">// Link 2 fails? Links 3-5 never run.</div>
<div class="text-code-green">// State stays immutable throughout.</div>
</div>
</div>
<!-- Self-Documenting -->
<div class="code-block rounded-2xl p-8 border-l-4 border-code-accent hover-lift animate-slide-up animate-delay-4">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-code-accent/20 rounded-lg flex items-center justify-center mr-3">
<span class="text-xl">📖</span>
</div>
<h3 class="text-xl font-bold text-code-accent">Self-Documenting</h3>
</div>
<p class="text-gray-300 mb-4">
A Chain reads like a checklist. New developers understand the flow in seconds.
</p>
<div class="bg-black/50 rounded-lg p-3 font-mono text-xs border border-code-accent/20">
<div class="text-code-green">Chain: ValidateInput</div>
<div class="text-code-green"> → EnrichData → Save → Notify</div>
</div>
</div>
<!-- Typed -->
<div class="code-block rounded-2xl p-8 border-l-4 border-code-green hover-lift animate-slide-up animate-delay-5">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-code-green/20 rounded-lg flex items-center justify-center mr-3">
<span class="text-xl">⚡</span>
</div>
<h3 class="text-xl font-bold text-code-green">Opt-In Type Safety</h3>
</div>
<p class="text-gray-300 mb-4">
Start untyped for speed. Add generics when you need compile-time guarantees.
</p>
<div class="bg-black/50 rounded-lg p-3 font-mono text-xs border border-code-green/20">
<div class="text-code-green">Link[UserInput, UserOutput]</div>
<div class="text-code-green">State[T].insertAs<U>(k, v)</div>
</div>
</div>
</div>
</div>
</section>
<!-- AI-Ready Architecture -->
<section id="ai-ready" class="py-20 px-6">
<div class="max-w-7xl mx-auto">
<div class="text-center mb-16">
<div class="inline-block bg-gradient-to-r from-code-accent to-code-purple p-1 rounded-2xl mb-6">
<div class="bg-black/80 backdrop-blur-sm rounded-xl px-6 py-3">
<span class="text-2xl">🤖</span>
<span class="text-lg font-semibold gradient-text ml-2">Built for AI Agents</span>
</div>
</div>
<h2 class="text-4xl lg:text-5xl font-bold mb-6 gradient-text">AI-Ready Architecture</h2>
<p class="text-xl text-gray-400 max-w-3xl mx-auto">
The same structure that helps humans reason about code helps AI assistants generate, refactor, and extend it.
</p>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-12 items-center">
<div class="space-y-8">
<div class="code-block rounded-2xl p-8 border-l-4 border-code-accent">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-code-accent/20 rounded-lg flex items-center justify-center mr-3">
<span class="text-xl">🎯</span>
</div>
<h3 class="text-2xl font-bold text-code-accent">Predictable Patterns</h3>
</div>
<p class="text-gray-300 mb-4">
AI models thrive on consistent structure. Every Link follows the same contract, so generation is reliable.
</p>
<div class="bg-black/50 rounded-lg p-4 font-mono text-sm border border-code-accent/20">
<div class="text-code-green mb-2">// AI immediately understands the flow:</div>
<div class="text-gray-300">
ValidateInput → CheckCredentials → GenerateToken → LogSuccess
</div>
</div>
</div>
<div class="code-block rounded-2xl p-8 border-l-4 border-code-green">
<div class="flex items-center mb-4">
<div class="w-10 h-10 bg-code-green/20 rounded-lg flex items-center justify-center mr-3">
<span class="text-xl">🔄</span>
</div>
<h3 class="text-2xl font-bold text-code-green">Incremental Generation</h3>
</div>
<p class="text-gray-300">
AI builds step by step, just like a developer:
</p>
<div class="bg-black/50 rounded-lg p-4 font-mono text-sm border border-code-green/20 mt-4">
<div class="text-code-green">Step 1: Generate ValidateEmail link</div>
<div class="text-code-green">Step 2: Generate SaveToDatabase link</div>
<div class="text-code-green">Step 3: Compose into UserRegistration chain</div>
</div>
</div>
</div>
<div class="code-block rounded-2xl p-8 border-l-4 border-code-purple">
<div class="flex items-center mb-6">
<div class="w-10 h-10 bg-code-purple/20 rounded-lg flex items-center justify-center mr-3">
<span class="text-xl">📚</span>
</div>
<h3 class="text-2xl font-bold text-code-purple">Self-Documenting Structure</h3>
</div>
<div class="bg-black/50 rounded-lg p-6 font-mono text-sm border border-code-purple/20">
<div class="text-code-accent mb-3">// The Chain tells the whole story:</div>
<div class="text-gray-300">
const UserAuthChain = Chain<br>
.add(ValidateCredentials) <span class="text-code-green">// Check username/password</span><br>
.add(GenerateJWT) <span class="text-code-green">// Create auth token</span><br>
.add(LogAuthEvent) <span class="text-code-green">// Record the login</span><br>
.add(HandleAuthFailure) <span class="text-code-green">// Deal with failures</span>
</div>
</div>
<div class="mt-6 p-4 bg-code-purple/10 rounded-lg border border-code-purple/20">
<p class="text-gray-300 text-sm">
AI reads Chain composition the same way humans do: clear intent, clear order, clear error handling.
</p>
</div>
</div>
</div>
<!-- AI Benefits Summary -->
<div class="mt-16 text-center">
<div class="code-block rounded-2xl p-8 max-w-4xl mx-auto">
<h3 class="text-2xl font-bold mb-6 gradient-text">Why It Works</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 text-left">
<div class="text-center">
<div class="text-3xl mb-2">✅</div>
<p class="text-code-green font-semibold">Consistent patterns for reliable AI output</p>
</div>
<div class="text-center">
<div class="text-3xl mb-2">✅</div>
<p class="text-code-green font-semibold">Type contracts for safe AI collaboration</p>
</div>
<div class="text-center">
<div class="text-3xl mb-2">✅</div>
<p class="text-code-green font-semibold">Clear structure for AI-assisted refactoring</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Quick Start -->
<section id="quickstart" class="py-20 px-6 bg-gradient-to-r from-code-darker to-black">
<div class="max-w-7xl mx-auto">
<div class="text-center mb-16">
<h2 class="text-4xl lg:text-5xl font-bold mb-6 gradient-text">Quick Start</h2>
<p class="text-xl text-gray-400">Install and write your first chain in minutes</p>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-12">
<!-- Install -->
<div class="code-block rounded-2xl p-8">
<h3 class="text-xl font-bold text-code-accent mb-4">📦 Install</h3>
<div class="bg-black/60 rounded-xl p-4 font-mono text-sm border border-code-accent/20 mb-6">
<span class="text-code-green select-all">pip install codeuchain</span>
</div>
<h3 class="text-xl font-bold text-code-accent mb-4">🧠 Mental Model</h3>
<div class="space-y-3 text-sm">
<div class="flex items-center space-x-3">
<span class="w-16 text-code-accent font-mono font-bold shrink-0">State</span>
<span class="text-gray-300">The data box flowing through your pipeline</span>
</div>
<div class="flex items-center space-x-3">
<span class="w-16 text-code-green font-mono font-bold shrink-0">Link</span>
<span class="text-gray-300">One focused unit of work — receives State, returns State</span>
</div>
<div class="flex items-center space-x-3">
<span class="w-16 text-code-purple font-mono font-bold shrink-0">Chain</span>
<span class="text-gray-300">Ordered sequence of Links — runs them in order</span>
</div>
<div class="flex items-center space-x-3">
<span class="w-16 text-code-orange font-mono font-bold shrink-0">Hook</span>
<span class="text-gray-300">Parallel observer — logging, metrics, caching</span>
</div>
</div>
</div>
<!-- Code Example -->
<div class="code-block rounded-2xl p-8">
<h3 class="text-xl font-bold text-code-purple mb-4">⚡ Your First Chain</h3>
<div class="bg-black/60 rounded-xl p-4 font-mono text-xs border border-code-purple/20 overflow-x-auto">
<pre class="text-gray-200 whitespace-pre">from codeuchain import Chain, Link, State
def fetch_user(ctx):
ctx.set('user', {'id': ctx.get('user_id'), 'role': 'admin'})
return ctx
def check_permissions(ctx):
if ctx.get('user')['role'] != 'admin':
raise Exception('Unauthorized')
return ctx
workflow = Chain()\
.add_link(Link('fetch', fetch_user))\
.add_link(Link('auth', check_permissions))
result = workflow.execute(State({'user_id': 101}))
print(result.get('user'))</pre>
</div>
</div>
</div>
</div>
</section>
<!-- Language Navigation Component -->
<!-- Language Navigation Component -->
<section id="languages" class="py-16 bg-gradient-to-br from-code-darker to-code-dark">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="text-center mb-12">
<h2 class="text-3xl font-bold gradient-text mb-4">Explore Language Implementations</h2>
<p class="text-lg text-gray-300 max-w-3xl mx-auto">
CodeUChain is available in multiple programming languages, each with full feature parity and native idioms.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Pseudocode -->
<a href="../pseudo/" class="code-block rounded-2xl p-6 hover:shadow-xl transition-all duration-300 hover-lift border border-code-accent/20">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-3">
<span class="text-2xl">📝</span>
<h3 class="text-xl font-semibold text-gray-100">Pseudocode</h3>
</div>
</div>
<p class="text-gray-300 mb-4">Universal algorithmic representation for learning and planning.</p>
<div class="text-code-accent font-medium">View Documentation →</div>
</a>
<!-- Python -->
<a href="../python/" class="code-block rounded-2xl p-6 hover:shadow-xl transition-all duration-300 hover-lift border-2 border-code-accent">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-3">
<span class="text-2xl">🐍</span>
<h3 class="text-xl font-semibold text-code-accent">Python</h3>
</div>
<span class="px-3 py-1 bg-code-accent/20 text-code-accent text-sm font-medium rounded-full border border-code-accent/30">Current</span>
</div>
<p class="text-gray-300 mb-4">Simple, readable syntax with powerful async capabilities.</p>
<div class="text-code-accent font-medium">View Documentation →</div>
</a>
<!-- Go -->
<a href="../go/" class="code-block rounded-2xl p-6 hover:shadow-xl transition-all duration-300 hover-lift border border-code-accent/20">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-3">
<span class="text-2xl">🔵</span>
<h3 class="text-xl font-semibold text-gray-100">Go</h3>
</div>
</div>
<p class="text-gray-300 mb-4">Concurrent and efficient with excellent tooling.</p>
<div class="text-code-accent font-medium">View Documentation →</div>
</a>
<!-- JavaScript -->
<a href="../javascript/" class="code-block rounded-2xl p-6 hover:shadow-xl transition-all duration-300 hover-lift border border-code-accent/20">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-3">
<span class="text-2xl">🟨</span>
<h3 class="text-xl font-semibold text-gray-100">JavaScript</h3>
</div>
</div>
<p class="text-gray-300 mb-4">Universal runtime with modern async/await patterns.</p>
<div class="text-code-accent font-medium">View Documentation →</div>
</a>
<!-- C# -->
<a href="../csharp/" class="code-block rounded-2xl p-6 hover:shadow-xl transition-all duration-300 hover-lift border border-code-accent/20">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-3">
<span class="text-2xl">🟣</span>
<h3 class="text-xl font-semibold text-gray-100">C#</h3>
</div>
</div>
<p class="text-gray-300 mb-4">Object-oriented with LINQ and async support.</p>
<div class="text-code-accent font-medium">View Documentation →</div>
</a>
<!-- Rust -->
<a href="../rust/" class="code-block rounded-2xl p-6 hover:shadow-xl transition-all duration-300 hover-lift border border-code-accent/20">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-3">
<span class="text-2xl">🦀</span>
<h3 class="text-xl font-semibold text-gray-100">Rust</h3>
</div>
</div>
<p class="text-gray-300 mb-4">Memory-safe systems programming with zero-cost abstractions.</p>
<div class="text-code-accent font-medium">View Documentation →</div>
</a>
<!-- C++ -->
<a href="../cpp/" class="code-block rounded-2xl p-6 hover:shadow-xl transition-all duration-300 hover-lift border border-code-accent/20">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-3">
<span class="text-2xl">➕</span>
<h3 class="text-xl font-semibold text-gray-100">C++</h3>
</div>
</div>
<p class="text-gray-300 mb-4">High-performance systems with modern C++ features.</p>
<div class="text-code-accent font-medium">View Documentation →</div>
</a>
<!-- Java -->
<a href="../java/" class="code-block rounded-2xl p-6 hover:shadow-xl transition-all duration-300 hover-lift border border-code-accent/20">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-3">
<span class="text-2xl">☕</span>
<h3 class="text-xl font-semibold text-gray-100">Java</h3>
</div>
</div>
<p class="text-gray-300 mb-4">Enterprise-grade with comprehensive ecosystem.</p>
<div class="text-code-accent font-medium">View Documentation →</div>
</a>
<!-- COBOL -->
<a href="../cobol/" class="code-block rounded-2xl p-6 hover:shadow-xl transition-all duration-300 hover-lift border border-code-accent/20">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center space-x-3">
<span class="text-2xl">🏛️</span>
<h3 class="text-xl font-semibold text-gray-100">COBOL</h3>
</div>
</div>
<p class="text-gray-300 mb-4">Legacy system modernization with modern patterns.</p>
<div class="text-code-accent font-medium">View Documentation →</div>
</a>
</div>
<!-- Special Pseudocode Section -->
</div>
</section>
<!-- Footer -->
<footer class="bg-gradient-to-r from-code-darker to-black border-t border-code-accent/20 py-12 px-6">
<div class="max-w-7xl mx-auto">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<!-- Brand -->
<div class="md:col-span-2">
<div class="flex items-center space-x-3 mb-4">
<div class="w-12 h-12 bg-gradient-to-br from-code-accent to-code-purple rounded-xl flex items-center justify-center">
<span class="text-2xl">🔗</span>
</div>
<div>
<h3 class="text-xl font-bold gradient-text">CodeUChain</h3>
<p class="text-sm text-gray-400">Universal Chain Architecture</p>
</div>
</div>
<p class="text-gray-300 mb-6 max-w-md">
A beautiful, universal architecture for building scalable systems.
The same patterns, expressed in every language.
</p>
<div class="flex space-x-4">
<a href="https://github.com/codeuchain/codeuchain" class="text-gray-400 hover:text-code-accent transition-colors" title="View CodeUChain on GitHub">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
</svg>
</a>
<a href="https://orchestrate.solutions" class="text-gray-400 hover:text-code-accent transition-colors" title="Visit Orchestrate Solutions">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 0c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm-2.033 16.01c.564-1.789 1.632-3.932 1.821-4.474.273-.787-.211-1.136-1.74.209l-.34-.64c1.744-1.897 5.335-2.326 4.113.613-.763 1.835-1.309 3.074-1.621 4.03-.455 1.393.694.828 1.819-.211.153.25.203.331.356.619-2.498 2.378-5.271 2.588-4.408-.146zm4.742-8.169c-.532.542-1.563.366-2.146.369-.584.003-1.232.18-1.764-.35-.54-.546-.495-1.617.036-2.139.53-.52 1.52-.361 2.107-.374.587-.013 1.228-.152 1.764.35.535.501.49 1.571-.037 2.144z"/>
</svg>
</a>
</div>
</div>
<!-- Quick Links -->
<div>
<h4 class="text-lg font-semibold mb-4 text-code-accent">Quick Links</h4>
<ul class="space-y-2">
<li><a href="#hero" class="text-gray-400 hover:text-code-accent transition-colors">Home</a></li>
<li><a href="#concepts" class="text-gray-400 hover:text-code-accent transition-colors">Core Concepts</a></li>
<li><a href="#benefits" class="text-gray-400 hover:text-code-accent transition-colors">Benefits</a></li>
<li><a href="#ai-ready" class="text-gray-400 hover:text-code-accent transition-colors">AI-Ready</a></li>
<li><a href="#quickstart" class="text-gray-400 hover:text-code-accent transition-colors">Quick Start</a></li>
</ul>
</div>
<!-- Languages -->
<div>
<h4 class="text-lg font-semibold mb-4 text-code-accent">Languages</h4>
<ul class="space-y-2">
<li><a href="../pseudo/" class="text-gray-400 hover:text-code-accent transition-colors">📝 Pseudocode</a></li>
<li><a href="../python/" class="text-gray-400 hover:text-code-accent transition-colors">🐍 Python</a></li>
<li><a href="../go/" class="text-gray-400 hover:text-code-accent transition-colors">🔵 Go</a></li>
<li><a href="../javascript/" class="text-gray-400 hover:text-code-accent transition-colors">🟨 JavaScript</a></li>
<li><a href="../csharp/" class="text-gray-400 hover:text-code-accent transition-colors">🟣 C#</a></li>
<li><a href="../rust/" class="text-gray-400 hover:text-code-accent transition-colors">🦀 Rust</a></li>
<li><a href="../cpp/" class="text-gray-400 hover:text-code-accent transition-colors">➕ C++</a></li>
<li><a href="../java/" class="text-gray-400 hover:text-code-accent transition-colors">☕ Java</a></li>
<li><a href="../cobol/" class="text-gray-400 hover:text-code-accent transition-colors">🏛️ COBOL</a></li>
</ul>
</div>
</div>
<div class="border-t border-gray-800 mt-8 pt-8 text-center">
<p class="text-gray-400">
© 2025-2026 <a href="https://orchestrate.solutions" class="text-code-accent hover:text-code-purple transition-colors">Orchestrate LLC</a>.
Licensed under <a href="https://github.com/codeuchain/codeuchain/blob/main/LICENSE" class="text-code-accent hover:text-code-purple transition-colors">Apache 2.0</a>.
</p>
</div>
</div>
</footer>
<!-- Floating Navigation Component - Dynamic Pill Design -->
<div id="floatingNav" class="fixed bottom-6 inset-x-0 z-40 opacity-0 translate-y-4 mx-auto transition-all duration-300" style="width: fit-content;">
<!-- Collapsed State - Small Pill Indicator -->
<div id="navCollapsed" class="hidden glass-morphism rounded-full px-3 py-2 shadow-xl cursor-pointer hover:shadow-2xl transition-all duration-300 nav-glow">
<div class="flex items-center space-x-2">
<svg class="w-4 h-4 text-code-accent" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
</svg>
<span class="text-xs text-code-accent font-medium">NAV</span>
</div>
</div>
<!-- Expanded State - Full Pill Navigation -->
<div id="navExpanded" class="glass-morphism rounded-full px-4 py-3 shadow-2xl nav-glow">
<div class="flex items-center space-x-3">
<!-- Collapse Button -->
<button id="navToggle" class="w-8 h-8 glass-morphism hover:bg-white/10 border border-code-accent/30 hover:border-code-accent/50 rounded-full flex items-center justify-center text-code-accent transition-all duration-200 hover:scale-110 group relative">
<svg class="w-4 h-4 transition-transform group-hover:scale-110" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
<div class="absolute -top-8 left-1/2 transform -translate-x-1/2 glass-morphism text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none">
Collapse (Esc)
</div>
</button>
<!-- Navigation Buttons -->
<div class="flex items-center space-x-2">
<!-- Back to Top -->
<button id="backToTop" class="w-8 h-8 frosted-gradient hover:bg-gradient-to-br hover:from-code-accent hover:to-code-purple border border-code-accent/30 hover:border-code-accent/50 rounded-full flex items-center justify-center text-white transition-all duration-200 hover:scale-110 group relative">
<svg class="w-4 h-4 transition-transform group-hover:-translate-y-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 10l7-7m0 0l7 7m-7-7v18"></path>
</svg>
<div class="absolute -top-8 left-1/2 transform -translate-x-1/2 glass-morphism text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none">
Back to Top (↑)
</div>
</button>
<!-- Section Navigation -->
<button id="prevSection" class="w-7 h-7 glass-morphism hover:bg-code-accent/10 border border-code-accent/20 hover:border-code-accent/50 rounded-full flex items-center justify-center text-gray-400 hover:text-code-accent transition-all duration-200 hover:scale-105 relative group">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path>
</svg>
<div class="absolute -top-8 left-1/2 transform -translate-x-1/2 glass-morphism text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none">
Previous (←)
</div>
</button>
<button id="nextSection" class="w-7 h-7 glass-morphism hover:bg-code-accent/10 border border-code-accent/20 hover:border-code-accent/50 rounded-full flex items-center justify-center text-gray-400 hover:text-code-accent transition-all duration-200 hover:scale-105 relative group">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
</svg>
<div class="absolute -top-8 left-1/2 transform -translate-x-1/2 glass-morphism text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none">
Next (→)
</div>
</button>
</div>
<!-- Dynamic Quick Jump Buttons Container -->
<div id="jumpButtonsContainer" class="flex items-center space-x-1">
<!-- Buttons will be dynamically generated here -->
</div>
</div>
</div>
<!-- Onboarding Hint -->
<div id="navHint" class="absolute -left-48 top-0 glass-morphism rounded-lg p-3 shadow-xl opacity-0 transform translate-x-4 transition-all duration-300 pointer-events-none">
<div class="text-white text-sm">
<div class="font-semibold text-code-accent mb-1">🚀 Quick Navigation</div>
<div class="text-gray-300 text-xs space-y-1">
<div>• Use ↑↓←→ arrow keys</div>
<div>• Press section keys to jump</div>
<div>• Hover for tooltips</div>
</div>
</div>
<div class="absolute right-0 top-1/2 transform translate-x-1/2 -translate-y-1/2 w-0 h-0 border-l-8 border-l-black/90 border-t-4 border-t-transparent border-b-4 border-b-transparent"></div>
</div>
</div>
<style>
/* Floating Navigation Styles - Pill Design */
#floatingNav.show {
opacity: 1;
transform: translateY(0);
}
#floatingNav.hide {
opacity: 0;
transform: translateY(4px);
}
/* Collapsed state */
#navCollapsed {
min-width: 80px;
}
#navCollapsed:hover {
transform: scale(1.05);
}
/* Expanded state */
#navExpanded {
min-width: 320px;
}
/* Pulse animation for collapsed state */
#navCollapsed {
animation: gentle-pulse 3s ease-in-out infinite;
}
@keyframes gentle-pulse {
0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4); }
50% { box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.1); }
}
/* Active section highlighting */
.floating-nav-btn.active {
background: rgba(0, 212, 255, 0.2) !important;
border-color: rgba(0, 212, 255, 0.5) !important;
color: #00d4ff !important;
}
.frosted-gradient {
background: linear-gradient(135deg, rgba(0, 212, 255, 0.8) 0%, rgba(157, 78, 221, 0.8) 100%);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.nav-glow {
position: relative;
}
.nav-glow::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
background: linear-gradient(45deg,
rgba(0, 212, 255, 0.15),
rgba(157, 78, 221, 0.1),
rgba(0, 212, 255, 0.15)
);
background-size: 200% 200%;
border-radius: inherit;
z-index: -1;
opacity: 0.3;
filter: blur(4px);
animation: gentle-gradient-flow 12s ease-in-out infinite;
}
.nav-glow {
box-shadow:
0 0 15px rgba(0, 212, 255, 0.25),
0 4px 20px rgba(0, 0, 0, 0.15),
inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.nav-glow:hover::before {
opacity: 0.4;
filter: blur(5px);
animation-duration: 6s;
}
.nav-glow:hover {
box-shadow:
0 0 25px rgba(0, 212, 255, 0.4),
0 8px 30px rgba(0, 0, 0, 0.2),
inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
@keyframes gentle-gradient-flow {
0%, 100% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
}
/* Smooth transitions for state changes */
#navCollapsed, #navExpanded {
transition: all 0.3s ease-in-out;
}
</style>
<script>
// Dynamic Floating Navigation Functionality - Pill Design
document.addEventListener('DOMContentLoaded', function() {
const floatingNav = document.getElementById('floatingNav');
const navCollapsed = document.getElementById('navCollapsed');
const navExpanded = document.getElementById('navExpanded');
const navToggle = document.getElementById('navToggle');
const navHint = document.getElementById('navHint');
const backToTop = document.getElementById('backToTop');
const prevSection = document.getElementById('prevSection');
const nextSection = document.getElementById('nextSection');
const jumpButtonsContainer = document.getElementById('jumpButtonsContainer');
let isNavVisible = false;
let isNavExpanded = true; // Start expanded
let currentSectionIndex = 0;
let hasShownHint = localStorage.getItem('codeuchain-nav-hint-shown') === 'true';
let sections = [];
let jumpButtons = {};
let sectionKeyMap = {};
let inactivityTimer;
let wasManuallyExpanded = false; // Track if user manually expanded
// Section mapping for icons and keyboard shortcuts
const sectionConfig = {
'hero': { icon: '🏠', key: 'H', label: 'Hero' },
'concepts': { icon: '🎯', key: 'C', label: 'Concepts' },
'benefits': { icon: '⚡', key: 'B', label: 'Benefits' },
'ai-ready': { icon: '🤖', key: 'A', label: 'AI-Ready' },
'quickstart': { icon: '🚀', key: 'Q', label: 'Quick Start' },
'languages': { icon: '🌍', key: 'L', label: 'Languages' },
'overview': { icon: '📋', key: 'O', label: 'Overview' },
'installation': { icon: '📦', key: 'I', label: 'Install' },
'examples': { icon: '💡', key: 'E', label: 'Examples' },
'api': { icon: '🔧', key: 'P', label: 'API' },
'contributing': { icon: '🤝', key: 'T', label: 'Contribute' },
'head': { icon: '📋', key: 'R', label: 'Header' },
'footer': { icon: '📝', key: 'F', label: 'Footer' }
};
// Detect sections on the page
function detectSections() {
// First, get all section elements with IDs
const sectionElements = document.querySelectorAll('section[id]');
sections = Array.from(sectionElements).map(section => section.id); // Use global sections variable
// Also check for head and footer elements
if (document.head) {
sections.unshift('head'); // Add to beginning
}
if (document.querySelector('footer')) {
sections.push('footer'); // Add to end
}
// Filter out sections that don't have meaningful content or are too small
sections = sections.filter(sectionId => {
if (sectionId === 'head') {
return document.head; // Head always exists
}
if (sectionId === 'footer') {
const footer = document.querySelector('footer');
return footer && footer.offsetHeight > 50; // Footer needs to be visible
}
const element = document.getElementById(sectionId);
return element && element.offsetHeight > 100; // Regular sections need to be tall enough
});
console.log('Detected sections:', sections);
return sections;
}
// Generate dynamic jump buttons