markdown-to-html-cli 3.2.12 → 3.2.13
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/README.md +0 -9
- package/github.css +0 -898
- package/lib/create.js +54 -92
- package/lib/create.js.map +1 -1
- package/lib/index.d.ts +0 -9
- package/lib/index.js.map +1 -1
- package/lib/nodes/copy.d.ts +2 -0
- package/lib/nodes/copy.js +76 -1
- package/lib/nodes/copy.js.map +1 -1
- package/lib/nodes/dark-mode.d.ts +6 -0
- package/lib/nodes/dark-mode.js +29 -0
- package/lib/nodes/dark-mode.js.map +1 -0
- package/lib/nodes/{githubCornersFork.d.ts → github-corners-fork.d.ts} +0 -0
- package/lib/nodes/github-corners-fork.js +122 -0
- package/lib/nodes/github-corners-fork.js.map +1 -0
- package/lib/nodes/{githubCorners.d.ts → github-corners.d.ts} +1 -1
- package/lib/nodes/github-corners.js +107 -0
- package/lib/nodes/github-corners.js.map +1 -0
- package/lib/nodes/markdown-style.d.ts +2 -0
- package/lib/nodes/markdown-style.js +1045 -0
- package/lib/nodes/markdown-style.js.map +1 -0
- package/package.json +6 -14
- package/lib/nodes/githubCorners.js +0 -59
- package/lib/nodes/githubCorners.js.map +0 -1
- package/lib/nodes/githubCornersFork.js +0 -20
- package/lib/nodes/githubCornersFork.js.map +0 -1
package/lib/create.js
CHANGED
|
@@ -1,108 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { unified } from 'unified';
|
|
1
|
+
import markdown from '@wcj/markdown-to-html';
|
|
2
|
+
import { getCodeString } from 'rehype-rewrite';
|
|
4
3
|
import rehypeDocument from 'rehype-document';
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import rehypePrism from '@mapbox/rehype-prism';
|
|
7
|
-
import stringify from 'rehype-stringify';
|
|
8
|
-
import rehypeSlug from 'rehype-slug';
|
|
9
|
-
import rehypeFormat from 'rehype-format';
|
|
10
4
|
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
|
|
5
|
+
import rehypeSlug from 'rehype-slug';
|
|
6
|
+
import remarkGemoji from 'remark-gemoji';
|
|
11
7
|
// @ts-ignore
|
|
12
8
|
import rehypeUrls from 'rehype-urls';
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import rehypeRewrite from 'rehype-rewrite';
|
|
17
|
-
import rehypeAttrs from 'rehype-attr';
|
|
18
|
-
import rehypeVideo from 'rehype-video';
|
|
19
|
-
import remarkGfm from 'remark-gfm';
|
|
20
|
-
import remarkGemoji from 'remark-gemoji';
|
|
21
|
-
import remarkRehype from 'remark-rehype';
|
|
22
|
-
import remarkParse from 'remark-parse';
|
|
23
|
-
import { githubCorners } from './nodes/githubCorners.js';
|
|
24
|
-
import { githubCornersFork } from './nodes/githubCornersFork.js';
|
|
9
|
+
import rehypeFormat from 'rehype-format';
|
|
10
|
+
import { githubCorners } from './nodes/github-corners.js';
|
|
11
|
+
import { githubCornersFork } from './nodes/github-corners-fork.js';
|
|
25
12
|
import { octiconLink } from './nodes/octiconLink.js';
|
|
26
|
-
import {
|
|
13
|
+
import { markdownStyle } from './nodes/markdown-style.js';
|
|
14
|
+
import { copyElement, copyStyle, copyScript } from './nodes/copy.js';
|
|
15
|
+
import { darkMode } from './nodes/dark-mode.js';
|
|
27
16
|
// https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-when-using-the-experimental-modules-flag
|
|
28
17
|
// export const _dirname = dirname(fileURLToPath(import.meta.url));
|
|
29
18
|
// const filename = fileURLToPath(import.meta.url);
|
|
30
19
|
// const dirname = path.dirname(filename);
|
|
31
20
|
export const _dirname = /file:\/\/(.+)\/[^/]/.exec(import.meta.url)[1];
|
|
32
|
-
const script = `/*! @uiw/copy-to-clipboard v1.0.12 | MIT (c) 2021 Kenny Wang | https://github.com/uiwjs/copy-to-clipboard.git */
|
|
33
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).copyTextToClipboard=t()}(this,(function(){"use strict";return function(e,t){const o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style={position:"absolute",left:"-9999px"},document.body.appendChild(o);const n=document.getSelection().rangeCount>0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}}));
|
|
34
|
-
|
|
35
|
-
function copied(target, str) {
|
|
36
|
-
target.classList.add('active');
|
|
37
|
-
copyTextToClipboard(target.dataset.code, function() {
|
|
38
|
-
setTimeout(() => {
|
|
39
|
-
target.classList.remove('active');
|
|
40
|
-
}, 2000);
|
|
41
|
-
});
|
|
42
|
-
}`;
|
|
43
|
-
const getCodeStr = (data = [], code = '') => {
|
|
44
|
-
data.forEach((node) => {
|
|
45
|
-
if (node.type === 'text') {
|
|
46
|
-
code += node.value;
|
|
47
|
-
}
|
|
48
|
-
else if (node.type === 'element' && node.children && Array.isArray(node.children)) {
|
|
49
|
-
code += getCodeStr(node.children);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
return code;
|
|
53
|
-
};
|
|
54
21
|
export function create(options = {}) {
|
|
55
|
-
const { markdown, document, rewrite, reurls = {}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
.use(remarkGfm)
|
|
70
|
-
.use(remarkGemoji)
|
|
71
|
-
.use(remarkRehype, { allowDangerousHtml: true })
|
|
72
|
-
.use(rehypeVideo)
|
|
73
|
-
.use(rehypeRaw)
|
|
74
|
-
.use(document ? rehypeDocument : undefined, {
|
|
75
|
-
...document,
|
|
76
|
-
js: [
|
|
77
|
-
...(document && document.js ? (Array.isArray(document.js) ? document.js : [document.js]) : []),
|
|
78
|
-
],
|
|
79
|
-
script: [
|
|
80
|
-
...(document && document.script ? (Array.isArray(document.script) ? document.script : [document.script]) : []),
|
|
81
|
-
script,
|
|
22
|
+
const { markdown: string, document, rewrite, reurls = {} } = options;
|
|
23
|
+
const mdOptions = {
|
|
24
|
+
hastNode: false,
|
|
25
|
+
remarkPlugins: [remarkGemoji],
|
|
26
|
+
rehypePlugins: [
|
|
27
|
+
[rehypeUrls, (url) => {
|
|
28
|
+
if (reurls[url.href]) {
|
|
29
|
+
url.path = reurls[url.href];
|
|
30
|
+
return url.path;
|
|
31
|
+
}
|
|
32
|
+
}],
|
|
33
|
+
[rehypeSlug],
|
|
34
|
+
[rehypeAutolinkHeadings],
|
|
35
|
+
[rehypeFormat],
|
|
82
36
|
],
|
|
83
|
-
link: document && document.link ? (Array.isArray(document.link) ? document.link : [document.link]) : [],
|
|
84
|
-
style: [cssStr.toString().replace(/\n/g, ''), ...(document ? (Array.isArray(document.style) ? document.style : [document.style]) : [])],
|
|
85
|
-
})
|
|
86
|
-
.use(rehypeSlug)
|
|
87
|
-
.use(rehypeAutolinkHeadings)
|
|
88
|
-
.use(rehypeWrap, { ...wrap })
|
|
89
|
-
.use(rehypePrism, { ignoreMissing: true })
|
|
90
|
-
.use(rehypeAttrs, { properties: 'attr' })
|
|
91
|
-
.use(rehypeUrls, (url) => {
|
|
92
|
-
if (reurls[url.href]) {
|
|
93
|
-
url.path = reurls[url.href];
|
|
94
|
-
return url.path;
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
.use(rehypeRewrite, {
|
|
98
37
|
rewrite: (node, index, parent) => {
|
|
38
|
+
if ((node.type == 'element' && node.tagName === 'body') || (!document && node.type === 'root')) {
|
|
39
|
+
node.children = markdownStyle(node.children);
|
|
40
|
+
darkMode().forEach(item => node.children.unshift(item));
|
|
41
|
+
}
|
|
99
42
|
if (options['github-corners'] && ((document && node.type == 'element' && node.tagName === 'body') || (!document && node.type === 'root'))) {
|
|
100
43
|
node.children = Array.isArray(node.children) ? node.children : [];
|
|
101
44
|
if (options['github-corners-fork']) {
|
|
102
45
|
node.children.unshift(githubCornersFork({ href: options['github-corners'] }));
|
|
103
46
|
}
|
|
104
47
|
else {
|
|
105
|
-
|
|
48
|
+
githubCorners({ href: options['github-corners'] }).forEach(item => {
|
|
49
|
+
node.children.unshift(item);
|
|
50
|
+
});
|
|
106
51
|
}
|
|
107
52
|
}
|
|
108
53
|
if (node.type == 'element' && /h(1|2|3|4|5|6)/.test(node.tagName) && node.children && Array.isArray(node.children) && node.children.length > 0) {
|
|
@@ -112,18 +57,35 @@ export function create(options = {}) {
|
|
|
112
57
|
child.children = [octiconLink()];
|
|
113
58
|
}
|
|
114
59
|
}
|
|
60
|
+
if (node.type == 'element' && node.tagName === 'markdown-style') {
|
|
61
|
+
node.children.unshift(copyStyle());
|
|
62
|
+
node.children.unshift(copyScript());
|
|
63
|
+
}
|
|
115
64
|
if (node.type == 'element' && node.tagName === 'pre') {
|
|
116
|
-
const code =
|
|
65
|
+
const code = getCodeString(node.children);
|
|
117
66
|
node.children.push(copyElement(code));
|
|
118
67
|
}
|
|
119
68
|
if (rewrite && typeof rewrite === 'function') {
|
|
120
69
|
rewrite(node, index, parent);
|
|
121
70
|
}
|
|
122
71
|
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
.
|
|
127
|
-
|
|
72
|
+
};
|
|
73
|
+
if (document) {
|
|
74
|
+
const documentOptions = { ...document };
|
|
75
|
+
if (document.js) {
|
|
76
|
+
documentOptions.js = Array.isArray(document.js) ? document.js : [document.js];
|
|
77
|
+
}
|
|
78
|
+
if (document.script) {
|
|
79
|
+
documentOptions.script = Array.isArray(document.script) ? document.script : [document.script];
|
|
80
|
+
}
|
|
81
|
+
if (document.link) {
|
|
82
|
+
documentOptions.link = Array.isArray(document.link) ? document.link : [document.link];
|
|
83
|
+
}
|
|
84
|
+
if (document.style) {
|
|
85
|
+
documentOptions.style = Array.isArray(document.style) ? document.style : [document.style];
|
|
86
|
+
}
|
|
87
|
+
mdOptions.rehypePlugins.unshift([rehypeDocument, documentOptions]);
|
|
88
|
+
}
|
|
89
|
+
return markdown(string || '', mdOptions);
|
|
128
90
|
}
|
|
129
91
|
//# sourceMappingURL=create.js.map
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,QAAqB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,aAAa;AACb,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,wHAAwH;AACxH,mEAAmE;AACnE,mDAAmD;AACnD,0CAA0C;AAE1C,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAGlC,MAAM,UAAU,MAAM,CAAC,UAA2B,EAAE;IAClD,MAAM,EAAE,QAAQ,EAAE,MA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QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC3F;QAED,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC;KACpE;IAED,OAAO,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,SAAS,CAAW,CAAC;AACrD,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -33,15 +33,6 @@ export interface MDToHTMLOptions extends RunArgvs {
|
|
|
33
33
|
rewrite?: RehypeRewriteOptions['rewrite'];
|
|
34
34
|
/** rewrite URLs of href and src attributes. */
|
|
35
35
|
reurls?: Record<string, string>;
|
|
36
|
-
/**
|
|
37
|
-
* rehype-wrap Options
|
|
38
|
-
* Wrap selected elements with a given element
|
|
39
|
-
* https://github.com/mrzmmr/rehype-wrap/tree/2402bcdb8ea25bd0948cda72e96d16e65a18c1e9#options
|
|
40
|
-
*/
|
|
41
|
-
wrap?: {
|
|
42
|
-
selector?: string;
|
|
43
|
-
wrapper?: string;
|
|
44
|
-
};
|
|
45
36
|
}
|
|
46
37
|
export declare function run(opts?: Omit<RunArgvs, "_">): any;
|
|
47
38
|
export declare const cliHelp: string;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAwB,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","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2
|
+
display: flex;
|
|
3
|
+
position: absolute;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
color: #a5afbb;
|
|
6
|
+
top: 6px;
|
|
7
|
+
right: 6px;
|
|
8
|
+
border-radius: 5px;
|
|
9
|
+
background: #82828226;
|
|
10
|
+
padding: 6px;
|
|
11
|
+
font-size: 12px;
|
|
12
|
+
transition: all .3s;
|
|
13
|
+
}
|
|
14
|
+
.markdown-body pre .copied:not(.active) {
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
}
|
|
17
|
+
.markdown-body pre:hover .copied {
|
|
18
|
+
visibility: visible;
|
|
19
|
+
}
|
|
20
|
+
.markdown-body pre:hover .copied:hover {
|
|
21
|
+
background: #4caf50;
|
|
22
|
+
color: #fff;
|
|
23
|
+
}
|
|
24
|
+
.markdown-body pre:hover .copied:active,
|
|
25
|
+
.markdown-body pre .copied.active {
|
|
26
|
+
background: #2e9b33;
|
|
27
|
+
color: #fff;
|
|
28
|
+
}
|
|
29
|
+
.markdown-body pre .copied .octicon-copy {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
.markdown-body pre .copied .octicon-check {
|
|
33
|
+
display: none;
|
|
34
|
+
}
|
|
35
|
+
.markdown-body pre .active .octicon-copy {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
.markdown-body pre .active .octicon-check {
|
|
39
|
+
display: block;
|
|
40
|
+
}`;
|
|
41
|
+
export function copyStyle() {
|
|
42
|
+
return {
|
|
43
|
+
type: 'element',
|
|
44
|
+
tagName: 'style',
|
|
45
|
+
children: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
value: style
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const script = `/*! @uiw/copy-to-clipboard v1.0.12 | MIT (c) 2021 Kenny Wang | https://github.com/uiwjs/copy-to-clipboard.git */
|
|
54
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).copyTextToClipboard=t()}(this,(function(){"use strict";return function(e,t){const o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style={position:"absolute",left:"-9999px"},document.body.appendChild(o);const n=document.getSelection().rangeCount>0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}}));
|
|
55
|
+
|
|
56
|
+
function copied(target, str) {
|
|
57
|
+
target.classList.add('active');
|
|
58
|
+
copyTextToClipboard(target.dataset.code, function() {
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
target.classList.remove('active');
|
|
61
|
+
}, 2000);
|
|
62
|
+
});
|
|
63
|
+
}`;
|
|
64
|
+
export function copyScript() {
|
|
65
|
+
return {
|
|
66
|
+
type: 'element',
|
|
67
|
+
tagName: 'script',
|
|
68
|
+
children: [
|
|
69
|
+
{
|
|
70
|
+
type: 'text',
|
|
71
|
+
value: script
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export function copyElement(str = '') {
|
|
2
77
|
return {
|
|
3
78
|
type: 'element',
|
|
4
79
|
tagName: 'div',
|
package/lib/nodes/copy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../src/nodes/copy.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,MAAc,
|
|
1
|
+
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../src/nodes/copy.ts"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCZ,CAAC;AAEH,MAAM,UAAU,SAAS;IACvB,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,E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AE,eAAe;oBAC1B,UAAU,EAAE,MAAM;oBAClB,OAAO,EAAE,WAAW;oBACpB,IAAI,EAAE,cAAc;oBACpB,MAAM,EAAE,EAAE;oBACV,KAAK,EAAE,EAAE;iBACV;gBACD,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,MAAM;wBACf,UAAU,EAAE;4BACV,QAAQ,EAAE,SAAS;4BACnB,CAAC,EAAE,iIAAiI;yBACrI;wBACD,QAAQ,EAAE,EAAE;qBACb;iBACF;aACF;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const scriptString = `const t=document;const e="_dark_mode_theme_";const s="permanent";const o="colorschemechange";const i="permanentcolorscheme";const h="light";const r="dark";const n=(t,e,s=e)=>{Object.defineProperty(t,s,{enumerable:true,get(){const t=this.getAttribute(e);return t===null?"":t},set(t){this.setAttribute(e,t)}})};const c=(t,e,s=e)=>{Object.defineProperty(t,s,{enumerable:true,get(){return this.hasAttribute(e)},set(t){if(t){this.setAttribute(e,"")}else{this.removeAttribute(e)}}})};class a extends HTMLElement{static get observedAttributes(){return["mode",h,r,s]}LOCAL_NANE=e;constructor(){super();this.t()}connectedCallback(){n(this,"mode");n(this,r);n(this,h);c(this,s);const a=localStorage.getItem(e);if(a&&[h,r].includes(a)){this.mode=a;this.permanent=true}if(this.permanent&&!a){localStorage.setItem(e,this.mode)}const l=[h,r].includes(a);if(this.permanent&&a){this.o()}else{if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches){this.mode=r;this.o()}if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches){this.mode=h;this.o()}}if(!this.permanent&&!l){window.matchMedia("(prefers-color-scheme: light)").onchange=t=>{this.mode=t.matches?h:r;this.o()};window.matchMedia("(prefers-color-scheme: dark)").onchange=t=>{this.mode=t.matches?r:h;this.o()}}const d=new MutationObserver(((s,h)=>{this.mode=t.documentElement.dataset.colorMode;if(this.permanent&&l){localStorage.setItem(e,this.mode);this.i(i,{permanent:this.permanent})}this.h();this.i(o,{colorScheme:this.mode})}));d.observe(t.documentElement,{attributes:true});this.i(o,{colorScheme:this.mode});this.h()}attributeChangedCallback(t,s,o){if(t==="mode"&&s!==o&&[h,r].includes(o)){const t=localStorage.getItem(e);if(this.mode===t){this.mode=o;this.h();this.o()}else if(this.mode&&this.mode!==t){this.h();this.o()}}else if((t===h||t===r)&&s!==o){this.h()}if(t==="permanent"&&typeof this.permanent==="boolean"){this.permanent?localStorage.setItem(e,this.mode):localStorage.removeItem(e)}}o(){t.documentElement.setAttribute("data-color-mode",this.mode)}h(){this.icon.textContent=this.mode===h?"🌒":"🌞";this.text.textContent=this.mode===h?this.getAttribute(r):this.getAttribute(h)}t(){var s=this.attachShadow({mode:"open"});this.label=t.createElement("span");this.label.setAttribute("class","wrapper");this.label.onclick=()=>{this.mode=this.mode===h?r:h;if(this.permanent){localStorage.setItem(e,this.mode)}this.o();this.h()};s.appendChild(this.label);this.icon=t.createElement("span");this.label.appendChild(this.icon);this.text=t.createElement("span");this.label.appendChild(this.text);const o=\`\n[data-color-mode*='dark'], [data-color-mode*='dark'] body {\n color-scheme: dark;\n --color-theme-bg: #0d1117;\n --color-theme-text: #c9d1d9;\n background-color: var(--color-theme-bg);\n color: var(--color-theme-text);\n}\n\n[data-color-mode*='light'], [data-color-mode*='light'] body {\n color-scheme: light;\n --color-theme-bg: #fff;\n --color-theme-text: #24292f;\n background-color: var(--color-theme-bg);\n color: var(--color-theme-text);\n}\`;const i="_dark_mode_style_";const n=t.getElementById(i);if(!n){var c=t.createElement("style");c.id=i;c.textContent=o;t.head.appendChild(c)}var a=t.createElement("style");a.textContent=\`\n .wrapper { cursor: pointer; user-select: none; position: relative; }\n .wrapper > span + span { margin-left: .4rem; }\n \`;s.appendChild(a)}i(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:true,composed:true,detail:e}))}}customElements.define("dark-mode",a);`;
|
|
2
|
+
/**
|
|
3
|
+
* @wcj/dark-mode@1.0.14
|
|
4
|
+
* https://github.com/jaywcjlove/dark-mode
|
|
5
|
+
*/
|
|
6
|
+
export function darkMode() {
|
|
7
|
+
return [{
|
|
8
|
+
type: 'element',
|
|
9
|
+
tagName: 'script',
|
|
10
|
+
// properties: {
|
|
11
|
+
// src: 'https://unpkg.com/@wcj/dark-mode',
|
|
12
|
+
// },
|
|
13
|
+
children: [{
|
|
14
|
+
type: 'text',
|
|
15
|
+
value: scriptString,
|
|
16
|
+
}]
|
|
17
|
+
}, {
|
|
18
|
+
type: 'element',
|
|
19
|
+
tagName: 'dark-mode',
|
|
20
|
+
properties: {
|
|
21
|
+
permanent: true,
|
|
22
|
+
style: 'position: fixed;top: 8px;left: 10px;',
|
|
23
|
+
dark: 'Dark',
|
|
24
|
+
light: 'Light',
|
|
25
|
+
},
|
|
26
|
+
children: []
|
|
27
|
+
}];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=dark-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dark-mode.js","sourceRoot":"","sources":["../../src/nodes/dark-mode.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAG,o8GAAo8G,CAAA;AAEz9G;;;GAGG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,CAAC;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,QAAQ;YACjB,gBAAgB;YAChB,6CAA6C;YAC7C,KAAK;YACL,QAAQ,EAAE,CAAC;oBACT,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY;iBACpB,CAAC;SACH,EAAE;YACD,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,WAAW;YACpB,UAAU,EAAE;gBACV,SAAS,EAAE,IAAI;gBACf,KAAK,EAAE,sCAAsC;gBAC7C,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,OAAO;aACf;YACD,QAAQ,EAAE,EAAE;SACb,CAAC,CAAA;AACJ,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const style = `.github-fork-ribbon {
|
|
2
|
+
width: 12.1em;
|
|
3
|
+
height: 12.1em;
|
|
4
|
+
position: absolute;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
top: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
z-index: 9999;
|
|
9
|
+
pointer-events: none;
|
|
10
|
+
font-size: 13px;
|
|
11
|
+
text-decoration: none;
|
|
12
|
+
text-indent: -999999px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.github-fork-ribbon.fixed {
|
|
16
|
+
position: fixed;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.github-fork-ribbon:hover, .github-fork-ribbon:active {
|
|
20
|
+
background-color: rgba(0, 0, 0, 0.0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.github-fork-ribbon:before, .github-fork-ribbon:after {
|
|
24
|
+
/* The right and left classes determine the side we attach our banner to */
|
|
25
|
+
position: absolute;
|
|
26
|
+
display: block;
|
|
27
|
+
width: 15.38em;
|
|
28
|
+
height: 1.54em;
|
|
29
|
+
|
|
30
|
+
top: 3.23em;
|
|
31
|
+
right: -3.23em;
|
|
32
|
+
|
|
33
|
+
-webkit-box-sizing: content-box;
|
|
34
|
+
-moz-box-sizing: content-box;
|
|
35
|
+
box-sizing: content-box;
|
|
36
|
+
|
|
37
|
+
-webkit-transform: rotate(45deg);
|
|
38
|
+
-moz-transform: rotate(45deg);
|
|
39
|
+
-ms-transform: rotate(45deg);
|
|
40
|
+
-o-transform: rotate(45deg);
|
|
41
|
+
transform: rotate(45deg);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.github-fork-ribbon:before {
|
|
45
|
+
content: "";
|
|
46
|
+
|
|
47
|
+
/* Add a bit of padding to give some substance outside the "stitching" */
|
|
48
|
+
padding: .38em 0;
|
|
49
|
+
|
|
50
|
+
/* Set the base colour */
|
|
51
|
+
background-color: #a00;
|
|
52
|
+
|
|
53
|
+
/* Set a gradient: transparent black at the top to almost-transparent black at the bottom */
|
|
54
|
+
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.15)));
|
|
55
|
+
background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
|
56
|
+
background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
|
57
|
+
background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
|
58
|
+
background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
|
59
|
+
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
|
60
|
+
|
|
61
|
+
/* Add a drop shadow */
|
|
62
|
+
-webkit-box-shadow: 0 .15em .23em 0 rgba(0, 0, 0, 0.5);
|
|
63
|
+
-moz-box-shadow: 0 .15em .23em 0 rgba(0, 0, 0, 0.5);
|
|
64
|
+
box-shadow: 0 .15em .23em 0 rgba(0, 0, 0, 0.5);
|
|
65
|
+
|
|
66
|
+
pointer-events: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.github-fork-ribbon:after {
|
|
70
|
+
/* Set the text from the data-ribbon attribute */
|
|
71
|
+
content: attr(data-ribbon);
|
|
72
|
+
|
|
73
|
+
/* Set the text properties */
|
|
74
|
+
color: #fff;
|
|
75
|
+
font: 700 1em "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
76
|
+
line-height: 1.54em;
|
|
77
|
+
text-decoration: none;
|
|
78
|
+
text-shadow: 0 -.08em rgba(0, 0, 0, 0.5);
|
|
79
|
+
text-align: center;
|
|
80
|
+
text-indent: 0;
|
|
81
|
+
|
|
82
|
+
/* Set the layout properties */
|
|
83
|
+
padding: .15em 0;
|
|
84
|
+
margin: .15em 0;
|
|
85
|
+
|
|
86
|
+
/* Add "stitching" effect */
|
|
87
|
+
border-width: .08em 0;
|
|
88
|
+
border-style: dotted;
|
|
89
|
+
border-color: #fff;
|
|
90
|
+
border-color: rgba(255, 255, 255, 0.7);
|
|
91
|
+
}`;
|
|
92
|
+
export function githubCornersFork(opts) {
|
|
93
|
+
const { href } = opts;
|
|
94
|
+
if (!href) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
type: 'element',
|
|
99
|
+
tagName: 'a',
|
|
100
|
+
properties: {
|
|
101
|
+
'aria-label': 'Fork me on Github',
|
|
102
|
+
title: 'Fork me on GitHub',
|
|
103
|
+
target: '__blank',
|
|
104
|
+
className: 'github-fork-ribbon',
|
|
105
|
+
'data-ribbon': 'Fork me on GitHub',
|
|
106
|
+
href,
|
|
107
|
+
},
|
|
108
|
+
children: [
|
|
109
|
+
{
|
|
110
|
+
type: 'element',
|
|
111
|
+
tagName: 'style',
|
|
112
|
+
children: [
|
|
113
|
+
{
|
|
114
|
+
type: 'text',
|
|
115
|
+
value: style
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=github-corners-fork.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-corners-fork.js","sourceRoot":"","sources":["../../src/nodes/github-corners-fork.ts"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0FZ,CAAC;AAMH,MAAM,UAAU,iBAAiB,CAAC,IAAmB;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,IAAI,EAAE;QACT,OAAO;KACR;IACD,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,GAAG;QACZ,UAAU,EAAE;YACV,YAAY,EAAE,mBAAmB;YACjC,KAAK,EAAE,mBAAmB;YAC1B,MAAM,EAAE,SAAS;YACjB,SAAS,EAAE,oBAAoB;YAC/B,aAAa,EAAE,mBAAmB;YAClC,IAAI;SACL;QACD,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,KAAK;qBACb;iBACF;aACF;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @uiw/github-corners@1.5.10
|
|
3
|
+
* https://github.com/uiwjs/react-github-corners
|
|
4
|
+
*/
|
|
5
|
+
const scriptString = `const TEMPLATE = document.createElement("template");
|
|
6
|
+
TEMPLATE.innerHTML = \`
|
|
7
|
+
<style>
|
|
8
|
+
:host a:hover .octo-arm {
|
|
9
|
+
animation: octocat-wave 560ms ease-in-out;
|
|
10
|
+
}
|
|
11
|
+
@keyframes octocat-wave {
|
|
12
|
+
0%, 100% {
|
|
13
|
+
transform: rotate(0);
|
|
14
|
+
}
|
|
15
|
+
20%, 60% {
|
|
16
|
+
transform: rotate(-25deg);
|
|
17
|
+
}
|
|
18
|
+
40%, 80% {
|
|
19
|
+
transform: rotate(10deg);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
@media (max-width:500px) {
|
|
23
|
+
:host a:hover .octo-arm {
|
|
24
|
+
animation: none;
|
|
25
|
+
}
|
|
26
|
+
:host .octo-arm {
|
|
27
|
+
animation: octocat-wave 560ms ease-in-out;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
31
|
+
<svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true" style="position: absolute; border: 0px; top: 0px;">
|
|
32
|
+
<a xlink:href="https://github.com/uiwjs/react-github-corners" target="_blank" rel="nofollow sponsored" style="fill: rgb(21, 21, 19); color: rgb(255, 255, 255);">
|
|
33
|
+
<g>
|
|
34
|
+
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
|
|
35
|
+
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" class="octo-arm" style="transform-origin: 130px 106px;"></path>
|
|
36
|
+
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
|
|
37
|
+
</g>
|
|
38
|
+
</a>
|
|
39
|
+
</svg>
|
|
40
|
+
\`;
|
|
41
|
+
export class GithubCorners extends HTMLElement {
|
|
42
|
+
constructor() {
|
|
43
|
+
super();
|
|
44
|
+
this.right = '0';
|
|
45
|
+
this.shadow = this.attachShadow({ mode: 'open' });
|
|
46
|
+
this.shadow.appendChild(this.ownerDocument.importNode(TEMPLATE.content, true));
|
|
47
|
+
this.update();
|
|
48
|
+
}
|
|
49
|
+
static get observedAttributes() {
|
|
50
|
+
return ['z-index', 'target', 'height', 'width', 'href', 'color', 'fill', 'position', 'top', 'left', 'right', 'bottom', 'transform'];
|
|
51
|
+
}
|
|
52
|
+
setAttr(name, value) {
|
|
53
|
+
const svg = this.shadow.querySelector('svg');
|
|
54
|
+
if (/(color|fill)/.test(name.toLocaleLowerCase())) {
|
|
55
|
+
svg.firstElementChild.style[name] = value;
|
|
56
|
+
} else
|
|
57
|
+
if (/(z-index|height|width|position|top|left|right|bottom|transform)/.test(name.toLocaleLowerCase())) {
|
|
58
|
+
svg.style[name] = value;
|
|
59
|
+
} else
|
|
60
|
+
{
|
|
61
|
+
svg.setAttribute(name, value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
update() {
|
|
65
|
+
;
|
|
66
|
+
[...this.getAttributeNames(), 'right'].forEach(name => {
|
|
67
|
+
const value = this.getAttribute(name) || this[name] || '';
|
|
68
|
+
this.setAttr(name, value);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
72
|
+
if (oldValue !== newValue) {
|
|
73
|
+
this.setAttr(name, newValue);
|
|
74
|
+
}
|
|
75
|
+
}}
|
|
76
|
+
|
|
77
|
+
customElements.define('github-corners', GithubCorners);`;
|
|
78
|
+
export function githubCorners(opts) {
|
|
79
|
+
const { href } = opts;
|
|
80
|
+
if (!href) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
return [
|
|
84
|
+
{
|
|
85
|
+
type: 'element',
|
|
86
|
+
tagName: 'github-corners',
|
|
87
|
+
properties: {
|
|
88
|
+
target: '__blank',
|
|
89
|
+
position: 'fixed',
|
|
90
|
+
href,
|
|
91
|
+
},
|
|
92
|
+
children: []
|
|
93
|
+
}, {
|
|
94
|
+
type: 'element',
|
|
95
|
+
tagName: 'script',
|
|
96
|
+
properties: {
|
|
97
|
+
type: 'module',
|
|
98
|
+
// src: 'https://unpkg.com/@uiw/github-corners?module',
|
|
99
|
+
},
|
|
100
|
+
children: [{
|
|
101
|
+
type: 'text',
|
|
102
|
+
value: scriptString,
|
|
103
|
+
}]
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=github-corners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-corners.js","sourceRoot":"","sources":["../../src/nodes/github-corners.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wDAwEmC,CAAC;AAEzD,MAAM,UAAU,aAAa,CAAC,IAAmB;IAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,IAAI,EAAE;QACT,OAAO;KACR;IACD,OAAO;QACL;YACE,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,gBAAgB;YACzB,UAAU,EAAE;gBACV,MAAM,EAAE,SAAS;gBACjB,QAAQ,EAAE,OAAO;gBACjB,IAAI;aACL;YACD,QAAQ,EAAE,EAAE;SACb,EAAE;YACD,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,QAAQ;YACjB,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,uDAAuD;aACxD;YACD,QAAQ,EAAE,CAAC;oBACT,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,YAAY;iBACpB,CAAC;SACH;KACF,CAAC;AACJ,CAAC"}
|