UNPKG

3.91 kBJavaScriptView Raw
1/**
2 * @module settings-panel/theme/none
3 */
4'use strict';
5
6const px = require('add-px-to-style');
7
8module.exports = none;
9
10none.palette = ['white', 'black'];
11none.fontSize = 13;
12none.fontFamily = 'sans-serif';
13none.labelWidth = '9em';
14none.inputHeight = 2;
15none.padding = 1/5;
16
17function none (opts) {
18 opts = opts || {};
19 let fs = opts.fontSize || none.fontSize;
20 let font = opts.fontFamily || none.fontFamily;
21 let h = opts.inputHeight || none.inputHeight;
22 let labelWidth = opts.labelWidth || none.labelWidth;
23 let padding = opts.padding || none.padding;
24 let palette = opts.palette || none.palette;
25 let white = palette[0];
26 let black = palette[palette.length - 1];
27
28 if (/[-0-9.]*/.test(fs)) fs = parseFloat(fs);
29
30 //just size part
31 return `
32 :host {
33 background: ${white};
34 color: ${black};
35 font-family: ${font};
36 font-size: ${px('font-size', fs)};
37 padding: ${h*2.5*padding}em;
38 }
39
40 .settings-panel-title {
41 min-height: ${h}em;
42 line-height: 1.5;
43 text-align: left;
44 font-size: ${px('font-size',fs*1.333)};
45 padding: ${h * 2 * padding / 1.333}em ${h * padding / 1.333 }em;
46 min-height: ${h/1.333}em;
47 margin: 0;
48 }
49
50 .settings-panel-field {
51 padding: ${h * padding}em;
52 }
53
54 :host.settings-panel-orientation-left .settings-panel-label,
55 :host .settings-panel-orientation-left .settings-panel-label,
56 :host.settings-panel-orientation-right .settings-panel-label,
57 :host .settings-panel-orientation-right .settings-panel-label {
58 width: ${px('width', labelWidth)};
59 }
60 :host.settings-panel-orientation-bottom .settings-panel-label {
61 border-top-width: ${h}em;
62 }
63 :host.settings-panel-orientation-bottom .settings-panel-label + .settings-panel-input {
64 top: ${h/8}em;
65 }
66 :host.settings-panel-orientation-left .settings-panel-label {
67 padding-right: ${h/2}em;
68 }
69 :host.settings-panel-orientation-right .settings-panel-label {
70 padding-left: ${h/2}em;
71 }
72 :host.settings-panel-orientation-right .settings-panel-label + .settings-panel-input {
73 width: calc(100% - ${labelWidth});
74 }
75
76 .settings-panel-text,
77 .settings-panel-textarea,
78 .settings-panel-range,
79 .settings-panel-interval,
80 .settings-panel-select,
81 .settings-panel-color,
82 .settings-panel-color-value,
83 .settings-panel-value {
84 height: ${h}em;
85 }
86
87 .settings-panel-button,
88 .settings-panel-input,
89 .settings-panel-switch,
90 .settings-panel-checkbox-group,
91 .settings-panel-switch-label {
92 min-height: ${h}em;
93 }
94 .settings-panel-input,
95 .settings-panel-switch,
96 .settings-panel-select,
97 .settings-panel-checkbox-group,
98 .settings-panel-switch-label {
99 line-height: ${h}em;
100 }
101
102 .settings-panel-switch-label,
103 .settings-panel-checkbox,
104 .settings-panel-checkbox-label,
105 .settings-panel-button {
106 cursor: pointer;
107 }
108
109 .settings-panel-range::-webkit-slider-thumb {
110 cursor: ew-resize;
111 }
112 .settings-panel-range::-moz-range-thumb {
113 cursor: ew-resize;
114 }
115 .settings-panel-range::-ms-track {
116 cursor: ew-resize;
117 }
118 .settings-panel-range::-ms-thumb {
119 cursor: ew-resize;
120 }
121
122 /* Default triangle styles are from control theme, just set display: block */
123 .settings-panel-select-triangle {
124 display: none;
125 position: absolute;
126 border-right: .3em solid transparent;
127 border-left: .3em solid transparent;
128 line-height: ${h}em;
129 right: 2.5%;
130 height: 0;
131 z-index: 1;
132 pointer-events: none;
133 }
134 .settings-panel-select-triangle--up {
135 top: ${h/2}em;
136 margin-top: -${h/4 + h/24}em;
137 border-bottom: ${h/4}em solid;
138 border-top: 0px transparent;
139 }
140 .settings-panel-select-triangle--down {
141 top: ${h/2}em;
142 margin-top: ${h/24}em;
143 border-top: ${h/4}em solid;
144 border-bottom: .0 transparent;
145 }
146
147 :host hr {
148 opacity: .5;
149
150 color: ${black}
151 }
152 `;
153}
\No newline at end of file