sve-ui 0.0.8 → 0.0.9
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.
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
export let typeCodeLabel = 'Sve-UI';
|
|
3
3
|
|
|
4
4
|
let copied = false;
|
|
5
|
-
let text = globalThis?.document?.getElementById('textCode')?.textContent;
|
|
6
|
-
|
|
7
5
|
const copyToClipboard = async () => {
|
|
8
6
|
try {
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const codeElement = document.querySelector('.code-box code');
|
|
8
|
+
if (codeElement) {
|
|
9
|
+
const text = codeElement.textContent;
|
|
10
|
+
text && (await navigator.clipboard.writeText(text));
|
|
11
11
|
copied = true;
|
|
12
12
|
setTimeout(() => {
|
|
13
13
|
copied = false;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
};
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
|
-
<
|
|
22
|
+
<pre class="code-box">
|
|
23
23
|
<article class="button-copy">
|
|
24
24
|
<span>{typeCodeLabel}</span>
|
|
25
25
|
<button on:click={copyToClipboard}>
|
|
@@ -46,36 +46,53 @@
|
|
|
46
46
|
</button>
|
|
47
47
|
</article>
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</pre>
|
|
54
|
-
</section>
|
|
49
|
+
<code id="textCode" class={copied ? 'textCode' : ''}>
|
|
50
|
+
<slot />
|
|
51
|
+
</code>
|
|
52
|
+
</pre>
|
|
55
53
|
|
|
56
54
|
<style>
|
|
57
55
|
.code-box {
|
|
58
56
|
background-color: #070606;
|
|
57
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
|
58
|
+
Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
59
59
|
border-radius: 4px;
|
|
60
60
|
max-width: 75ch;
|
|
61
|
-
border-top-left-radius: 0.375rem;
|
|
62
|
-
border-top-right-radius: 0.375rem;
|
|
63
61
|
margin: 0 auto;
|
|
62
|
+
color: #fffdfa;
|
|
63
|
+
position: relative;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.code-box
|
|
66
|
+
.code-box code {
|
|
67
67
|
font-size: 0.9rem;
|
|
68
68
|
font-family: 'Söhne Mono', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
69
|
-
|
|
69
|
+
display: block;
|
|
70
|
+
padding: 0 0.6rem;
|
|
71
|
+
overflow: auto;
|
|
72
|
+
transition: background-color 0.2s ease-in-out;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
.textCode {
|
|
73
76
|
background-color: #71c562;
|
|
77
|
+
transition: background-color 0.2s ease-in-out;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.button-copy {
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: space-between;
|
|
84
|
+
background-color: rgba(52, 53, 65, 0.6);
|
|
85
|
+
border-top-left-radius: 0.375rem;
|
|
86
|
+
border-top-right-radius: 0.375rem;
|
|
87
|
+
padding: 0.8rem;
|
|
88
|
+
position: absolute;
|
|
89
|
+
top: 0;
|
|
90
|
+
left: 0;
|
|
91
|
+
right: 0;
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
button {
|
|
77
95
|
display: flex;
|
|
78
|
-
margin-left: auto;
|
|
79
96
|
gap: 0.5rem;
|
|
80
97
|
cursor: pointer;
|
|
81
98
|
background-color: transparent;
|
|
@@ -94,15 +111,6 @@
|
|
|
94
111
|
border-radius: 4px;
|
|
95
112
|
}
|
|
96
113
|
|
|
97
|
-
.button-copy {
|
|
98
|
-
display: flex;
|
|
99
|
-
align-items: center;
|
|
100
|
-
background-color: rgba(52, 53, 65, 0.6);
|
|
101
|
-
border-top-left-radius: 0.375rem;
|
|
102
|
-
border-top-right-radius: 0.375rem;
|
|
103
|
-
padding: 0.8rem;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
114
|
@media only screen and (max-width: 768px) {
|
|
107
115
|
.code-box {
|
|
108
116
|
max-width: 100%;
|