11<!DOCTYPE html>
22< html lang ="en ">
3-
4- < head >
5- < meta charset ="UTF-8 ">
6- < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7- < title > Regular Layout</ title >
8- < style >
9- regular-layout {
10- overflow : hidden;
11- position : absolute;
12- top : 36px ;
13- left : 0 ;
14- right : 0 ;
15- bottom : 0 ;
16- }
17-
18- regular-layout-frame {
19- position : relative;
20- box-sizing : border-box;
21- margin : 3px ;
22- border-radius : 0 0 6px 6px ;
23- border : 1px solid # 666 ;
24- box-shadow : 0px 6px 6px -4px rgba (150 , 150 , 180 );
25- }
26-
27- regular-layout-frame [slot = AAA ] {
28- background-color : # ffb3b0 ;
29- }
30-
31- regular-layout-frame [slot = BBB ] {
32- background-color : # b0e0a3 ;
33- }
34-
35- regular-layout-frame [slot = CCC ] {
36- background-color : # 99c9ff ;
37- }
38-
39- regular-layout-frame [slot = DDD ] {
40- background-color : # ffe699 ;
41- }
42-
43- regular-layout-frame [slot = EEE ] {
44- background-color : # ffcf99 ;
45- }
46-
47- regular-layout-frame [slot = FFF ] {
48- background-color : # ff99fd ;
49- }
50-
51- regular-layout-frame : not ([slot ]) {
52- background-color : rgba (0 , 0 , 0 , 0.2 );
53- border : 1px dashed rgb (0 , 0 , 0 );
54- border-radius : 6px ;
55- margin : 0 ;
56- box-shadow : none;
57- transition :
58- top 0.1s ease-in-out,
59- height 0.1s ease-in-out,
60- width 0.1s ease-in-out,
61- left 0.1s ease-in-out;
62- }
63-
64- regular-layout-frame ::part (container ) {
65- display : none;
66- }
67-
68- regular-layout-frame [slot ]::part (container ) {
69- display : revert;
70- }
71-
72-
73- regular-layout-frame {
74- --titlebar-height : 24px ;
75- }
76-
77- regular-layout-frame ::part (titlebar ) {
78- display : flex;
79- align-items : center;
80- padding : 0 12px ;
81- cursor : pointer;
82- background-color : inherit;
83- border : 1px solid # 666 ;
84- border-radius : 6px 6px 0 0 ;
85- margin-left : -1px ;
86- margin-right : -1px ;
87- margin-bottom : 0px ;
88- max-width : 200px ;
89- }
90- </ style >
91- </ head >
92-
93- < body >
94- < header >
95- < button id ="add "> Add Panel</ button >
96- </ header >
97- < regular-layout >
98- < regular-layout-frame slot ="AAA "> </ regular-layout-frame >
99- < regular-layout-frame slot ="BBB "> </ regular-layout-frame >
100- < regular-layout-frame slot ="CCC "> </ regular-layout-frame >
101- < regular-layout-frame slot ="DDD "> </ regular-layout-frame >
102- < regular-layout-frame slot ="EEE "> </ regular-layout-frame >
103- < regular-layout-frame slot ="FFF "> </ regular-layout-frame >
104- </ regular-layout >
105- </ body >
106-
107- < script type ="module ">
108- import "/dist/index.js" ;
109-
110- const add = document . querySelector ( "#add" )
111- add . addEventListener ( "click" , ( ) => {
112- const chars = 'abcdefghijklmnopqrstuvwxyz' ;
113- let name = '' ;
114- for ( let i = 0 ; i < 8 ; i ++ ) {
115- name += chars . charAt ( Math . floor ( Math . random ( ) * chars . length ) ) ;
116- }
117-
118- const elem = document . createElement ( "regular-layout-frame" ) ;
119- elem . setAttribute ( "slot" , name ) ;
120- layout . appendChild ( elem ) ;
121- layout . insertPanel ( name , [ ] ) ;
122- } )
123-
124- const layout = document . querySelector ( "regular-layout" ) ;
125- fetch ( "./layout.json" ) . then ( req => req . json ( ) ) . then ( x => layout . restore ( x ) ) ;
126- </ script >
127-
128- </ html >
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Regular Layout</ title >
7+ < link rel ="stylesheet " href ="./index.css ">
8+ < script type ="module " src ="./index.js "> </ script >
9+ </ head >
10+ < body >
11+ < header >
12+ < button id ="add "> Add Panel</ button >
13+ < button id ="save "> Save State</ button >
14+ < button id ="restore "> Restore State</ button >
15+ < button id ="clear "> Clear</ button >
16+ </ header >
17+ < regular-layout >
18+ < regular-layout-frame slot ="AAA "> </ regular-layout-frame >
19+ < regular-layout-frame slot ="BBB "> </ regular-layout-frame >
20+ < regular-layout-frame slot ="CCC "> </ regular-layout-frame >
21+ < regular-layout-frame slot ="DDD "> </ regular-layout-frame >
22+ < regular-layout-frame slot ="EEE "> </ regular-layout-frame >
23+ < regular-layout-frame slot ="FFF "> </ regular-layout-frame >
24+ < regular-layout-frame slot ="GGG "> </ regular-layout-frame >
25+ < regular-layout-frame slot ="HHH "> </ regular-layout-frame >
26+ </ regular-layout >
27+ </ body >
28+ </ html >
0 commit comments