-
Notifications
You must be signed in to change notification settings - Fork 1
/
box.html
93 lines (74 loc) · 8.32 KB
/
box.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
<!DOCTYPE html>
<html>
<head>
<link rel="import" href="_loader.html" />
</head>
<body>
<template>
<style type="text/css">/*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;line-height:1.5;color:#24292e;background-color:#fff}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section{display:block}summary{display:list-item}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress,sub,sup{vertical-align:baseline}[hidden],template{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects;color:#0366d6;text-decoration:none}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline dotted}b,strong{font-weight:600}dfn{font-style:italic}h1{margin:.67em 0}mark{background-color:#ff0;color:#000}small{font-size:90%}sub,sup{font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}svg:not(:root){overflow:hidden}kbd,samp{font-family:monospace,monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box}button,input,select,textarea{font:inherit;margin:0}optgroup{font-weight:700}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{color:inherit;display:table;max-width:100%;white-space:normal}textarea{overflow:auto}[type=checkbox],[type=radio],legend{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}*{box-sizing:border-box}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a:hover{text-decoration:underline}.rule,hr{height:0;margin:15px 0;overflow:hidden;background:0 0;border:0;border-bottom:1px solid #dfe2e5}.rule::after,.rule::before,hr::after,hr::before{display:table;content:""}.rule::after,hr::after{clear:both}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}button{cursor:pointer}h1,h2,h3,h4,h5,h6,p{margin-top:0;margin-bottom:0}h1,h2,h3,h4,h5,h6{font-size:32px;font-weight:600}h2,h3,h4,h5,h6{font-size:24px}h3,h4,h5,h6{font-size:20px}h4,h5,h6{font-size:16px}h5,h6{font-size:14px}h6{font-size:12px}p{margin-bottom:10px}blockquote{margin:0}ol,ul{padding-left:0}ol ol,ul ol{list-style-type:lower-roman}ol ol ol,ol ul ol,ul ol ol,ul ul ol{list-style-type:lower-alpha}dd{margin-left:0}code,pre,tt{font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px}ol,pre,ul{margin-top:0;margin-bottom:0}.octicon{vertical-align:text-bottom}</style>
<style type="text/css">.Box{background-color:#fff;border:1px solid #d1d5da;border-radius:3px}.Box--condensed{line-height:1.25}.Box--condensed .Box-body,.Box--condensed .Box-footer,.Box--condensed .Box-header,.Box--condensed .Box-row{padding:8px 16px}.Box--condensed .Box-btn-octicon.btn-octicon{padding:8px 16px;margin:-8px -16px;line-height:1.25}.Box--spacious .Box-header{padding:24px;line-height:1.25}.Box--spacious .Box-title{font-size:20px}.Box--spacious .Box-body,.Box--spacious .Box-footer,.Box--spacious .Box-row{padding:24px}.Box--spacious .Box-btn-octicon.btn-octicon{padding:24px;margin:-24px}.Box-header{padding:16px;margin:-1px -1px 0;background-color:#f6f8fa;border-color:#d1d5da;border-style:solid;border-width:1px;border-top-left-radius:3px;border-top-right-radius:3px}.Box-title{font-size:14px;font-weight:600}.Box-body{padding:16px;border-bottom:1px solid #e1e4e8}.Box-body:last-of-type{margin-bottom:-1px;border-bottom-right-radius:2px;border-bottom-left-radius:2px}.Box-row{padding:16px;margin-top:-1px;list-style-type:none;border-top:1px solid #e1e4e8}.Box-row:first-of-type{border-top-color:transparent;border-top-left-radius:2px;border-top-right-radius:2px}.Box-row:last-of-type{border-bottom-right-radius:2px;border-bottom-left-radius:2px}.Box-row.Box-row--unread,.Box-row.unread{box-shadow:2px 0 0 #0366d6 inset}.Box-row.navigation-focus .Box-row--drag-button{color:#0366d6;cursor:grab;opacity:100}.Box-row.navigation-focus.is-dragging .Box-row--drag-button{cursor:grabbing}.Box-row.navigation-focus.sortable-chosen{background-color:#fafbfc}.Box-row--focus-gray.navigation-focus,.Box-row.navigation-focus.sortable-ghost{background-color:#f6f8fa}.Box-row.navigation-focus.sortable-ghost .Box-row--drag-hide{opacity:0}.Box-row--focus-blue.navigation-focus{background-color:#f1f8ff}.Box-row--hover-gray:hover{background-color:#f6f8fa}.Box-row--hover-blue:hover{background-color:#f1f8ff}@media (min-width:768px){.Box-row-link,.Box-row-link:hover{color:#24292e;text-decoration:none}.Box-row-link:hover{color:#0366d6}}.Box-row--drag-button{opacity:0}.Box-footer{padding:16px;margin-top:-1px;border-top:1px solid #e1e4e8}.Box--scrollable{max-height:324px;overflow:scroll}.Box--blue .Box-header{background-color:#f1f8ff;border-color:#c8e1ff}.Box--blue,.Box--blue .Box-body,.Box--blue .Box-footer,.Box--blue .Box-row{border-color:#c8e1ff}.Box--danger{border-color:#d73a49}.Box--danger .Box-row:first-of-type{border-color:#d73a49}.Box--danger .Box-body:last-of-type{border-color:#d73a49}.Box-header--blue{background-color:#f1f8ff;border-color:#c8e1ff}.Box-row--yellow{background-color:#fffbdd}.Box-row--blue{background-color:#f1f8ff}.Box-row--gray{background-color:#f6f8fa}.Box-btn-octicon.btn-octicon{padding:16px;margin:-16px;line-height:1.5}</style>
</template>
<script>
(function() {
var classMaps = {
'primer-box-header': 'Box-header',
'primer-box-footer': 'Box-footer',
'primer-box-row': 'Box-row',
};
var boxTypes = {
'spacious': 'Box--spacious',
'condensed': 'Box--condensed',
'danger': 'Box--danger',
'blue': 'Box--blue',
'yellow': 'Box--yellow',
'gray': 'Box--gray'
}
function enhanceChildNodes(root) {
return Array.from(root.childNodes)
.forEach((node) => {
if (!(node instanceof HTMLElement)) {
return node;
}
Object.keys(classMaps)
.forEach((attributeName) => {
if (node.hasAttribute(attributeName)) {
node.classList.add(classMaps[attributeName])
}
});
if (node.tagName.match(/^H[0-9]$/)) {
node.classList.add("Box-title")
}
enhanceChildNodes(node);
});
}
githubPrimer.registerElement('primer-box', {
create: function (ownerDocument, document) {
var boxElement = document.createElement('div');
boxElement.classList.add('Box');
Object.keys(boxTypes)
.forEach((attributeName) => {
if (this.hasAttribute(attributeName)) {
boxElement.classList.add(boxTypes[attributeName])
}
});
enhanceChildNodes(this);
if ((this.childNodes.length === 1) && (this.childNodes[0] instanceof Text)) {
var boxRow = document.createElement('div');
boxRow.setAttribute('primer-box-row', '');
boxRow.classList.add(classMaps['primer-box-row'])
boxRow.textContent = this.childNodes[0].textContent;
boxElement.appendChild(boxRow);
} else {
Array.from(this.childNodes)
.forEach((node) => boxElement.appendChild(node));
}
var shadowRoot = this.attachShadow({ mode: 'open' });
shadowRoot.appendChild(boxElement);
return shadowRoot;
}
});
})();
</script>
</body>
</html>