Skip to content

Commit 8acfb17

Browse files
authored
[feature] add global size control
1 parent 5737518 commit 8acfb17

File tree

8 files changed

+190
-34
lines changed

8 files changed

+190
-34
lines changed

‎src/css/header.css‎

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,37 +156,34 @@
156156
pointer-events: all;
157157
}
158158

159-
.is-header-search-style-auto .header-search{
160-
flex-grow:1;
161-
min-width:10em;
162-
}
163-
164-
.is-header-search-style-custom .header-search{
165-
width:var(--header-search-width);
166-
}
167-
168-
.header-date{
159+
.header-date-body{
169160
font-size:var(--header-date-size);
161+
flex-grow:1;
170162
}
171163

172-
.header-clock{
164+
.header-clock-body{
173165
font-size:var(--header-clock-size);
166+
flex-grow:1;
174167
}
175168

176-
.header-search{
169+
.header-search-body{
177170
font-size:var(--header-search-size);
171+
flex-grow:1;
178172
}
179173

180-
.header-button{
174+
.header-button-body{
181175
font-size:var(--header-button-size);
176+
flex-grow:1;
182177
}
183178

184-
.header-greeting{
179+
.header-greeting-body{
185180
font-size:var(--header-greeting-size);
181+
flex-grow:1;
186182
}
187183

188-
.header-transitional{
184+
.header-transitional-body{
189185
font-size:var(--header-transitional-size);
186+
flex-grow:1;
190187
}
191188

192189
.header-date,
@@ -210,3 +207,12 @@
210207
.is-menu .header-menu{
211208
display: flex;
212209
}
210+
211+
.is-header-search-style-auto .header-search{
212+
flex-grow:1;
213+
min-width:10em;
214+
}
215+
216+
.is-header-search-style-custom .header-search{
217+
width:var(--header-search-width);
218+
}

‎src/css/layout.css‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.layout{
22
position: relative;
33
width:var(--layout-width);
4+
font-size:calc(1em*var(--layout-size));
45
}
56

67
.is-layout-alignment-horizontal-leftbody{

‎src/css/variables.css‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@
5252
--link-item-display-name-size:0.9em;
5353
--link-item-border:1;
5454
/* layout */
55+
--layout-size:1;
5556
--layout-width:80%;
5657
--layout-line-width:0.2em;
57-
--layout-space:0.5rem;
58+
--layout-space:0.5em;
5859
--layout-padding:4;
5960
--layout-gutter:4;
6061
--layout-duration-02:0.2s;

‎src/index.html‎

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,39 @@
5454
<divclass="header-area">
5555
<divclass="header-item-grid">
5656
<divclass="header-item header-greeting">
57-
<pclass="greeting"></p>
57+
<divclass="header-greeting-body">
58+
<pclass="greeting"></p>
59+
</div>
5860
</div>
5961
<divclass="header-item header-transitional">
60-
<pclass="transitional"></p>
62+
<divclass="header-transitional-body">
63+
<pclass="transitional"></p>
64+
</div>
6165
</div>
6266
<divclass="header-item header-clock">
63-
<pclass="clock"></p>
67+
<divclass="header-clock-body">
68+
<pclass="clock"></p>
69+
</div>
6470
</div>
6571
<divclass="header-item header-date">
66-
<pclass="date"></p>
72+
<divclass="header-date-body">
73+
<pclass="date"></p>
74+
</div>
6775
</div>
6876
<divclass="header-item header-search">
69-
<formclass="search" action="" method="get">
70-
<inputclass="header-search-input search-input mb-0" type="text" placeholder="Find or Search" name="q" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="1">
71-
<inputtype="submit" value="Search" class="is-hidden">
72-
</form>
73-
<buttonclass="header-search-clear search-clear button button-link mb-0" tabindex="1" disabled>
74-
<spanclass="icon-close"></span>
75-
</button>
77+
<divclass="header-search-body">
78+
<formclass="search" action="" method="get">
79+
<inputclass="header-search-input search-input mb-0" type="text" placeholder="Find or Search" name="q" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="1">
80+
<inputtype="submit" value="Search" class="is-hidden">
81+
</form>
82+
<buttonclass="header-search-clear search-clear button button-link mb-0" tabindex="1" disabled>
83+
<spanclass="icon-close"></span>
84+
</button>
85+
</div>
7686
</div>
7787
<divclass="header-item header-button header-edit-add">
78-
<divclass="form-group nested-button mb-0">
88+
<divclass="header-button-body">
89+
<divclass="form-group nested-button mb-0">
7990
<divclass="input-wrap input-button input-hide py-0">
8091
<inputid="control-link-edit" class="control-link-edit" type="checkbox" tabindex="1">
8192
<labelfor="control-link-edit" class="mb-0"><spanclass="label-icon"></span> Edit</label>
@@ -96,17 +107,22 @@
96107
</div>
97108
</div>
98109
</div>
110+
</div>
99111
</div>
100112
<divclass="header-item header-button header-accent">
101-
<divclass="input-wrap input-button input-color-dot input-color-dot-accent py-0">
102-
<inputid="control-theme-accent-current-quick" class="control-theme-accent-current-quick" type="color" tabindex="1">
103-
<labelfor="control-theme-accent-current-quick">Accent</label>
113+
<divclass="header-button-body">
114+
<divclass="input-wrap input-button input-color-dot input-color-dot-accent py-0">
115+
<inputid="control-theme-accent-current-quick" class="control-theme-accent-current-quick" type="color" tabindex="1">
116+
<labelfor="control-theme-accent-current-quick">Accent</label>
117+
</div>
104118
</div>
105119
</div>
106120
<divclass="header-item header-button header-menu">
107-
<buttonclass="control-menu-open button mb-0" tabindex="1">
108-
<spanclass="button-text"><spanclass="icon-settings"></span></span>
109-
</button>
121+
<divclass="header-button-body">
122+
<buttonclass="control-menu-open button mb-0" tabindex="1">
123+
<spanclass="button-text"><spanclass="icon-settings"></span></span>
124+
</button>
125+
</div>
110126
</div>
111127
</div>
112128
</div>
@@ -226,6 +242,9 @@ <h1 class="menu-item-header-text">Padding</h1>
226242
<divclass="control-layout-padding-count form-group-text form-group-medium form-group-radius-left"></div>
227243
</div>
228244
</div>
245+
<divclass="button-wrap">
246+
<buttonclass="control-layout-padding-default button mb-0" tabindex="1">Default Padding size</button>
247+
</div>
229248
</div>
230249
</div>
231250
<divclass="menu-item">
@@ -240,6 +259,27 @@ <h1 class="menu-item-header-text">Gutter</h1>
240259
<divclass="control-layout-gutter-count form-group-text form-group-medium form-group-radius-left"></div>
241260
</div>
242261
</div>
262+
<divclass="button-wrap">
263+
<buttonclass="control-layout-gutter-default button mb-0" tabindex="1">Default Gutter size</button>
264+
</div>
265+
</div>
266+
</div>
267+
<divclass="menu-item">
268+
<divclass="menu-item-header">
269+
<h1class="menu-item-header-text">Global scaling</h1>
270+
</div>
271+
<divclass="menu-item-form">
272+
<divclass="input-wrap">
273+
<labelfor="control-layout-size">Size</label>
274+
<divclass="form-group form-group-block mb-0">
275+
<inputid="control-layout-size" class="control-layout-size mr-3" type="range" min="50" max="200" value="0" step="5" tabindex="-1">
276+
<divclass="control-layout-size-count form-group-text form-group-medium form-group-radius-left"></div>
277+
</div>
278+
</div>
279+
<pclass="control-layout-size-helper form-helper small">Resize all elements on the page.</p>
280+
<divclass="button-wrap">
281+
<buttonclass="control-layout-size-default button mb-0" tabindex="1">Default Global scaling size</button>
282+
</div>
243283
</div>
244284
</div>
245285
<divclass="menu-item">

‎src/js/control.js‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,23 @@ var control = (function(){
285285
layout.render.padding();
286286
render.range.count(this);
287287
}
288+
},{
289+
element: helper.e(".control-layout-padding-default"),
290+
type: "button",
291+
additionalEvents: [{
292+
event: "click",
293+
func: function(){
294+
edge.box.open({
295+
element: helper.e(".layout"),
296+
delay: 500
297+
});
298+
}
299+
}],
300+
func: function(){
301+
mod.setValue("layout.padding",4);
302+
layout.render.padding();
303+
render.update();
304+
}
288305
},{
289306
element: helper.e(".control-layout-gutter"),
290307
path: "layout.gutter",
@@ -333,6 +350,89 @@ var control = (function(){
333350
layout.render.gutter();
334351
render.range.count(this);
335352
}
353+
},{
354+
element: helper.e(".control-layout-gutter-default"),
355+
type: "button",
356+
additionalEvents: [{
357+
event: "click",
358+
func: function(){
359+
edge.box.open({
360+
element: helper.e(".layout"),
361+
delay: 500
362+
});
363+
}
364+
}],
365+
func: function(){
366+
mod.setValue("layout.gutter",2);
367+
layout.render.gutter();
368+
render.update();
369+
}
370+
},{
371+
element: helper.e(".control-layout-size"),
372+
path: "layout.size",
373+
type: "range",
374+
valueMod: ["float"],
375+
rangeCountElement: helper.e(".control-layout-size-count"),
376+
additionalEvents: [{
377+
event: "input",
378+
func: function(){
379+
edge.box.open({
380+
element: helper.e(".layout"),
381+
});
382+
}
383+
},{
384+
event: "mousedown",
385+
func: function(){
386+
edge.box.open({
387+
element: helper.e(".layout"),
388+
});
389+
}
390+
},{
391+
event: "mouseup",
392+
func: function(){
393+
edge.box.close();
394+
}
395+
},{
396+
event: "touchend",
397+
func: function(){
398+
edge.box.close();
399+
}
400+
},{
401+
event: "keydown",
402+
func: function(){
403+
if(event.keyCode==37||event.keyCode==38||event.keyCode==39||event.keyCode==40){
404+
edge.box.open({
405+
element: helper.e(".layout"),
406+
});
407+
};
408+
}
409+
},{
410+
event: "keyup",
411+
func: function(){
412+
edge.box.close();
413+
}
414+
}],
415+
func: function(){
416+
layout.render.size();
417+
render.range.count(this);
418+
}
419+
},{
420+
element: helper.e(".control-layout-size-default"),
421+
type: "button",
422+
additionalEvents: [{
423+
event: "click",
424+
func: function(){
425+
edge.box.open({
426+
element: helper.e(".layout"),
427+
delay: 500
428+
});
429+
}
430+
}],
431+
func: function(){
432+
mod.setValue("layout.size",1);
433+
layout.render.size();
434+
render.update();
435+
}
336436
},{
337437
element: helper.e(".control-layout-title"),
338438
path: "layout.title",

‎src/js/layout.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ var layout = (function(){
1717
html.style.setProperty("--layout-gutter",state.get().layout.gutter);
1818
};
1919

20+
render.size=function(){
21+
varhtml=helper.e("html");
22+
html.style.setProperty("--layout-size",state.get().layout.size);
23+
};
24+
2025
render.order=function(){
2126
varhtml=helper.e("html");
2227
varlayout=helper.e(".layout");
@@ -38,6 +43,7 @@ var layout = (function(){
3843
render.width();
3944
render.padding();
4045
render.gutter();
46+
render.size();
4147
render.order();
4248
render.title();
4349
};

‎src/js/state.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ var state = (function(){
201201
order: "headerlink",
202202
padding: 4,
203203
gutter: 2,
204+
size: 1,
204205
width: 80,
205206
scrollPastEnd: false,
206207
title: "New Tab"

‎src/js/update.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ var update = (function(){
624624
name: "Group 1",
625625
items: data.bookmarks
626626
}];
627+
data.state.layout.size=1;
627628
data.state.header.position="sticky";
628629
data.state.link.item.display.rotate=0;
629630
data.state.link.item.display.translate={

0 commit comments

Comments
(0)