single-file-core 1.6.4 → 1.6.5

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/core/infobar.js CHANGED
@@ -68,26 +68,6 @@ const INFOBAR_STYLES = `
68
68
  border-color: #eee;
69
69
  border-radius: 16px;
70
70
  z-index: 2147483647;
71
- animation-name: flash;
72
- animation-duration: .5s;
73
- animation-timing-function: cubic-bezier(0.39, 0.58, 0.57, 1);
74
- animation-delay: 1s;
75
- animation-iteration-count: 2;
76
- }
77
-
78
- .infobar:not(:focus-within):not(.infobar-focus)::after {
79
- content: "";
80
- position: absolute;
81
- inset: -2px;
82
- border: 2px solid #dd6a00;
83
- border-radius: inherit;
84
- opacity: 0;
85
- pointer-events: none;
86
- animation-name: ripple;
87
- animation-duration: 3s;
88
- animation-timing-function: ease-out;
89
- animation-delay: 2s;
90
- animation-iteration-count: 3;
91
71
  }
92
72
 
93
73
  .infobar:valid, .infobar:not(:focus-within):not(.infobar-focus) .infobar-content {
@@ -139,33 +119,6 @@ const INFOBAR_STYLES = `
139
119
  min-block-size: 24px;
140
120
  }
141
121
 
