ywana-core8 0.2.19 → 0.2.21
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.
- package/dist/index.css +2833 -714
- package/dist/index.js +433 -111
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +433 -111
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +433 -111
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/desktop/Desktop.stories.jsx +424 -11
- package/src/desktop/{ApplicationMenu.css → LaunchPad.css} +82 -107
- package/src/desktop/{ApplicationMenu.js → LaunchPad.js} +30 -30
- package/src/desktop/WindowContext.js +2 -0
- package/src/desktop/WindowManager.js +54 -0
- package/src/desktop/{desktop-linux.css → desktop-gnome.css} +64 -46
- package/src/desktop/desktop-macintosh.css +330 -0
- package/src/desktop/desktop-macos.css +60 -18
- package/src/desktop/desktop-msx.css +337 -0
- package/src/desktop/desktop-nextstep.css +315 -0
- package/src/desktop/desktop-windows.css +39 -21
- package/src/desktop/desktop-windows98.css +284 -0
- package/src/desktop/desktop-windowsxp.css +294 -0
- package/src/desktop/desktop.css +428 -1
- package/src/desktop/desktop.js +393 -69
- package/src/desktop/index.js +2 -2
- package/src/html/Menu.stories.jsx +504 -0
- package/src/html/menu.css +85 -6
- package/src/html/menu.js +40 -16
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
|
-
import { Desktop } from './desktop.js'
|
2
|
+
import { Desktop, useDesktopOverlays } from './desktop.js'
|
3
3
|
import {
|
4
4
|
useWindowDialogs,
|
5
5
|
useWindowNotifications,
|
@@ -501,6 +501,386 @@ const FileExplorerApp = () => {
|
|
501
501
|
)
|
502
502
|
}
|
503
503
|
|
504
|
+
/**
|
505
|
+
* Desktop Overlays Demo App - Demonstrates the new Desktop Overlay System
|
506
|
+
*/
|
507
|
+
const DesktopOverlaysApp = () => {
|
508
|
+
const { show, hide } = useDesktopOverlays()
|
509
|
+
|
510
|
+
const showCenteredModal = () => {
|
511
|
+
const id = show({
|
512
|
+
content: (
|
513
|
+
<div style={{
|
514
|
+
background: 'white',
|
515
|
+
borderRadius: '12px',
|
516
|
+
padding: '32px',
|
517
|
+
boxShadow: '0 20px 60px rgba(0,0,0,0.3)',
|
518
|
+
maxWidth: '500px'
|
519
|
+
}}>
|
520
|
+
<h2 style={{ margin: '0 0 16px 0', color: '#333' }}>🎯 Centered Modal</h2>
|
521
|
+
<p style={{ color: '#666', marginBottom: '24px' }}>
|
522
|
+
This is a centered modal using the Desktop Overlay System.
|
523
|
+
It has a backdrop and blur effect.
|
524
|
+
</p>
|
525
|
+
<button
|
526
|
+
onClick={() => hide(id)}
|
527
|
+
style={{
|
528
|
+
padding: '10px 20px',
|
529
|
+
background: '#1976d2',
|
530
|
+
color: 'white',
|
531
|
+
border: 'none',
|
532
|
+
borderRadius: '6px',
|
533
|
+
cursor: 'pointer',
|
534
|
+
fontSize: '14px'
|
535
|
+
}}
|
536
|
+
>
|
537
|
+
Close
|
538
|
+
</button>
|
539
|
+
</div>
|
540
|
+
),
|
541
|
+
position: 'center',
|
542
|
+
size: 'auto',
|
543
|
+
animation: 'scale',
|
544
|
+
backdrop: true,
|
545
|
+
backdropBlur: true,
|
546
|
+
zIndex: 9500
|
547
|
+
})
|
548
|
+
}
|
549
|
+
|
550
|
+
const showSlideUpNotification = () => {
|
551
|
+
const id = show({
|
552
|
+
content: (
|
553
|
+
<div style={{
|
554
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
555
|
+
color: 'white',
|
556
|
+
borderRadius: '12px',
|
557
|
+
padding: '20px 32px',
|
558
|
+
boxShadow: '0 10px 40px rgba(0,0,0,0.3)',
|
559
|
+
display: 'flex',
|
560
|
+
alignItems: 'center',
|
561
|
+
gap: '16px'
|
562
|
+
}}>
|
563
|
+
<span style={{ fontSize: '32px' }}>🎉</span>
|
564
|
+
<div>
|
565
|
+
<h3 style={{ margin: '0 0 4px 0' }}>Success!</h3>
|
566
|
+
<p style={{ margin: 0, opacity: 0.9 }}>This notification slides up from the bottom</p>
|
567
|
+
</div>
|
568
|
+
</div>
|
569
|
+
),
|
570
|
+
position: 'bottom',
|
571
|
+
size: 'auto',
|
572
|
+
animation: 'slide-up',
|
573
|
+
backdrop: false,
|
574
|
+
margin: '0 0 40px 0',
|
575
|
+
zIndex: 9600
|
576
|
+
})
|
577
|
+
|
578
|
+
setTimeout(() => hide(id, 'slide-down'), 3000)
|
579
|
+
}
|
580
|
+
|
581
|
+
const showSidePanel = () => {
|
582
|
+
const id = show({
|
583
|
+
content: (
|
584
|
+
<div style={{
|
585
|
+
background: 'white',
|
586
|
+
height: '100%',
|
587
|
+
width: '400px',
|
588
|
+
boxShadow: '-4px 0 20px rgba(0,0,0,0.2)',
|
589
|
+
padding: '24px',
|
590
|
+
overflowY: 'auto'
|
591
|
+
}}>
|
592
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '24px' }}>
|
593
|
+
<h2 style={{ margin: 0, color: '#333' }}>📋 Side Panel</h2>
|
594
|
+
<button
|
595
|
+
onClick={() => hide(id, 'slide-right')}
|
596
|
+
style={{
|
597
|
+
background: 'none',
|
598
|
+
border: 'none',
|
599
|
+
fontSize: '24px',
|
600
|
+
cursor: 'pointer',
|
601
|
+
padding: '4px'
|
602
|
+
}}
|
603
|
+
>
|
604
|
+
×
|
605
|
+
</button>
|
606
|
+
</div>
|
607
|
+
<p style={{ color: '#666', lineHeight: 1.6 }}>
|
608
|
+
This is a side panel that slides in from the right.
|
609
|
+
Perfect for settings, filters, or additional information.
|
610
|
+
</p>
|
611
|
+
<div style={{ marginTop: '24px' }}>
|
612
|
+
<h3 style={{ color: '#333', fontSize: '16px' }}>Features:</h3>
|
613
|
+
<ul style={{ color: '#666', lineHeight: 1.8 }}>
|
614
|
+
<li>Slides in from right</li>
|
615
|
+
<li>Full height</li>
|
616
|
+
<li>Scrollable content</li>
|
617
|
+
<li>Custom exit animation</li>
|
618
|
+
</ul>
|
619
|
+
</div>
|
620
|
+
</div>
|
621
|
+
),
|
622
|
+
position: 'right',
|
623
|
+
size: 'custom',
|
624
|
+
customSize: { width: '400px', height: '100%' },
|
625
|
+
animation: 'slide-left',
|
626
|
+
backdrop: true,
|
627
|
+
backdropBlur: true,
|
628
|
+
closeOnBackdrop: true,
|
629
|
+
zIndex: 9500
|
630
|
+
})
|
631
|
+
}
|
632
|
+
|
633
|
+
const showCustomPositioned = () => {
|
634
|
+
const id = show({
|
635
|
+
content: (
|
636
|
+
<div style={{
|
637
|
+
background: '#fff3cd',
|
638
|
+
border: '2px solid #ffc107',
|
639
|
+
borderRadius: '8px',
|
640
|
+
padding: '16px 20px',
|
641
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
|
642
|
+
maxWidth: '300px'
|
643
|
+
}}>
|
644
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
|
645
|
+
<span style={{ fontSize: '24px' }}>⚠️</span>
|
646
|
+
<div>
|
647
|
+
<h4 style={{ margin: '0 0 4px 0', color: '#856404' }}>Custom Position</h4>
|
648
|
+
<p style={{ margin: 0, color: '#856404', fontSize: '14px' }}>
|
649
|
+
This overlay is positioned at custom coordinates
|
650
|
+
</p>
|
651
|
+
</div>
|
652
|
+
</div>
|
653
|
+
</div>
|
654
|
+
),
|
655
|
+
position: 'custom',
|
656
|
+
customPosition: { top: '100px', right: '100px' },
|
657
|
+
size: 'auto',
|
658
|
+
animation: 'fade',
|
659
|
+
backdrop: false,
|
660
|
+
zIndex: 9700
|
661
|
+
})
|
662
|
+
|
663
|
+
setTimeout(() => hide(id), 4000)
|
664
|
+
}
|
665
|
+
|
666
|
+
const showLargeContent = () => {
|
667
|
+
const id = show({
|
668
|
+
content: (
|
669
|
+
<div style={{
|
670
|
+
background: 'white',
|
671
|
+
borderRadius: '16px',
|
672
|
+
padding: '32px',
|
673
|
+
boxShadow: '0 20px 60px rgba(0,0,0,0.3)',
|
674
|
+
width: '100%',
|
675
|
+
height: '100%',
|
676
|
+
overflowY: 'auto'
|
677
|
+
}}>
|
678
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '24px' }}>
|
679
|
+
<h2 style={{ margin: 0, color: '#333' }}>📄 Large Content Modal</h2>
|
680
|
+
<button
|
681
|
+
onClick={() => hide(id)}
|
682
|
+
style={{
|
683
|
+
background: 'none',
|
684
|
+
border: 'none',
|
685
|
+
fontSize: '32px',
|
686
|
+
cursor: 'pointer',
|
687
|
+
padding: '4px',
|
688
|
+
color: '#666'
|
689
|
+
}}
|
690
|
+
>
|
691
|
+
×
|
692
|
+
</button>
|
693
|
+
</div>
|
694
|
+
<div style={{ color: '#666', lineHeight: 1.8 }}>
|
695
|
+
<p>This is a large modal that takes up 80% of the screen.</p>
|
696
|
+
<h3>All Available Animations:</h3>
|
697
|
+
<ul>
|
698
|
+
<li><strong>fade</strong> - Simple fade in/out</li>
|
699
|
+
<li><strong>slide-up</strong> - Slides from bottom</li>
|
700
|
+
<li><strong>slide-down</strong> - Slides from top</li>
|
701
|
+
<li><strong>slide-left</strong> - Slides from right</li>
|
702
|
+
<li><strong>slide-right</strong> - Slides from left</li>
|
703
|
+
<li><strong>scale</strong> - Scales from center</li>
|
704
|
+
<li><strong>none</strong> - No animation</li>
|
705
|
+
</ul>
|
706
|
+
<h3>All Available Positions:</h3>
|
707
|
+
<ul>
|
708
|
+
<li><strong>center</strong> - Centered (default)</li>
|
709
|
+
<li><strong>top</strong> - Top center</li>
|
710
|
+
<li><strong>bottom</strong> - Bottom center</li>
|
711
|
+
<li><strong>left</strong> - Left center</li>
|
712
|
+
<li><strong>right</strong> - Right center</li>
|
713
|
+
<li><strong>top-left</strong> - Top left corner</li>
|
714
|
+
<li><strong>top-right</strong> - Top right corner</li>
|
715
|
+
<li><strong>bottom-left</strong> - Bottom left corner</li>
|
716
|
+
<li><strong>bottom-right</strong> - Bottom right corner</li>
|
717
|
+
<li><strong>custom</strong> - Custom coordinates</li>
|
718
|
+
</ul>
|
719
|
+
<h3>All Available Sizes:</h3>
|
720
|
+
<ul>
|
721
|
+
<li><strong>auto</strong> - Content size (default)</li>
|
722
|
+
<li><strong>small</strong> - 40% of screen</li>
|
723
|
+
<li><strong>medium</strong> - 60% of screen</li>
|
724
|
+
<li><strong>large</strong> - 80% of screen</li>
|
725
|
+
<li><strong>full</strong> - 100% of screen</li>
|
726
|
+
<li><strong>custom</strong> - Custom dimensions</li>
|
727
|
+
</ul>
|
728
|
+
</div>
|
729
|
+
</div>
|
730
|
+
),
|
731
|
+
position: 'center',
|
732
|
+
size: 'large',
|
733
|
+
animation: 'scale',
|
734
|
+
backdrop: true,
|
735
|
+
backdropBlur: true,
|
736
|
+
zIndex: 9500
|
737
|
+
})
|
738
|
+
}
|
739
|
+
|
740
|
+
return (
|
741
|
+
<div style={{ padding: '20px', height: '100%', overflowY: 'auto' }}>
|
742
|
+
<h2 style={{ marginTop: 0 }}>🎭 Desktop Overlay System Demo</h2>
|
743
|
+
<p style={{ color: '#666', marginBottom: '24px' }}>
|
744
|
+
Test the new Desktop Overlay System with different animations, positions, and sizes.
|
745
|
+
</p>
|
746
|
+
|
747
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: '16px' }}>
|
748
|
+
<button
|
749
|
+
onClick={showCenteredModal}
|
750
|
+
style={{
|
751
|
+
padding: '16px',
|
752
|
+
background: '#1976d2',
|
753
|
+
color: 'white',
|
754
|
+
border: 'none',
|
755
|
+
borderRadius: '8px',
|
756
|
+
cursor: 'pointer',
|
757
|
+
fontSize: '14px',
|
758
|
+
fontWeight: '500'
|
759
|
+
}}
|
760
|
+
>
|
761
|
+
🎯 Centered Modal<br/>
|
762
|
+
<small style={{ opacity: 0.8 }}>scale animation</small>
|
763
|
+
</button>
|
764
|
+
|
765
|
+
<button
|
766
|
+
onClick={showSlideUpNotification}
|
767
|
+
style={{
|
768
|
+
padding: '16px',
|
769
|
+
background: '#4caf50',
|
770
|
+
color: 'white',
|
771
|
+
border: 'none',
|
772
|
+
borderRadius: '8px',
|
773
|
+
cursor: 'pointer',
|
774
|
+
fontSize: '14px',
|
775
|
+
fontWeight: '500'
|
776
|
+
}}
|
777
|
+
>
|
778
|
+
🎉 Notification<br/>
|
779
|
+
<small style={{ opacity: 0.8 }}>slide-up animation</small>
|
780
|
+
</button>
|
781
|
+
|
782
|
+
<button
|
783
|
+
onClick={showSidePanel}
|
784
|
+
style={{
|
785
|
+
padding: '16px',
|
786
|
+
background: '#ff9800',
|
787
|
+
color: 'white',
|
788
|
+
border: 'none',
|
789
|
+
borderRadius: '8px',
|
790
|
+
cursor: 'pointer',
|
791
|
+
fontSize: '14px',
|
792
|
+
fontWeight: '500'
|
793
|
+
}}
|
794
|
+
>
|
795
|
+
📋 Side Panel<br/>
|
796
|
+
<small style={{ opacity: 0.8 }}>slide-left animation</small>
|
797
|
+
</button>
|
798
|
+
|
799
|
+
<button
|
800
|
+
onClick={showCustomPositioned}
|
801
|
+
style={{
|
802
|
+
padding: '16px',
|
803
|
+
background: '#9c27b0',
|
804
|
+
color: 'white',
|
805
|
+
border: 'none',
|
806
|
+
borderRadius: '8px',
|
807
|
+
cursor: 'pointer',
|
808
|
+
fontSize: '14px',
|
809
|
+
fontWeight: '500'
|
810
|
+
}}
|
811
|
+
>
|
812
|
+
⚠️ Custom Position<br/>
|
813
|
+
<small style={{ opacity: 0.8 }}>fade animation</small>
|
814
|
+
</button>
|
815
|
+
|
816
|
+
<button
|
817
|
+
onClick={showLargeContent}
|
818
|
+
style={{
|
819
|
+
padding: '16px',
|
820
|
+
background: '#f44336',
|
821
|
+
color: 'white',
|
822
|
+
border: 'none',
|
823
|
+
borderRadius: '8px',
|
824
|
+
cursor: 'pointer',
|
825
|
+
fontSize: '14px',
|
826
|
+
fontWeight: '500'
|
827
|
+
}}
|
828
|
+
>
|
829
|
+
📄 Large Modal<br/>
|
830
|
+
<small style={{ opacity: 0.8 }}>80% screen size</small>
|
831
|
+
</button>
|
832
|
+
</div>
|
833
|
+
|
834
|
+
<div style={{
|
835
|
+
marginTop: '32px',
|
836
|
+
padding: '20px',
|
837
|
+
background: '#f5f5f5',
|
838
|
+
borderRadius: '8px',
|
839
|
+
border: '1px solid #e0e0e0'
|
840
|
+
}}>
|
841
|
+
<h3 style={{ marginTop: 0 }}>📚 API Reference</h3>
|
842
|
+
<pre style={{
|
843
|
+
background: '#fff',
|
844
|
+
padding: '16px',
|
845
|
+
borderRadius: '6px',
|
846
|
+
overflow: 'auto',
|
847
|
+
fontSize: '12px',
|
848
|
+
lineHeight: 1.6
|
849
|
+
}}>
|
850
|
+
{`const { show, hide, hideAll, update } = useDesktopOverlays()
|
851
|
+
|
852
|
+
// Show overlay
|
853
|
+
const id = show({
|
854
|
+
content: <YourComponent />,
|
855
|
+
position: 'center', // or top, bottom, left, right, etc.
|
856
|
+
size: 'medium', // or auto, small, large, full, custom
|
857
|
+
animation: 'scale', // or fade, slide-up, slide-down, etc.
|
858
|
+
backdrop: true,
|
859
|
+
backdropBlur: true,
|
860
|
+
closeOnBackdrop: true,
|
861
|
+
closeOnEscape: true,
|
862
|
+
zIndex: 9500,
|
863
|
+
animationDuration: 300,
|
864
|
+
customPosition: { top: '100px', left: '50px' },
|
865
|
+
customSize: { width: '400px', height: '300px' },
|
866
|
+
padding: '20px',
|
867
|
+
margin: '10px'
|
868
|
+
})
|
869
|
+
|
870
|
+
// Hide overlay
|
871
|
+
hide(id, 'slide-down') // optional exit animation
|
872
|
+
|
873
|
+
// Hide all overlays
|
874
|
+
hideAll()
|
875
|
+
|
876
|
+
// Update overlay
|
877
|
+
update(id, { zIndex: 9600 })`}
|
878
|
+
</pre>
|
879
|
+
</div>
|
880
|
+
</div>
|
881
|
+
)
|
882
|
+
}
|
883
|
+
|
504
884
|
// Complete desktop configuration
|
505
885
|
const desktopConfig = {
|
506
886
|
categories: [
|
@@ -584,6 +964,15 @@ const desktopConfig = {
|
|
584
964
|
category: 'Media',
|
585
965
|
content: null,
|
586
966
|
size: { width: 400, height: 300 }
|
967
|
+
},
|
968
|
+
{
|
969
|
+
id: 'desktop-overlays-demo',
|
970
|
+
name: 'Desktop Overlays',
|
971
|
+
description: 'Demo of Desktop Overlay System - NEW FEATURE!',
|
972
|
+
icon: '🎭',
|
973
|
+
category: 'Development',
|
974
|
+
component: <DesktopOverlaysApp />,
|
975
|
+
size: { width: 700, height: 600 }
|
587
976
|
}
|
588
977
|
]
|
589
978
|
}
|
@@ -628,15 +1017,36 @@ const ThemeSelector = ({ currentTheme, onThemeChange }) => (
|
|
628
1017
|
* Complete Desktop Demo - All Features
|
629
1018
|
*/
|
630
1019
|
export const CompleteDesktop = () => {
|
631
|
-
const [
|
1020
|
+
const [desktopSize, setDesktopSize] = useState({ width: 1200, height: 600 })
|
632
1021
|
|
633
|
-
|
634
|
-
|
635
|
-
|
1022
|
+
// Update desktop size when window resizes
|
1023
|
+
React.useEffect(() => {
|
1024
|
+
const updateSize = () => {
|
1025
|
+
setDesktopSize({
|
1026
|
+
width: window.innerWidth,
|
1027
|
+
height: window.innerHeight - 60 // Leave space for Ladle controls
|
1028
|
+
})
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
// Set initial size
|
1032
|
+
updateSize()
|
636
1033
|
|
1034
|
+
// Listen for resize events
|
1035
|
+
window.addEventListener('resize', updateSize)
|
1036
|
+
return () => window.removeEventListener('resize', updateSize)
|
1037
|
+
}, [])
|
1038
|
+
|
1039
|
+
return (
|
1040
|
+
<div style={{
|
1041
|
+
height: 'calc(100vh - 60px)',
|
1042
|
+
width: '100vw',
|
1043
|
+
position: 'fixed',
|
1044
|
+
top: 0,
|
1045
|
+
left: 0,
|
1046
|
+
overflow: 'hidden'
|
1047
|
+
}}>
|
637
1048
|
<Desktop
|
638
|
-
|
639
|
-
desktopSize={{ width: 1200, height: 600 }}
|
1049
|
+
desktopSize={desktopSize}
|
640
1050
|
desktopConfig={desktopConfig}
|
641
1051
|
>
|
642
1052
|
<div style={{
|
@@ -661,8 +1071,8 @@ export const CompleteDesktop = () => {
|
|
661
1071
|
<li><strong>Start Menu:</strong> Click "Start" button</li>
|
662
1072
|
<li><strong>Applications:</strong> Browse categories and launch apps</li>
|
663
1073
|
<li><strong>Window Management:</strong> Create, move, resize windows</li>
|
664
|
-
<li><strong>
|
665
|
-
<li><strong>
|
1074
|
+
<li><strong>Window Layouts:</strong> Click window icon in taskbar for layout options</li>
|
1075
|
+
<li><strong>Theme Selector:</strong> Click palette icon in taskbar to switch themes</li>
|
666
1076
|
<li><strong>Responsive:</strong> Windows stay within workspace bounds</li>
|
667
1077
|
</ul>
|
668
1078
|
|
@@ -674,8 +1084,11 @@ export const CompleteDesktop = () => {
|
|
674
1084
|
<li><strong>Contained Elements:</strong> All floating elements stay within window boundaries</li>
|
675
1085
|
</ul>
|
676
1086
|
|
677
|
-
<h4
|
678
|
-
<
|
1087
|
+
<h4>Taskbar Controls:</h4>
|
1088
|
+
<ul>
|
1089
|
+
<li><strong>Window icon:</strong> Arrange windows (Cascade, Tile, Columns, Rows, etc.)</li>
|
1090
|
+
<li><strong>Palette icon:</strong> Switch desktop themes (Windows, macOS, Linux)</li>
|
1091
|
+
</ul>
|
679
1092
|
</div>
|
680
1093
|
</div>
|
681
1094
|
</Desktop>
|