@@ -8,14 +8,70 @@ export default styleSheet
88
99styleSheet . replaceSync ( `
1010 :host {
11- --overlay-color: #88888880;
12- --sheet-background-color: #fff;
13- --sheet-thumb-color: #eee;
14- --sheet-transition-duration: 0.5s;
15- --sheet-border-radius: 1rem;
16- --sheet-header-padding: 0 0 0 1rem;
17- --sheet-body-padding: 1rem;
11+ --_sheet-foreground-color: var(--sheet-foreground-color, inherit);
12+ --_sheet-background-color: var(--sheet-background-color, #fff);
1813
14+ --_sheet-border-radius: var(--sheet-border-radius, 1rem);
15+
16+ --_sheet-min-width: var(--sheet-min-width, 18rem);
17+ --_sheet-width: var(--sheet-width, 90vw);
18+ --_sheet-max-width: var(--sheet-max-width, auto);
19+
20+ --_sheet-min-height: var(--sheet-min-height, 30vh);
21+ --_sheet-height: var(--sheet-height, auto);
22+ --_sheet-max-height: var(--sheet-max-height, 100vh);
23+
24+ --_sheet-scale-down-to: 0.5;
25+ --_sheet-z-index: var(--sheet-z-index, 1);
26+ --_sheet-transition-duration: var(--sheet-transition-duration, 0.5s);
27+
28+ --_sheet-backdrop-color: var(--sheet-backdrop-color, #88888880);
29+
30+ --_sheet-header-padding: var(--sheet-header-padding, 0 0 0 1rem);
31+ --_sheet-body-padding: var(--sheet-body-padding, 1rem);
32+
33+ --_sheet-handle-width: var(--sheet-handle-width, 3rem);
34+ --_sheet-handle-height: var(--sheet-handle-height, 0.25rem);
35+ --_sheet-handle-color: var(--sheet-handle-color, #eee);
36+ --_sheet-handle-border-radius: var(--sheet-handle-border-radius, 0.125rem);
37+ --_sheet-handle-container-padding: var(--sheet-handle-container-padding, 1rem);
38+ }
39+
40+ @media (prefers-color-scheme: dark) {
41+ :host {
42+ --_sheet-background-color: var(--sheet-background-color, black);
43+ --_sheet-foreground-color: var(--sheet-foreground-color, white);
44+ --_sheet-handle-color: var(--sheet-handle-color, #333333);
45+ }
46+ }
47+
48+ @media (prefers-reduced-motion: reduce) {
49+ :host {
50+ --_sheet-transition-duration: var(--sheet-transition-duration, 0.1s);
51+ }
52+ }
53+
54+ /* tablet */
55+ @media (min-width: 48rem) {
56+ :host {
57+ --_sheet-width: var(--sheet-width, auto);
58+ --_sheet-max-width: 48rem;
59+ --_sheet-max-height: 32rem;
60+
61+ border-radius: var(--_sheet-border-radius);
62+ justify-content: center;
63+ }
64+
65+ .sheet-handle-container {
66+ display: none;
67+ }
68+
69+ .sheet-controls {
70+ grid-template-columns: 1fr auto auto;
71+ }
72+ }
73+
74+ :host {
1975 display: flex;
2076 flex-direction: column;
2177 align-items: center;
@@ -26,11 +82,11 @@ styleSheet.replaceSync(`
2682 left: 0;
2783 right: 0;
2884 bottom: 0;
29- z-index: 2 ;
85+ z-index: var(--_sheet-z-index) ;
3086
3187 transition:
32- opacity var(--sheet -transition-duration),
33- visibility var(--sheet -transition-duration);
88+ opacity var(--_sheet -transition-duration),
89+ visibility var(--_sheet -transition-duration);
3490 }
3591
3692 :host(:not([open])) {
@@ -39,59 +95,45 @@ styleSheet.replaceSync(`
3995 pointer-events: none;
4096 }
4197
42- @media (prefers-color-scheme: dark) {
43- :host {
44- --sheet-background-color: black;
45- --sheet-foreground-color: white;
46- --sheet-thumb-color: #333333;
47- }
48- }
49-
50- @media (prefers-reduced-motion: reduce) {
51- :host {
52- --sheet-transition-duration: 0.1s;
53- }
54- }
55-
5698 /* ::backdrop is not supported :( */
5799 .sheet-backdrop {
58100 position: absolute;
59101 top: 0;
60102 left: 0;
61103 right: 0;
62104 bottom: 0;
63- background-color: var(--overlay -color);
105+ background-color: var(--_sheet-backdrop -color);
64106 }
65107
66108 .sheet-contents {
67109 display: flex;
68110 flex-direction: column;
69111
70- border-radius: var(--sheet -border-radius) var(--sheet -border-radius) 0 0;
112+ border-radius: var(--_sheet -border-radius) var(--_sheet -border-radius) 0 0;
71113
72- background: var(--sheet -background-color);
114+ background: var(--_sheet -background-color);
73115
74116 overflow-y: hidden;
75117
76118 transform: translateY(0) scale(1);
77119
78- min-width: 18rem;
79- width: 90vw;
120+ min-width: var(--_sheet-min-width);
121+ width: var(--_sheet-width);
122+ max-width: var(--_sheet-max-width);
80123
81- min-height: 30vh;
82- max-height: 100vh;
124+ min-height: var(--_sheet-min-height);
125+ height: var(--_sheet-height);
126+ max-height: var(--_sheet-max-height);
83127
84128 box-sizing: border-box;
85129
86- --scale-down-to: 0.5;
87-
88130 transition:
89- transform var(--sheet -transition-duration),
90- border-radius var(--sheet -transition-duration);
131+ transform var(--_sheet -transition-duration),
132+ border-radius var(--_sheet -transition-duration);
91133 }
92134
93135 :host(:not([open])) .sheet-contents {
94- transform: translateY(100%) scale(var(--scale-down-to));
136+ transform: translateY(100%) scale(var(--_sheet- scale-down-to));
95137 }
96138
97139 .sheet-contents.is-resized {
@@ -102,26 +144,34 @@ styleSheet.replaceSync(`
102144 display: grid;
103145 grid-template-columns: 1fr auto 1fr;
104146 align-items: stretch;
105- padding: var(--sheet -header-padding);
147+ padding: var(--_sheet -header-padding);
106148 }
107149
108150 .sheet-title-area {
109151 display: flex;
110152 justify-content: flex-start;
111153 }
112154
113- .sheet-draggable-area {
114- width: 3rem;
155+ .sheet-handle-container {
156+ display: flex;
157+ flex-direction: column;
158+ justify-content: center;
159+
160+ min-height: var(--_sheet-handle-height);
161+ height: 100%;
162+
163+ padding: var(--_sheet-handle-container-padding);
164+ box-sizing: border-box;
165+
115166 margin: auto;
116- padding: 1rem;
117167 cursor: grab;
118168 }
119169
120- .sheet-draggable-thumb {
121- width:inherit ;
122- height: 0.25rem ;
123- background: var(--sheet-thumb -color);
124- border-radius: 0.125rem ;
170+ .sheet-handle {
171+ width: var(--_sheet-handle-width) ;
172+ height: var(--_sheet-handle-height) ;
173+ background: var(--_sheet-handle -color);
174+ border-radius: var(--_sheet-handle-border-radius) ;
125175 }
126176
127177 .sheet-button-area {
@@ -147,29 +197,7 @@ styleSheet.replaceSync(`
147197
148198 overflow-y: auto;
149199
150- padding: var(--sheet -body-padding);
200+ padding: var(--_sheet -body-padding);
151201 box-sizing: border-box;
152202 }
153-
154- /* tablet */
155- @media (min-width: 48rem) {
156- :host {
157- justify-content: center;
158- }
159-
160- .sheet-contents {
161- width: auto;
162- max-width: 48rem;
163- max-height: 32rem;
164- border-radius: var(--sheet-border-radius);
165- }
166-
167- .sheet-draggable-area {
168- display: none;
169- }
170-
171- .sheet-controls {
172- grid-template-columns: 1fr auto auto;
173- }
174- }
175203` )
0 commit comments