142
- @keyframes flash {
143
- 0%, 100% {
144
- background-color: #737373;
145
- }
146
- 50% {
147
- background-color: #dd6a00;
148
- }
149
- }
150
-
151
- @keyframes ripple {
152
- 0% {
153
- transform: scale(1);
154
- opacity: 1;
155
- }
156
- 45%, 100% {
157
- transform: scale(2);
158
- opacity: 0;
159
- }
160
- }
161
-
162
- @media (prefers-reduced-motion: reduce) {
163
- .infobar,
164
- .infobar:not(:focus-within):not(.infobar-focus)::after {
165
- animation-name: none;
166
- }
167
- }
168
-
169
122
  .infobar:focus-within .infobar-icon, .infobar.infobar-focus .infobar-icon {
170
123
  z-index: -1;
171
124
  background-image: none;
@@ -195,6 +148,57 @@ const INFOBAR_STYLES = `
195
148
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAgMAAADXB5lNAAABhmlDQ1BJQ0MgcHJvZmlsZQAAKJF9kj1Iw0AYht+mSkUrDnYQcchQnSyIijqWKhbBQmkrtOpgcukfNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEydFJ0UVK/C4ptIjx4LiH9+59+e67A4RGhalm1wSgapaRisfEbG5VDLyiDwEAvZiVmKkn0osZeI6ve/j4ehfhWd7n/hz9St5kgE8kjjLdsIg3iGc2LZ3zPnGIlSSF+Jx43KACiR+5Lrv8xrnosMAzQ0YmNU8cIhaLHSx3MCsZKvE0cVhRNcoXsi4rnLc4q5Uaa9XJbxjMaytprtMcQRxLSCAJETJqKKMCCxFaNVJMpGg/5uEfdvxJcsnkKoORYwFVqJAcP/gb/O6tWZiadJOCMaD7xbY/RoHALtCs2/b3sW03TwD/M3Cltf3VBjD3SXq9rYWPgIFt4OK6rcl7wOUOMPSkS4bkSH6aQqEAvJ/RM+WAwVv6EGtu31r7OH0AMtSr5Rvg4BAYK1L2use9ezr79u+ZVv9+AFlNcp0UUpiqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AsHAB8VC4EQ6QAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAAJUExURQAAAICHi4qKioTuJAkAAAABdFJOUwBA5thmAAAAAWJLR0QCZgt8ZAAAAJtJREFUOI3NkrsBgCAMRLFwBPdxBArcfxXFkO8rbKWAAJfHJ9faf9vuYX/749T5NmShm3bEwbe2SxeuM4+2oxDL1cDoKtVUjRy+tH78Cv2CS+wIiQNC1AEhk4AQeUTMWUJMfUJMSEJMSEY8kIx4IONroaYAimNxsXp1PA7PxwfVL8QnowwoVC0lig07wDDVUjAdbAnjwtow/z/bDW7eI4M2KruJAAAAAElFTkSuQmCC);
196
149
  }
197
150
  `;
151
+ const INFOBAR_ANIMATIONS_STYLES = `
152
+ .infobar {
153
+ animation-name: flash;
154
+ animation-duration: .5s;
155
+ animation-timing-function: cubic-bezier(0.39, 0.58, 0.57, 1);
156
+ animation-delay: 1s;
157
+ animation-iteration-count: 2;
158
+ }
159
+
160
+ .infobar:not(:focus-within):not(.infobar-focus)::after {
161
+ content: "";
162
+ position: absolute;
163
+ inset: -2px;
164
+ border: 2px solid #dd6a00;
165
+ border-radius: inherit;
166
+ opacity: 0;
167
+ pointer-events: none;
168
+ animation-name: ripple;
169
+ animation-duration: 3s;
170
+ animation-timing-function: ease-out;
171
+ animation-delay: 2s;
172
+ animation-iteration-count: 3;
173
+ }
174
+
175
+ @keyframes flash {
176
+ 0%, 100% {
177
+ background-color: #737373;
178
+ }
179
+ 50% {
180
+ background-color: #dd6a00;
181
+ }
182
+ }
183
+
184
+ @keyframes ripple {
185
+ 0% {
186
+ transform: scale(1);
187
+ opacity: 1;
188
+ }
189
+ 45%, 100% {
190
+ transform: scale(2);
191
+ opacity: 0;
192
+ }
193
+ }
194
+
195
+ @media (prefers-reduced-motion: reduce) {
196
+ .infobar,
197
+ .infobar:not(:focus-within):not(.infobar-focus)::after {
198
+ animation-name: none;
199
+ }
200
+ }
201
+ `;
198
202
 
199
203
  export { displayIcon, appendInfobar, refreshInfobarInfo, extractInfobarData, INFOBAR_TAGNAME };
200
204
 
@@ -221,6 +225,9 @@ function appendInfobar(doc, options, useShadowRoot) {
221
225
  const shadowRootContent = doc.createElement("div");
222
226
  const styleElement = doc.createElement("style");
223
227
  styleElement.textContent = INFOBAR_STYLES;
228
+ if (options.animateInfobar) {
229
+ styleElement.textContent += INFOBAR_ANIMATIONS_STYLES;
230
+ }
224
231
  if (options.infobarPositionAbsolute) {
225
232
  styleElement.textContent += ".infobar { position: absolute; }";
226
233
  const parentElementStyle = getComputedStyle(parentElement);
@@ -332,6 +339,7 @@ function displayIcon(doc, useShadowRoot, options = {}) {
332
339
  const infoData = extractInfobarData(doc);
333
340
  if (infoData.saveUrl) {
334
341
  infoData.openInfobar = options.openInfobar;
342
+ infoData.animateInfobar = options.animateInfobar;
335
343
  infoData.infobarPositionAbsolute = options.infobarPositionAbsolute;
336
344
  infoData.infobarPositionTop = options.infobarPositionTop;
337
345
  infoData.infobarPositionRight = options.infobarPositionRight;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -54,7 +54,7 @@ import { appendInfobar, refreshInfobarInfo, extractInfobarData } from "./core/in
54
54
  }
55
55
 
56
56
  async function displayIcon() {
57
- let options = { displayInfobar: true };
57
+ let options = { displayInfobar: true, animateInfobar: true };
58
58
  const infoData = extractInfobarData(document);
59
59
  if (infoData && infoData.saveUrl) {
60
60
  if (browser && browser.runtime && browser.runtime.sendMessage) {
@@ -67,6 +67,7 @@ import { appendInfobar, refreshInfobarInfo, extractInfobarData } from "./core/in
67
67
  }
68
68
  if (options.displayInfobar) {
69
69
  infoData.openInfobar = options.openInfobar;
70
+ infoData.animateInfobar = options.animateInfobar;
70
71
  infoData.infobarPositionAbsolute = options.infobarPositionAbsolute;
71
72
  infoData.infobarPositionTop = options.infobarPositionTop;
72
73
  infoData.infobarPositionRight = options.infobarPositionRight;