@uiw/copy-to-clipboard 1.0.14 → 1.0.15
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 +2 -2
- package/dist/copy-to-clipboard.cjs.js +2 -1
- package/dist/copy-to-clipboard.esm.js +2 -1
- package/dist/copy-to-clipboard.umd.js +2 -1
- package/dist/copy-to-clipboard.umd.js.map +1 -1
- package/dist/copy-to-clipboard.umd.min.js +2 -2
- package/dist/copy-to-clipboard.umd.min.js.map +1 -1
- package/dist/css/copy.css +49 -0
- package/dist/css/demo-preview.css +62 -0
- package/dist/css/main.css +258 -0
- package/dist/css/media.css +52 -0
- package/dist/css/sidebar.css +41 -0
- package/dist/css/tocbot.css +52 -0
- package/dist/index.html +83 -177
- package/dist/js/copy.js +40 -0
- package/dist/js/dark-mode.js +162 -0
- package/dist/js/demo-preview.js +31 -0
- package/dist/js/markdown-style.js +1006 -0
- package/dist/js/tocbot.js +128 -0
- package/dist/sitemap.txt +1 -0
- package/package.json +1 -1
package/dist/index.html
CHANGED
|
@@ -1,195 +1,101 @@
|
|
|
1
|
-
<!doctype html
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<meta charset="
|
|
5
|
-
<
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
-
<
|
|
8
|
-
<meta
|
|
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
|
-
markdown-style
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
[data-color-mode*='light'], [data-color-mode*='light'] body, markdown-style[theme*='light'] { --color-prettylights-syntax-comment: #6e7781; --color-prettylights-syntax-constant: #0550ae; --color-prettylights-syntax-entity: #8250df; --color-prettylights-syntax-storage-modifier-import: #24292f; --color-prettylights-syntax-entity-tag: #116329; --color-prettylights-syntax-keyword: #cf222e; --color-prettylights-syntax-string: #0a3069; --color-prettylights-syntax-variable: #953800; --color-prettylights-syntax-brackethighlighter-unmatched: #82071e; --color-prettylights-syntax-invalid-illegal-text: #f6f8fa; --color-prettylights-syntax-invalid-illegal-bg: #82071e; --color-prettylights-syntax-carriage-return-text: #f6f8fa; --color-prettylights-syntax-carriage-return-bg: #cf222e; --color-prettylights-syntax-string-regexp: #116329; --color-prettylights-syntax-markup-list: #3b2300; --color-prettylights-syntax-markup-heading: #0550ae; --color-prettylights-syntax-markup-italic: #24292f; --color-prettylights-syntax-markup-bold: #24292f; --color-prettylights-syntax-markup-deleted-text: #82071e; --color-prettylights-syntax-markup-deleted-bg: #FFEBE9; --color-prettylights-syntax-markup-inserted-text: #116329; --color-prettylights-syntax-markup-inserted-bg: #dafbe1; --color-prettylights-syntax-markup-changed-text: #953800; --color-prettylights-syntax-markup-changed-bg: #ffd8b5; --color-prettylights-syntax-markup-ignored-text: #eaeef2; --color-prettylights-syntax-markup-ignored-bg: #0550ae; --color-prettylights-syntax-meta-diff-range: #8250df; --color-prettylights-syntax-brackethighlighter-angle: #57606a; --color-prettylights-syntax-sublimelinter-gutter-mark: #8c959f; --color-prettylights-syntax-constant-other-reference-link: #0a3069; --color-fg-default: #24292f; --color-fg-muted: #57606a; --color-fg-subtle: #6e7781; --color-canvas-default: #ffffff; --color-canvas-subtle: #f6f8fa; --color-border-default: #d0d7de; --color-border-muted: hsla(210,18%,87%,1); --color-neutral-muted: rgba(175,184,193,0.2); --color-accent-fg: #0969da; --color-accent-emphasis: #0969da; --color-attention-subtle: #fff8c5; --color-danger-fg: #cf222e; } [data-color-mode*='dark'], [data-color-mode*='dark'] body, markdown-style[theme*='dark'] { --color-prettylights-syntax-comment: #8b949e; --color-prettylights-syntax-constant: #79c0ff; --color-prettylights-syntax-entity: #d2a8ff; --color-prettylights-syntax-storage-modifier-import: #c9d1d9; --color-prettylights-syntax-entity-tag: #7ee787; --color-prettylights-syntax-keyword: #ff7b72; --color-prettylights-syntax-string: #a5d6ff; --color-prettylights-syntax-variable: #ffa657; --color-prettylights-syntax-brackethighlighter-unmatched: #f85149; --color-prettylights-syntax-invalid-illegal-text: #f0f6fc; --color-prettylights-syntax-invalid-illegal-bg: #8e1519; --color-prettylights-syntax-carriage-return-text: #f0f6fc; --color-prettylights-syntax-carriage-return-bg: #b62324; --color-prettylights-syntax-string-regexp: #7ee787; --color-prettylights-syntax-markup-list: #f2cc60; --color-prettylights-syntax-markup-heading: #1f6feb; --color-prettylights-syntax-markup-italic: #c9d1d9; --color-prettylights-syntax-markup-bold: #c9d1d9; --color-prettylights-syntax-markup-deleted-text: #ffdcd7; --color-prettylights-syntax-markup-deleted-bg: #67060c; --color-prettylights-syntax-markup-inserted-text: #aff5b4; --color-prettylights-syntax-markup-inserted-bg: #033a16; --color-prettylights-syntax-markup-changed-text: #ffdfb6; --color-prettylights-syntax-markup-changed-bg: #5a1e02; --color-prettylights-syntax-markup-ignored-text: #c9d1d9; --color-prettylights-syntax-markup-ignored-bg: #1158c7; --color-prettylights-syntax-meta-diff-range: #d2a8ff; --color-prettylights-syntax-brackethighlighter-angle: #8b949e; --color-prettylights-syntax-sublimelinter-gutter-mark: #484f58; --color-prettylights-syntax-constant-other-reference-link: #a5d6ff; --color-fg-default: #c9d1d9; --color-fg-muted: #8b949e; --color-fg-subtle: #484f58; --color-canvas-default: #0d1117; --color-canvas-subtle: #161b22; --color-border-default: #30363d; --color-border-muted: #21262d; --color-neutral-muted: rgba(110,118,129,0.4); --color-accent-fg: #58a6ff; --color-accent-emphasis: #1f6feb; --color-attention-subtle: rgba(187,128,9,0.15); --color-danger-fg: #f85149; } markdown-style { display: block; -webkit-text-size-adjust: 100%; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; font-size: 16px; line-height: 1.5; word-wrap: break-word; color: var(--color-fg-default); background-color: var(--color-canvas-default); } markdown-style details, markdown-style figcaption, markdown-style figure { display: block; } markdown-style summary { display: list-item; } markdown-style [hidden] { display: none !important; } markdown-style a { background-color: transparent; color: var(--color-accent-fg); text-decoration: none; } markdown-style a:active, markdown-style a:hover { outline-width: 0; } markdown-style abbr[title] { border-bottom: none; text-decoration: underline dotted; } markdown-style b, markdown-style strong { font-weight: 600; } markdown-style dfn { font-style: italic; } markdown-style h1 { margin: .67em 0; font-weight: 600; padding-bottom: .3em; font-size: 2em; border-bottom: 1px solid var(--color-border-muted); } markdown-style mark { background-color: var(--color-attention-subtle); color: var(--color-text-primary); } markdown-style small { font-size: 90%; } markdown-style sub, markdown-style sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } markdown-style sub { bottom: -0.25em; } markdown-style sup { top: -0.5em; } markdown-style img { border-style: none; max-width: 100%; box-sizing: content-box; background-color: var(--color-canvas-default); } markdown-style code, markdown-style kbd, markdown-style pre, markdown-style samp { font-family: monospace,monospace; font-size: 1em; } markdown-style figure { margin: 1em 40px; } markdown-style hr { box-sizing: content-box; overflow: hidden; background: transparent; border-bottom: 1px solid var(--color-border-muted); height: .25em; padding: 0; margin: 24px 0; background-color: var(--color-border-default); border: 0; } markdown-style input { font: inherit; margin: 0; overflow: visible; font-family: inherit; font-size: inherit; line-height: inherit; } markdown-style [type=button], markdown-style [type=reset], markdown-style [type=submit] { -webkit-appearance: button; } markdown-style [type=button]::-moz-focus-inner, markdown-style [type=reset]::-moz-focus-inner, markdown-style [type=submit]::-moz-focus-inner { border-style: none; padding: 0; } markdown-style [type=button]:-moz-focusring, markdown-style [type=reset]:-moz-focusring, markdown-style [type=submit]:-moz-focusring { outline: 1px dotted ButtonText; } markdown-style [type=checkbox], markdown-style [type=radio] { box-sizing: border-box; padding: 0; } markdown-style [type=number]::-webkit-inner-spin-button, markdown-style [type=number]::-webkit-outer-spin-button { height: auto; } markdown-style [type=search] { -webkit-appearance: textfield; outline-offset: -2px; } markdown-style [type=search]::-webkit-search-cancel-button, markdown-style [type=search]::-webkit-search-decoration { -webkit-appearance: none; } markdown-style ::-webkit-input-placeholder { color: inherit; opacity: .54; } markdown-style ::-webkit-file-upload-button { -webkit-appearance: button; font: inherit; } markdown-style a:hover { text-decoration: underline; } markdown-style hr::before { display: table; content: ""; } markdown-style hr::after { display: table; clear: both; content: ""; } markdown-style table { border-spacing: 0; border-collapse: collapse; display: block; width: max-content; max-width: 100%; overflow: auto; } markdown-style td, markdown-style th { padding: 0; } markdown-style details summary { cursor: pointer; } markdown-style details:not([open])>*:not(summary) { display: none !important; } markdown-style kbd { display: inline-block; padding: 3px 5px; font: 11px ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; line-height: 10px; color: var(--color-fg-default); vertical-align: middle; background-color: var(--color-canvas-subtle); border: solid 1px var(--color-neutral-muted); border-bottom-color: var(--color-neutral-muted); border-radius: 6px; box-shadow: inset 0 -1px 0 var(--color-neutral-muted); } markdown-style h1, markdown-style h2, markdown-style h3, markdown-style h4, markdown-style h5, markdown-style h6 { margin-top: 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.25; } markdown-style h2 { font-weight: 600; padding-bottom: .3em; font-size: 1.5em; border-bottom: 1px solid var(--color-border-muted); } markdown-style h3 { font-weight: 600; font-size: 1.25em; } markdown-style h4 { font-weight: 600; font-size: 1em; } markdown-style h5 { font-weight: 600; font-size: .875em; } markdown-style h6 { font-weight: 600; font-size: .85em; color: var(--color-fg-muted); } markdown-style p { margin-top: 0; margin-bottom: 10px; } markdown-style blockquote { margin: 0; padding: 0 1em; color: var(--color-fg-muted); border-left: .25em solid var(--color-border-default); } markdown-style ul, markdown-style ol { margin-top: 0; margin-bottom: 0; padding-left: 2em; } markdown-style ol ol, markdown-style ul ol { list-style-type: lower-roman; } markdown-style ul ul ol, markdown-style ul ol ol, markdown-style ol ul ol, markdown-style ol ol ol { list-style-type: lower-alpha; } markdown-style dd { margin-left: 0; } markdown-style tt, markdown-style code { font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; font-size: 12px; } markdown-style pre { margin-top: 0; margin-bottom: 0; font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; font-size: 12px; word-wrap: normal; } markdown-style .octicon { display: inline-block; overflow: visible !important; vertical-align: text-bottom; fill: currentColor; } markdown-style ::placeholder { color: var(--color-fg-subtle); opacity: 1; } markdown-style input::-webkit-outer-spin-button, markdown-style input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; appearance: none; }
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const style = Array.prototype.slice
|
|
59
|
-
.call(this.shadow.children)
|
|
60
|
-
.find((item) => item.tagName === 'STYLE');
|
|
61
|
-
if (style) {
|
|
62
|
-
const id = '__MARKDOWN_STYLE__';
|
|
63
|
-
const findStyle = document.getElementById(id);
|
|
64
|
-
if (!findStyle) {
|
|
65
|
-
style.id = id;
|
|
66
|
-
document.head.append(style);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
get theme() {
|
|
71
|
-
const value = this.getAttribute('theme');
|
|
72
|
-
return value === null ? '' : value;
|
|
73
|
-
}
|
|
74
|
-
set theme(name) {
|
|
75
|
-
this.setAttribute('theme', name);
|
|
76
|
-
}
|
|
77
|
-
connectedCallback() {
|
|
78
|
-
if (!this.theme) {
|
|
79
|
-
const { colorMode } = document.documentElement.dataset;
|
|
80
|
-
this.theme = colorMode;
|
|
81
|
-
const observer = new MutationObserver((mutationsList, observer) => {
|
|
82
|
-
this.theme = document.documentElement.dataset.colorMode;
|
|
83
|
-
});
|
|
84
|
-
observer.observe(document.documentElement, { attributes: true });
|
|
85
|
-
window.matchMedia('(prefers-color-scheme: light)').onchange = (event) => {
|
|
86
|
-
this.theme = event.matches ? 'light' : 'dark';
|
|
87
|
-
};
|
|
88
|
-
window.matchMedia('(prefers-color-scheme: dark)').onchange = (event) => {
|
|
89
|
-
this.theme = event.matches ? 'dark' : 'light';
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
customElements.define('markdown-style', MarkdownStyle);</script><markdown-style style="max-width: 960px; margin: 0 auto 60px auto; padding: 8px" class="markdown-style">
|
|
95
|
-
<h1 id="copy-text-to-clipboard"><a class="anchor" aria-hidden="true" tabindex="-1" href="#copy-text-to-clipboard"><span class="octicon octicon-link"></span></a>copy text to clipboard</h1>
|
|
96
|
-
<p>
|
|
97
|
-
<img src="http://jaywcjlove.github.io/sb/status/no-dependencies.svg" alt="No Dependencies">
|
|
98
|
-
<a href="https://www.npmjs.com/package/@uiw/copy-to-clipboard"><img src="https://img.shields.io/npm/dm/@uiw/copy-to-clipboard.svg?style=flat" alt="NPM Downloads"></a>
|
|
99
|
-
<a href="https://github.com/uiwjs/react-codemirror/actions"><img src="https://github.com/uiwjs/copy-to-clipboard/workflows/Build/badge.svg" alt="Build & Deploy"></a>
|
|
100
|
-
<a href="https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/copy-to-clipboard/file/README.md"><img src="https://img.shields.io/badge/Open%20in-unpkg-blue" alt="Open in unpkg"></a>
|
|
101
|
-
<a href="https://www.npmjs.com/package/@uiw/copy-to-clipboard"><img src="https://img.shields.io/npm/v/@uiw/copy-to-clipboard.svg" alt="npm version"></a>
|
|
102
|
-
<a href="https://github.com/jaywcjlove/rehype-rewrite/network/dependents"><img src="https://badgen.net/github/dependents-repo/uiwjs/copy-to-clipboard" alt="Repo Dependents"></a>
|
|
103
|
-
</p>
|
|
104
|
-
<p><strong>This styling is an extra step which is likely not required.</strong></p>
|
|
105
|
-
<p>Why is it here? To ensure:</p>
|
|
106
|
-
<ol>
|
|
107
|
-
<li>the element is able to have focus and selection.</li>
|
|
108
|
-
<li>if element was to <code>flash</code> render it has minimal visual impact.</li>
|
|
109
|
-
<li>less flakyness with selection and copying which <strong>might</strong> occur if the textarea element is not visible.</li>
|
|
110
|
-
</ol>
|
|
111
|
-
<p>The likelihood is the element won't even render, not even a flash, so some of these are just precautions. However in IE the element is visible whilst the popup box asking the user for permission for the web page to copy to the clipboard. Place in top-left corner of screen regardless of scroll position.</p>
|
|
112
|
-
<h2 id="usage"><a class="anchor" aria-hidden="true" tabindex="-1" href="#usage"><span class="octicon octicon-link"></span></a>Usage</h2>
|
|
113
|
-
<p>You will need Node.js installed on your system.</p>
|
|
114
|
-
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">npm</span> i @uiw/copy-to-clipboard
|
|
115
|
-
</span></code><div onclick="copied(this)" data-code="$ npm i @uiw/copy-to-clipboard
|
|
116
|
-
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
|
|
117
|
-
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line line-number" line="1"><span class="token keyword module">import</span> <span class="token imports">copyTextToClipboard</span> <span class="token keyword module">from</span> <span class="token string">'@uiw/copy-to-clipboard'</span><span class="token punctuation">;</span>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Copy Text to Clipboard Copy Text to Clipboard 1.0.15</title>
|
|
8
|
+
<meta name="description" content="Why is it here? To ensure:">
|
|
9
|
+
<meta name="keywords" content="copy,text,clipboard,browser,clipboard-copy,clipboard.js">
|
|
10
|
+
<link rel="stylesheet" type="text/css" href="css/main.css?v=1.26.6">
|
|
11
|
+
<link rel="stylesheet" type="text/css" href="css/tocbot.css?v=1.26.6">
|
|
12
|
+
<link rel="stylesheet" type="text/css" href="css/media.css?v=1.26.6">
|
|
13
|
+
<link rel="stylesheet" type="text/css" href="css/sidebar.css?v=1.26.6">
|
|
14
|
+
<link rel="stylesheet" type="text/css" href="css/copy.css?v=1.26.6">
|
|
15
|
+
<link rel="stylesheet" type="text/css" href="css/demo-preview.css?v=1.26.6">
|
|
16
|
+
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAEIlJREFUeF7tnXtwVNUdx3/n7kIe8sgTNEjLTMeAUrVUKB0U0f6D1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48fgdQ4AEJ1DeD/QDgCQQMePwescACA6h/B+oB0AIIGOH4PXOQBAdA7h/UA7AEACHT8Gr3MAgOgcwvuBdgCABDp+DF7nAADROYT3A+0AAAl0/Bi8zgEAonMI7wfaAQAS6PgxeJ0DAETnEN4PtAMAJNDxY/A6BwCIziG8H2gH/g8LPRyq8vuk8QAAAABJRU5ErkJggg==" type="image/x-icon">
|
|
17
|
+
<script src="js/copy.js?v=1.26.6"></script>
|
|
18
|
+
<script src="js/dark-mode.js?v=1.26.6"></script>
|
|
19
|
+
<script src="js/markdown-style.js?v=1.26.6"></script>
|
|
20
|
+
</head>
|
|
21
|
+
<body id="idoctotop"><a href="#idoctotop" class="gototop">top</a>
|
|
22
|
+
<header class="header">
|
|
23
|
+
<article class="inner warpper"><a class="logo" href="index.html"><img alt="Copy Text to Clipboard <sup>1.0.15</sup> logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAEIlJREFUeF7tnXtwVNUdx3/n7kIe8sgTNEjLTMeAUrVUKB0U0f6D1ZkKCqhBJKDSdjplHEnW6B8l0hZIQKBaq+KMQDvTOhYfnY5jpU7rg9pp0Y5aSysKA4SEAJJNIJjdkN3TOWuigcnuub97727u2fu9MzuJ7ve8vt/72XPP2XCvIBxwAA6kdUDAGzgAB9I7AEBwdsCBDA4AEJwecACA4ByAA84cwAzizDeUCogDACQgQWOYzhwAIM58Q6mAOABAAhI0hunMAQDizDeUCogDACQgQWOYzhwAIM58Q6mAOABAAhI0hunMAQDizDeUCogDACQgQWOYzhwAIM58Q6mAOABAAhI0hunMAQDizDeUCogDACQgQWOYzhwAIM58Q6mAOABAAhI0hunMgawC0tTU9DgRLRRCVDrrHqtUBxFFiSj1U0rZYVlWRzKZVP+v3bKsViJqi8fjbX19fa2NjY1JVu0BFG/atKlMSlmRSCQqhRAVRFQhpVRZqt9TP6WUJUR0wcBLCDHweyhHlm1PJBI7Hnzwwdez0V7WA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6FUtBznEagTe/Aks5X6JLeof++yPbiEwbbckAkrat7lo9525a4X8QGpHh751VJonc4jUCb3gG1kbGi4yUqT3SdI1LrDbXuwOGZA/tiZ3qvoh+N6+bUyAZEVV60LfqoFOLHnIagTe9AVd+ntKLjRbL6/5LofwVfpd+OnQvLvHRAyutjy0pf51bpCBDViJ2/yeJ2Jsj6ge+NWkaMp+0lN2V+UlKQjXIwdinEyvjSsY85KJrpn1/pqyt65tQsaSWXE4lvE8mp+hJQZHJg9mfv0fuFl9Ap6wIY5d6B16VaCoTEU/ElYz9xWp3jGcRpg/lSrnBH559IkinXQaditSVj88X7XI4DgDh0u/A3p2ZTIvmmw+K5LeZg/z+3HfRvawDERTYF26MvChLzXFSRg6LiP7HasV/PQUN52QQAcRFr8Y7otKQULxHRV1xUk9WiQtKinmUlv89qI3lcOQBxGW7hM53fIYv+SETFLqvyvDjgcG8pAHHvIRX9OnpLUorFQtK1RFThQZXOq5B0jAT9VUh6ATOHcxsHSgIQ9x6eU0PqsitJw7JjlLRGdPQuHfWBx0MKdHUAJNDxY/A6BwCIziG8H2gHAEig48fgdQ4AEJ1DeD/QDgCQQMePwescACA6h/B+oB0AIIGOH4PXOQBAdA7h/UA7AEACHT8Gr3MAgOgcwvuBdgCABDp+DF7nAADROYT3A+0AAAl0/Bi8zgEAonMI7wfaAQAS6PgxeJ0DAETnEN4PtAMAJNDxY/A6BwCIziG8H2gH/g8LPRyq8vuk8QAAAABJRU5ErkJggg==">
|
|
24
|
+
<span class="title">Copy Text to Clipboard <sup>1.0.15</sup></span></a>
|
|
25
|
+
<div class="content">
|
|
26
|
+
<ul class="menu"></ul><a href="https://github.com/uiwjs/copy-to-clipboard.git" target="_blank" rel="noopener noreferrer" title="Github" name="Github" class="github"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
27
|
+
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
|
|
28
|
+
</svg></a>
|
|
29
|
+
<dark-mode permanent=""></dark-mode>
|
|
30
|
+
</div>
|
|
31
|
+
</article>
|
|
32
|
+
</header>
|
|
33
|
+
<div class="warpper-content warpper">
|
|
34
|
+
<markdown-style>
|
|
35
|
+
<h1 id="copy-text-to-clipboard"><a aria-hidden="true" tabindex="-1" href="#copy-text-to-clipboard" class="anchor"><span class="icon icon-link"></span></a>Copy Text to Clipboard</h1>
|
|
36
|
+
<p>
|
|
37
|
+
<img src="http://jaywcjlove.github.io/sb/status/no-dependencies.svg" alt="No Dependencies">
|
|
38
|
+
<a href="https://www.npmjs.com/package/@uiw/copy-to-clipboard"><img src="https://img.shields.io/npm/dm/@uiw/copy-to-clipboard.svg?style=flat" alt="NPM Downloads"></a>
|
|
39
|
+
<a href="https://github.com/uiwjs/react-codemirror/actions"><img src="https://github.com/uiwjs/copy-to-clipboard/workflows/Build/badge.svg" alt="Build & Deploy"></a>
|
|
40
|
+
<a href="https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/copy-to-clipboard/file/README.md"><img src="https://img.shields.io/badge/Open%20in-unpkg-blue" alt="Open in unpkg"></a>
|
|
41
|
+
<a href="https://www.npmjs.com/package/@uiw/copy-to-clipboard"><img src="https://img.shields.io/npm/v/@uiw/copy-to-clipboard.svg" alt="npm version"></a>
|
|
42
|
+
<a href="https://github.com/uiwjs/copy-to-clipboard/network/dependents"><img src="https://badgen.net/github/dependents-repo/uiwjs/copy-to-clipboard" alt="Repo Dependents"></a>
|
|
43
|
+
</p>
|
|
44
|
+
<p><strong>This styling is an extra step which is likely not required.</strong></p>
|
|
45
|
+
<p>Why is it here? To ensure:</p>
|
|
46
|
+
<ol>
|
|
47
|
+
<li>the element is able to have focus and selection.</li>
|
|
48
|
+
<li>if element was to <code>flash</code> render it has minimal visual impact.</li>
|
|
49
|
+
<li>less flakyness with selection and copying which <strong>might</strong> occur if the textarea element is not visible.</li>
|
|
50
|
+
</ol>
|
|
51
|
+
<p>The likelihood is the element won't even render, not even a flash, so some of these are just precautions. However in IE the element is visible whilst the popup box asking the user for permission for the web page to copy to the clipboard. Place in top-left corner of screen regardless of scroll position.</p>
|
|
52
|
+
<h2 id="usage"><a aria-hidden="true" tabindex="-1" href="#usage" class="anchor"><span class="icon icon-link"></span></a>Usage</h2>
|
|
53
|
+
<p>You will need Node.js installed on your system.</p>
|
|
54
|
+
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">npm</span> i @uiw/copy-to-clipboard
|
|
55
|
+
</span></code><input type="hidden" value="$ npm i @uiw/copy-to-clipboard
|
|
56
|
+
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
|
|
57
|
+
<pre class="language-js"><code class="language-js code-highlight"><span class="code-line line-number" line="1"><span class="token keyword module">import</span> <span class="token imports">copyTextToClipboard</span> <span class="token keyword module">from</span> <span class="token string">'@uiw/copy-to-clipboard'</span><span class="token punctuation">;</span>
|
|
118
58
|
</span><span class="code-line line-number" line="2">
|
|
119
59
|
</span><span class="code-line line-number" line="3"><span class="token function">copyTextToClipboard</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">isCopy</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
|
120
60
|
</span><span class="code-line line-number" line="4"> <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">'isCopy:'</span><span class="token punctuation">,</span> isCopy<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
|
121
61
|
</span><span class="code-line line-number" line="5"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
|
122
|
-
</span></code><
|
|
62
|
+
</span></code><input type="hidden" value="import copyTextToClipboard from '@uiw/copy-to-clipboard';
|
|
123
63
|
|
|
124
64
|
copyTextToClipboard('test', (isCopy) => {
|
|
125
65
|
console.log('isCopy:', isCopy);
|
|
126
66
|
});
|
|
127
|
-
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
|
|
128
|
-
|
|
129
|
-
|
|
67
|
+
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
|
|
68
|
+
<p>Or manually download and link <a href="https://unpkg.com/@uiw/copy-to-clipboard/dist/">copy-to-clipboard</a> in your HTML, It can also be downloaded via <a href="https://unpkg.com/@uiw/copy-to-clipboard/dist/">UNPKG</a>:</p>
|
|
69
|
+
<pre class="language-html"><code class="language-html code-highlight"><span class="code-line line-number" line="1"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://unpkg.com/@uiw/copy-to-clipboard/dist/copy-to-clipboard.umd.js<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token script"></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>
|
|
130
70
|
</span><span class="code-line line-number" line="2"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>text/javascript<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token script"><span class="token language-javascript">
|
|
131
71
|
</span></span></span><span class="code-line line-number" line="3"><span class="token script"><span class="token language-javascript"><span class="token function">copyTextToClipboard</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">isCopy</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
|
132
72
|
</span></span></span><span class="code-line line-number" line="4"><span class="token script"><span class="token language-javascript"> <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">'isCopy:'</span><span class="token punctuation">,</span> isCopy<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
|
133
73
|
</span></span></span><span class="code-line line-number" line="5"><span class="token script"><span class="token language-javascript"><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
|
134
74
|
</span></span></span><span class="code-line line-number" line="6"><span class="token script"><span class="token language-javascript"></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span>
|
|
135
|
-
</span></code><
|
|
75
|
+
</span></code><input type="hidden" value="<script src="https://unpkg.com/@uiw/copy-to-clipboard/dist/copy-to-clipboard.umd.js"></script>
|
|
136
76
|
<script type="text/javascript">
|
|
137
77
|
copyTextToClipboard('test', (isCopy) => {
|
|
138
78
|
console.log('isCopy:', isCopy);
|
|
139
79
|
});
|
|
140
80
|
</script>
|
|
141
|
-
" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
markdown-style pre:hover .copied:hover {
|
|
164
|
-
background: #4caf50;
|
|
165
|
-
color: #fff;
|
|
166
|
-
}
|
|
167
|
-
markdown-style pre:hover .copied:active,
|
|
168
|
-
markdown-style pre .copied.active {
|
|
169
|
-
background: #2e9b33;
|
|
170
|
-
color: #fff;
|
|
171
|
-
}
|
|
172
|
-
markdown-style pre .copied .octicon-copy {
|
|
173
|
-
display: block;
|
|
174
|
-
}
|
|
175
|
-
markdown-style pre .copied .octicon-check {
|
|
176
|
-
display: none;
|
|
177
|
-
}
|
|
178
|
-
markdown-style pre .active .octicon-copy {
|
|
179
|
-
display: none;
|
|
180
|
-
}
|
|
181
|
-
markdown-style pre .active .octicon-check {
|
|
182
|
-
display: block;
|
|
183
|
-
}</style><script>/*! @uiw/copy-to-clipboard v1.0.12 | MIT (c) 2021 Kenny Wang | https://github.com/uiwjs/copy-to-clipboard.git */
|
|
184
|
-
!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)}}));
|
|
185
|
-
|
|
186
|
-
function copied(target, str) {
|
|
187
|
-
target.classList.add('active');
|
|
188
|
-
copyTextToClipboard(target.dataset.code, function() {
|
|
189
|
-
setTimeout(() => {
|
|
190
|
-
target.classList.remove('active');
|
|
191
|
-
}, 2000);
|
|
192
|
-
});
|
|
193
|
-
}</script></markdown-style>
|
|
194
|
-
|
|
195
|
-
</body></html>
|
|
81
|
+
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
|
|
82
|
+
<h3 id="license"><a aria-hidden="true" tabindex="-1" href="#license" class="anchor"><span class="icon icon-link"></span></a>License</h3>
|
|
83
|
+
<p>Licensed under the MIT License.</p>
|
|
84
|
+
</markdown-style>
|
|
85
|
+
<nav class="tocs">
|
|
86
|
+
<aside class="inner toc">
|
|
87
|
+
<ol class="tocs-list">
|
|
88
|
+
<li><a href="#usage" class="tocs-link">Usage</a>
|
|
89
|
+
<ol class="tocs-list is-collapsed">
|
|
90
|
+
<li><a href="#license" class="tocs-link">License</a></li>
|
|
91
|
+
</ol>
|
|
92
|
+
</li>
|
|
93
|
+
</ol>
|
|
94
|
+
</aside>
|
|
95
|
+
</nav>
|
|
96
|
+
</div>
|
|
97
|
+
<script src="js/demo-preview.js?v=1.26.6"></script>
|
|
98
|
+
<div class="footer warpper">Released under the MIT License. Copyright © 2023 Kenny Wong<br>Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a> v1.26.6</div>
|
|
99
|
+
<script src="js/tocbot.js?v=1.26.6"></script>
|
|
100
|
+
</body>
|
|
101
|
+
</html>
|
package/dist/js/copy.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://github.com/uiwjs/copy-to-clipboard/blob/master/src/main.js
|
|
3
|
+
*/
|
|
4
|
+
function copyTextToClipboard(text, cb) {
|
|
5
|
+
const el = document.createElement('textarea');
|
|
6
|
+
el.value = text;
|
|
7
|
+
el.setAttribute('readonly', '');
|
|
8
|
+
el.style = {
|
|
9
|
+
position: 'absolute',
|
|
10
|
+
left: '-9999px',
|
|
11
|
+
}
|
|
12
|
+
document.body.appendChild(el);
|
|
13
|
+
const selected = document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false;
|
|
14
|
+
el.select();
|
|
15
|
+
let isCopy = false;
|
|
16
|
+
try {
|
|
17
|
+
const successful = document.execCommand('copy');
|
|
18
|
+
isCopy = !!successful;
|
|
19
|
+
} catch (err) {
|
|
20
|
+
isCopy = false;
|
|
21
|
+
}
|
|
22
|
+
document.body.removeChild(el);
|
|
23
|
+
if (selected && document.getSelection) {
|
|
24
|
+
document.getSelection().removeAllRanges();
|
|
25
|
+
document.getSelection().addRange(selected);
|
|
26
|
+
}
|
|
27
|
+
cb && cb(isCopy);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function copied(target, str) {
|
|
31
|
+
target.classList.add('active');
|
|
32
|
+
const input = target.parentElement.querySelector('input');
|
|
33
|
+
if (input) {
|
|
34
|
+
copyTextToClipboard(input.value || '', function() {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
target.classList.remove('active');
|
|
37
|
+
}, 2000);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @package @wcj/dark-mode@1.0.14
|
|
3
|
+
* Web Component that toggles dark mode 🌒
|
|
4
|
+
* Github: https://github.com/jaywcjlove/dark-mode.git
|
|
5
|
+
* Website: https://jaywcjlove.github.io/dark-mode
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT license.
|
|
8
|
+
* @license Copyright © 2022. Licensed under the MIT License
|
|
9
|
+
* @author kenny wong <wowohoo@qq.com>
|
|
10
|
+
*/
|
|
11
|
+
const t = document;
|
|
12
|
+
const e = '_dark_mode_theme_';
|
|
13
|
+
const s = 'permanent';
|
|
14
|
+
const o = 'colorschemechange';
|
|
15
|
+
const i = 'permanentcolorscheme';
|
|
16
|
+
const h = 'light';
|
|
17
|
+
const r = 'dark';
|
|
18
|
+
const n = (t, e, s = e) => {
|
|
19
|
+
Object.defineProperty(t, s, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get() {
|
|
22
|
+
const t = this.getAttribute(e);
|
|
23
|
+
return t === null ? '' : t;
|
|
24
|
+
},
|
|
25
|
+
set(t) {
|
|
26
|
+
this.setAttribute(e, t);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const c = (t, e, s = e) => {
|
|
31
|
+
Object.defineProperty(t, s, {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get() {
|
|
34
|
+
return this.hasAttribute(e);
|
|
35
|
+
},
|
|
36
|
+
set(t) {
|
|
37
|
+
if (t) {
|
|
38
|
+
this.setAttribute(e, '');
|
|
39
|
+
} else {
|
|
40
|
+
this.removeAttribute(e);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
class a extends HTMLElement {
|
|
46
|
+
static get observedAttributes() {
|
|
47
|
+
return ['mode', h, r, s];
|
|
48
|
+
}
|
|
49
|
+
LOCAL_NANE = e;
|
|
50
|
+
constructor() {
|
|
51
|
+
super();
|
|
52
|
+
this.t();
|
|
53
|
+
}
|
|
54
|
+
connectedCallback() {
|
|
55
|
+
n(this, 'mode');
|
|
56
|
+
n(this, r);
|
|
57
|
+
n(this, h);
|
|
58
|
+
c(this, s);
|
|
59
|
+
const a = localStorage.getItem(e);
|
|
60
|
+
if (a && [h, r].includes(a)) {
|
|
61
|
+
this.mode = a;
|
|
62
|
+
this.permanent = true;
|
|
63
|
+
}
|
|
64
|
+
if (this.permanent && !a) {
|
|
65
|
+
localStorage.setItem(e, this.mode);
|
|
66
|
+
}
|
|
67
|
+
const l = [h, r].includes(a);
|
|
68
|
+
if (this.permanent && a) {
|
|
69
|
+
this.o();
|
|
70
|
+
} else {
|
|
71
|
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
72
|
+
this.mode = r;
|
|
73
|
+
this.o();
|
|
74
|
+
}
|
|
75
|
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) {
|
|
76
|
+
this.mode = h;
|
|
77
|
+
this.o();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!this.permanent && !l) {
|
|
81
|
+
window.matchMedia('(prefers-color-scheme: light)').onchange = (t) => {
|
|
82
|
+
this.mode = t.matches ? h : r;
|
|
83
|
+
this.o();
|
|
84
|
+
};
|
|
85
|
+
window.matchMedia('(prefers-color-scheme: dark)').onchange = (t) => {
|
|
86
|
+
this.mode = t.matches ? r : h;
|
|
87
|
+
this.o();
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const d = new MutationObserver((s, h) => {
|
|
91
|
+
this.mode = t.documentElement.dataset.colorMode;
|
|
92
|
+
if (this.permanent && l) {
|
|
93
|
+
localStorage.setItem(e, this.mode);
|
|
94
|
+
this.i(i, { permanent: this.permanent });
|
|
95
|
+
}
|
|
96
|
+
this.h();
|
|
97
|
+
this.i(o, { colorScheme: this.mode });
|
|
98
|
+
});
|
|
99
|
+
d.observe(t.documentElement, { attributes: true });
|
|
100
|
+
this.i(o, { colorScheme: this.mode });
|
|
101
|
+
this.h();
|
|
102
|
+
}
|
|
103
|
+
attributeChangedCallback(t, s, o) {
|
|
104
|
+
if (t === 'mode' && s !== o && [h, r].includes(o)) {
|
|
105
|
+
const t = localStorage.getItem(e);
|
|
106
|
+
if (this.mode === t) {
|
|
107
|
+
this.mode = o;
|
|
108
|
+
this.h();
|
|
109
|
+
this.o();
|
|
110
|
+
} else if (this.mode && this.mode !== t) {
|
|
111
|
+
this.h();
|
|
112
|
+
this.o();
|
|
113
|
+
}
|
|
114
|
+
} else if ((t === h || t === r) && s !== o) {
|
|
115
|
+
this.h();
|
|
116
|
+
}
|
|
117
|
+
if (t === 'permanent' && typeof this.permanent === 'boolean') {
|
|
118
|
+
this.permanent ? localStorage.setItem(e, this.mode) : localStorage.removeItem(e);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
o() {
|
|
122
|
+
t.documentElement.setAttribute('data-color-mode', this.mode);
|
|
123
|
+
}
|
|
124
|
+
h() {
|
|
125
|
+
this.icon.textContent = this.mode === h ? '🌒' : '🌞';
|
|
126
|
+
this.text.textContent = this.mode === h ? this.getAttribute(r) : this.getAttribute(h);
|
|
127
|
+
}
|
|
128
|
+
t() {
|
|
129
|
+
var s = this.attachShadow({ mode: 'open' });
|
|
130
|
+
this.label = t.createElement('span');
|
|
131
|
+
this.label.setAttribute('class', 'wrapper');
|
|
132
|
+
this.label.onclick = () => {
|
|
133
|
+
this.mode = this.mode === h ? r : h;
|
|
134
|
+
if (this.permanent) {
|
|
135
|
+
localStorage.setItem(e, this.mode);
|
|
136
|
+
}
|
|
137
|
+
this.o();
|
|
138
|
+
this.h();
|
|
139
|
+
};
|
|
140
|
+
s.appendChild(this.label);
|
|
141
|
+
this.icon = t.createElement('span');
|
|
142
|
+
this.label.appendChild(this.icon);
|
|
143
|
+
this.text = t.createElement('span');
|
|
144
|
+
this.label.appendChild(this.text);
|
|
145
|
+
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}`;
|
|
146
|
+
const i = '_dark_mode_style_';
|
|
147
|
+
const n = t.getElementById(i);
|
|
148
|
+
if (!n) {
|
|
149
|
+
var c = t.createElement('style');
|
|
150
|
+
c.id = i;
|
|
151
|
+
c.textContent = o;
|
|
152
|
+
t.head.appendChild(c);
|
|
153
|
+
}
|
|
154
|
+
var a = t.createElement('style');
|
|
155
|
+
a.textContent = `\n .wrapper { cursor: pointer; user-select: none; position: relative; }\n .wrapper > span + span { margin-left: .4rem; }\n `;
|
|
156
|
+
s.appendChild(a);
|
|
157
|
+
}
|
|
158
|
+
i(t, e) {
|
|
159
|
+
this.dispatchEvent(new CustomEvent(t, { bubbles: true, composed: true, detail: e }));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
customElements.define('dark-mode', a);
|