@xiee/utils 1.12.9 → 1.12.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/callout.css +29 -0
- package/css/callout.min.css +1 -0
- package/js/callout.js +11 -0
- package/js/callout.min.js +1 -0
- package/package.json +1 -1
package/css/callout.css
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
fieldset {
|
|
2
|
+
font-size: .9em;
|
|
3
|
+
margin: 1em auto;
|
|
4
|
+
}
|
|
5
|
+
legend {
|
|
6
|
+
font-weight: bold;
|
|
7
|
+
border-style: groove;
|
|
8
|
+
padding: 2px .5em;
|
|
9
|
+
}
|
|
10
|
+
.callout-tip {
|
|
11
|
+
border-color: #9eeaf9;
|
|
12
|
+
}
|
|
13
|
+
.callout-caution {
|
|
14
|
+
background: #fff3cd;
|
|
15
|
+
border-color: #fff3cd;
|
|
16
|
+
}
|
|
17
|
+
.callout-important {
|
|
18
|
+
background: #f8d7da;
|
|
19
|
+
border-color: #f8d7da;
|
|
20
|
+
}
|
|
21
|
+
.callout-tip legend::before {
|
|
22
|
+
content: "☆ ";
|
|
23
|
+
}
|
|
24
|
+
.callout-caution legend::before {
|
|
25
|
+
content: "☂ ";
|
|
26
|
+
}
|
|
27
|
+
.callout-important legend::before {
|
|
28
|
+
content: "☀ ";
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fieldset{font-size:.9em;margin:1em auto}legend{font-weight:700;border-style:groove;padding:2px .5em}.callout-tip{border-color:#9eeaf9}.callout-caution{background:#fff3cd;border-color:#fff3cd}.callout-important{background:#f8d7da;border-color:#f8d7da}.callout-tip legend::before{content:"☆ "}.callout-caution legend::before{content:"☂ "}.callout-important legend::before{content:"☀ "}
|
package/js/callout.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// turn <div class="callout-*"> to <fieldset><legend>*
|
|
2
|
+
document.querySelectorAll('div[class^="callout-"]').forEach(el => {
|
|
3
|
+
const f = document.createElement('fieldset');
|
|
4
|
+
f.className = el.className;
|
|
5
|
+
// if the data-legend attribute exists, use its value as legend, otherwise use the class name
|
|
6
|
+
const l = el.dataset.legend || el.classList[0].replace('callout-', '');
|
|
7
|
+
f.insertAdjacentHTML('afterbegin', `<legend>${l.toUpperCase()}</legend>`);
|
|
8
|
+
el.after(f);
|
|
9
|
+
f.append(...el.children);
|
|
10
|
+
el.remove();
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
document.querySelectorAll('div[class^="callout-"]').forEach((e=>{const a=document.createElement("fieldset");a.className=e.className;const l=e.dataset.legend||e.classList[0].replace("callout-","");a.insertAdjacentHTML("afterbegin",`<legend>${l.toUpperCase()}</legend>`),e.after(a),a.append(...e.children),e.remove()}));
|