-
Notifications
You must be signed in to change notification settings - Fork 47
/
index.html
503 lines (447 loc) · 14 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSSJanus Demos</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="../site.css">
<style id="css">
body {
writing-mode: lr-tb;
-o-writing-mode: horizontal-tb;
-moz-writing-mode: horizontal-tb;
-webkit-writing-mode: horizontal-tb;
writing-mode: horizontal-tb;
direction: ltr;
}
/* Content direction */
.inline-arrow-container {
white-space: nowrap;
margin: auto;
line-height: 0;
}
.inline-arrow-body {
display: inline-block;
border-bottom: 12px red solid;
float: left;
width: 80%;
height: 31px; /* 25 (arrow-head border) + 12 (this border-bottom)/2 */
margin-left: 19px;
padding: 0 10px;
line-height: 19px;
}
.inline-arrow-head {
border: 25px solid transparent;
border-left-color: red;
display: inline-block;
}
.block-arrow-container {
float: left;
margin-top: -19px;
}
.block-arrow-body {
border-left: 12px green solid;
margin-left: 19px;
height: 80%;
padding: 20px 5px;
}
.block-arrow-head {
display: inline-block;
border: 25px solid transparent;
border-top-color: green;
}
/* Floated content */
.p-float {
float: right;
}
.floatpointer {
display: inline-block;
padding-right: 20px;
background: url(Arrow-ltr-inline.png) no-repeat 100% 50%;
}
/* Sides */
.p-sides {
padding: 1em 5px;
border: 1px solid #aaa;
border-bottom-left-radius: 4px;
border-color: transparent rgba( 0, 0, 0, 0 ) #aaa #aaa;
margin: 0 0 1px 15px;
}
/* Vertical */
.p-container {
padding: 0 20%;
}
/* Text */
.p-indent {
text-indent: 2em;
unicode-bidi: bidi-override;
text-align: left;
}
.border {
border: 1px solid black;
border-color: red rgb( 0, 255, 0 ) #0000FF hsl( 0, 0%, 0% );
border-width: 1px 2px 3px;
}
/* Spacing */
.padding {
padding: 4px 0.6em 2px 16px;
border: 1px green dotted;
}
.space-after, .space-before, .space-both {
border: 1px dotted #AAA;
display: inline-block;
}
.space-after {
padding-right: 1em;
margin-right: 1em;
}
.space-before {
padding: 0 0 0 1em;
margin: 0 0 0 1em;
}
.space-both {
padding: 0 1em 0;
margin: 0 1em 0;
}
/* Borders */
.radius {
padding: 0.3em;
border: 1px solid #ccc;
border-radius: 4px 16px / 2px 6px 10px;
}
.border-styles {
padding-right: 4px;
border-right: 4px solid red;
border-radius: 0 10px 10px 0 / 0 6px 6px 0;
}
.border-images {
border: solid;
border-width: 28px 10px 10px 14px;
/* @noflip */
border-image: url(borderimage-ltr.png) 16 10 10 28 / 28px 10px 10px 14px round stretch;
line-height: 28px;
padding: 4px 8px;
display: inline-block;
}
.border-images-inline-start {
border: 1px dashed;
border-left: 4px solid #080;
}
.border-images-block-start {
border: 1px dashed;
border-top: 4px solid #880;
}
.border-images-block-end {
border: 1px dashed;
border-bottom: 4px solid #008;
}
/* Shadows */
.text-shadows {
text-shadow: #FAA -20px -4px 2px, #AAF 20px 4px 2px;
}
.box-shadows {
box-shadow: 5px 0 2px #0F0 inset;
}
.box-shadows2 {
box-shadow: 1px 1px 2px red, 3px 3px 1px -1px #C00, 0 0 1px orange inset;
}
/* Transform */
.transformed {
transform: translate( 25%, 50% );
width: 14em;
height: 8em;
}
.untransformed {
width: 14em;
height: 8em;
position: relative;
}
.untransformed::before {
content: "";
display: block;
width: 2px;
height: 100%;
position: absolute;
top: 0;
left: 25%;
background: rgba(250, 100, 0, 0.3);
}
.untransformed::after {
content: "";
display: block;
width: 100%;
height: 2px;
position: absolute;
top: 50%;
left: 0;
background: rgba(250, 100, 0, 0.3);
}
/* Position */
.posholder {
/* @noflip */
direction: ltr; /* Descriptions */
}
.posleft, .posright, .postop, .posbottom {
position: relative;
border: 1px solid #000;
padding: 2px 4px;
margin: 1px;
}
.posbase {
border: 1px solid #000;
padding: 2px;
}
.posleft {
left: 6px;
}
.posright {
right: 6px;
}
.postop {
top: 6px;
}
.posbottom {
bottom: 6px;
}
/* Cursors */
.cursor-pointer {
cursor: pointer;
}
.resize-l {
cursor: w-resize;
}
.resize-v {
cursor: ns-resize;
}
.resize-r {
cursor: e-resize;
}
.resize-rd {
cursor: se-resize;
}
.resize-d {
cursor: nesw-resize;
}
.resize-row {
cursor: row-resize;
}
.resize-column {
cursor: col-resize;
}
/* Background images */
ul.outer {
list-style-image: url(Arrow-ltr-inline.png);
}
ul.inner {
list-style-image: none;
}
ul.inner li {
padding: 5px;
margin: 5px 0;
}
ul.inner .inline-start-background {
background-image: url(Arrow-ltr-inline.png);
background-repeat: no-repeat;
background-position: 0% 50%;
padding-left: 20px;
}
ul.inner .block-after-background {
background: url(Arrow-ltr-inline.png) repeat no-repeat bottom;
padding-bottom: 20px;
}
/* @noflip */
.cje-form {
writing-mode: lr-tb;
-o-writing-mode: horizontal-tb;
-moz-writing-mode: horizontal-tb;
-webkit-writing-mode: horizontal-tb;
writing-mode: horizontal-tb;
direction: ltr;
position: fixed;
top: 1%;
left: 0;
right: 0;
text-align: center;
}
</style>
<script src="../lib/es5-shim.js"></script>
<script>exports = {}; function require() { return exports; }</script>
<script src="../../src/cssjanus.js"></script>
</head>
<div class="container">
<div class="page-header">
<h1>CSSJanus Demos</h1>
<p class="lead"><a href="../">Return to flip service</a>.</p>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Content direction</h3></div>
<div class="panel-body">
<div class="inline-arrow-container">
<div class="inline-arrow-body">
Inline direction
</div>
<div class="inline-arrow-head"></div>
</div>
<div class="block-arrow-container">
<div class="block-arrow-body">
Block<br />direction
</div>
<div class="block-arrow-head"></div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Floated content</h3></div>
<div class="panel-body">
<div class="well well-sm"><span class="floatpointer">Point to the end</span></div>
<div class="clearfix"></div>
<div class="p-float well well-sm">Floatation</div>
<p><em>Cupcake ipsum dolor sit. Amet I love croissant chocolate chocolate cake gummi bears chocolate. Chocolate jelly beans I love jelly. Sweet roll pastry sweet. Tart lemon drops pie. Jelly candy canes brownie pie macaroon pudding pie.</em></p>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Sides</h3></div>
<div class="panel-body">
<div class="p-float p-sides">Flotation</div>
<p>A floating box at the far end of the box has borders on two sides (using <code>border-color</code> with four values), and <code>border-radius</code> on the one visible corner. It also has a margin on two sides, with different units.</p>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Vertical</h3></div>
<div class="panel-body">
<div class="p-container">
<p>This paragraph is in a container that has padding on each side, using the two-value ("padding: 0 20%;") syntax. When rotated (top to bottom), the values should be flipped, so that the padding is on the top and bottom.</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Text</h3></div>
<div class="panel-body">
<p class="p-indent">This paragraph is has a <code>text-indent</code>. <em>Sed efficitur vulputate arcu a facilisis. Sed et libero volutpat, facilisis ex vel, dapibus nisi. Maecenas bibendum, est non consequat consectetur, tellus erat elementum tortor, ut aliquet tellus enim sed ligula. Sed luctus congue purus sit amet condimentum. Suspendisse est ligula, accumsan laoreet porta vel, rutrum finibus dui.</em></p>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Spacing</h3></div>
<div class="panel-body">
<p><code>padding</code> and <code>margin</code> styles. <span class="padding">Padding</span>.</p>
<p>
<span class="space-after">This span has both padding and margin after the text, using margin-[direction]/padding-[direction] properties.</span> When flipping from ltr to rtl, padding-right becomes padding-left. For tb-lr, it becomes padding-bottom.
</p>
<p>
Lorem ipsum. <span class="space-before">This span has both padding and margin before the text, using the four-value syntax.</span> (E.g. padding: 0 0 0 1em; )
</p>
<p>
Lorem ipsum. <span class="space-both">This span has both padding and margin on both sides of the text, using the three-value syntax.</span> When rotated, this gets converted to four-value syntax.
</p>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Borders</h3></div>
<div class="panel-body">
<p>A <span class="border">border</span> and <span class="radius">border radius</span>.</p>
<p><span class="border-styles">This span has a red border after the text, with rounded corners.</span></p>
<p><span class="border-images">This span has a thicker border <span class="border-images-block-start">closer to the preceding line</span>, a thinner border to the <span class="border-images-inline-start">inline-start direction</span>, and repeating text at the <span class="border-images-block-end">border closer to the following line</span>. </span></p>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Shadows</h3></div>
<div class="panel-body">
<p>Using <code>box-shadow</code>, <code>text-shadow</code>, including inset positioning and overlapping shadows.</p>
<p class="text-shadows">This text has a red shadow before the text slightly closer to the previous line, and a blue shadow after the text and slightly closer to the following line.</p>
<p class="box-shadows">This box has an inset shadow, visible before the text.</p>
<div class="box-shadows2">This box has a light orange shadow at the start and above the text. And a red shadow at the end and below the text.</div>
</li>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Transform</h3></div>
<div class="panel-body">
<p><code>transform: translate( 25%, 50% );</code></p>
<div class="well p-float untransformed">
Original
</div>
<div class="well p-float transformed">
Transformed<br>(25% towards end of line, 50% toward end of page)
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Position</h3></div>
<div class="panel-body">
<p><code>position: relative;</code></p>
<ul class="list-group">
<li class="list-group-item posholder">Moved <span class="posbase"></span><span class="postop">toward the following line</span><span class="posbase"></span>.</li>
<li class="list-group-item posholder">Moved <span class="posbase"></span><span class="posbottom">toward the previous line</span><span class="posbase"></span>.</li>
<li class="list-group-item posholder">Moved <span class="posbase"></span><span class="posleft">forward in the direction of the text</span><span class="posbase"></span>.</li>
<li class="list-group-item posholder">Moved <span class="posbase"></span><span class="posright">backward in the direction of the text</span><span class="posbase"></span>.</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Cursors</h3></div>
<div class="panel-body">
<p class="cursor-pointer">Cursor is shown when hovering over the text.</p>
<ul class="list-group">
<li class="list-group-item resize-r">The cursor points in the text direction.</li>
<li class="list-group-item resize-l">The cursor points against the text direction.</li>
<li class="list-group-item resize-v">The cursor is perpendicular to the text direction.</li>
<li class="list-group-item resize-rd">The cursor points to the diagonal between the block direction and inline direction.</li>
<li class="list-group-item resize-d">diagonal cursor</li>
<li class="list-group-item resize-row">row cursor</li>
<li class="list-group-item resize-column">column cursor</li>
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Background image</h3></div>
<div class="panel-body">
<p>Background-images, including URL flips, and positioning.</p>
<ul class="outer">
<li>Outer</li>
</ul>
<ul class="inner">
<li class="inline-start-background">This element has a background arrow pointing toward the text, positioned at the text beginning.</li>
<li class="block-after-background">This element has repeated background arrows on a line after the the text's block, pointing toward the inline direction.</li>
</ul>
</div>
</div>
</div>
<div class="cje-form">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" data-value="ltr">LTR</button>
<button type="button" class="btn btn-default" data-value="rtl">RTL</button>
</div>
</div>
<footer class="demo-footer" role="contentinfo">
<div class="container">
<p><a href="../">Flip service</a> · <a href="https://github.com/cssjanus/cssjanus.github.io/blob/master/demo/index.html">Source code of this page</a></p>
</div>
</footer>
<script>
( function () {
var activeBtn,
cssjanus = require(),
buttons = document.getElementsByTagName( 'button' ),
cssElem = document.getElementById( 'css' ),
css = cssElem.firstChild.nodeValue;
for ( var i = 0; i < buttons.length; i++ ) {
buttons[ i ].onclick = function () {
var value = this.getAttribute( 'data-value' );
if ( value === 'ltr' ) {
cssElem.firstChild.nodeValue = css;
} else {
cssElem.firstChild.nodeValue = cssjanus.transform(
css,
true,
true
);
}
this.className += ' active';
if (activeBtn) {
activeBtn.className = activeBtn.className.replace( ' active', '' );
}
activeBtn = this;
};
}
} )();
</script>
</html>