visualci-gallery 0.2.0 → 0.2.2

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/dist/gallery.css CHANGED
@@ -47,20 +47,26 @@
47
47
  .vg :where(h1, h2, h3, h4, h5, h6, p, ul, li) {
48
48
  margin: 0;
49
49
  }
50
- /* A host page's article styles (`.content h2 { margin: … }`, `.content ul { padding-left: … }`, `.content li + li`)
51
- * outrank an element reset, so each of the gallery's own elements is set again by class, inside .vg. */
52
- .vg .vg-title,
53
- .vg .vg-group-title,
54
- .vg .vg-card,
55
- .vg .vg-card-title,
56
- .vg .vg-caption,
57
- .vg .vg-box-title,
58
- .vg .vg-see-all,
59
- .vg .vg-credit {
50
+ /* A host page's article styles outrank an element reset: `.content h2 { margin: … }` and `.content li + li`, and
51
+ * docs themes' heavier ones, such as Material for MkDocs' `[dir="ltr"] .md-typeset ul li` (0,2,2) and
52
+ * `.md-typeset ul:not([hidden]) { display: flow-root }`, or VitePress's `.vp-doc h2 { border-top: … }`. So each of the
53
+ * gallery's own elements is set again by class at (0,3,0), `.vg[data-vg] .vg-…`, and every rule that sets their box
54
+ * or type again is at that weight too. */
55
+ .vg[data-vg] .vg-title,
56
+ .vg[data-vg] .vg-group-title,
57
+ .vg[data-vg] .vg-card,
58
+ .vg[data-vg] .vg-card-title,
59
+ .vg[data-vg] .vg-caption,
60
+ .vg[data-vg] .vg-box-title,
61
+ .vg[data-vg] .vg-see-all,
62
+ .vg[data-vg] .vg-credit {
60
63
  margin: 0;
61
64
  padding: 0;
65
+ border: 0;
66
+ letter-spacing: normal;
62
67
  }
63
- .vg .vg-grid {
68
+ .vg[data-vg] .vg-grid {
69
+ display: grid;
64
70
  margin: 0;
65
71
  padding: 0;
66
72
  list-style: none;
@@ -70,7 +76,7 @@
70
76
  overflow-wrap: anywhere;
71
77
  }
72
78
 
73
- .vg .vg-title {
79
+ .vg[data-vg] .vg-title {
74
80
  font-size: var(--vg-title-size);
75
81
  font-weight: 650;
76
82
  margin-bottom: calc(var(--vg-gap) * 1.33);
@@ -113,7 +119,7 @@
113
119
  .vg-bar {
114
120
  margin-bottom: calc(var(--vg-gap) * 1.33);
115
121
  }
116
- .vg-group-title {
122
+ .vg[data-vg] .vg-group-title {
117
123
  font-size: var(--vg-group-title-size);
118
124
  font-weight: 600;
119
125
  }
@@ -204,13 +210,13 @@
204
210
  .vg-thumb:hover {
205
211
  transform: translateY(-2px);
206
212
  }
207
- .vg .vg-card-title {
213
+ .vg[data-vg] .vg-card-title {
208
214
  margin-top: 0.75rem;
209
215
  font-size: var(--vg-card-title-size);
210
216
  font-weight: 600;
211
217
  color: var(--vg-ink);
212
218
  }
213
- .vg .vg-caption {
219
+ .vg[data-vg] .vg-caption {
214
220
  margin-top: 0.25rem;
215
221
  font-size: var(--vg-small);
216
222
  color: var(--vg-muted);
@@ -280,7 +286,7 @@
280
286
  position: relative;
281
287
  min-width: 0;
282
288
  }
283
- .vg .vg-track {
289
+ .vg[data-vg] .vg-track {
284
290
  display: grid;
285
291
  grid-auto-flow: column;
286
292
  grid-auto-columns: var(--vg-strip-card, min(22.5rem, 80%));
@@ -315,7 +321,7 @@
315
321
  .vg-strip .vg-icon:disabled {
316
322
  visibility: hidden;
317
323
  }
318
- .vg .vg-see-all {
324
+ .vg[data-vg] .vg-see-all {
319
325
  margin-top: 1rem;
320
326
  text-align: center;
321
327
  }
@@ -324,7 +330,7 @@
324
330
  font-weight: 500;
325
331
  }
326
332
 
327
- .vg .vg-credit {
333
+ .vg[data-vg] .vg-credit {
328
334
  margin-top: calc(var(--vg-gap) * 2);
329
335
  font-size: var(--vg-small);
330
336
  color: var(--vg-muted);
@@ -363,7 +369,7 @@
363
369
  padding: 0.75rem 1rem;
364
370
  border-bottom: var(--vg-rule-width) solid var(--vg-rule);
365
371
  }
366
- .vg-box-title {
372
+ .vg[data-vg] .vg-box-title {
367
373
  flex: 1;
368
374
  font-size: 1.25rem;
369
375
  font-weight: 600;
@@ -64,15 +64,6 @@ var __read = (this && this.__read) || function (o, n) {
64
64
  }
65
65
  return ar;
66
66
  };
67
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
68
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
69
- if (ar || !(i in from)) {
70
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
71
- ar[i] = from[i];
72
- }
73
- }
74
- return to.concat(ar || Array.prototype.slice.call(from));
75
- };
76
67
  var VisualCIGallery = (function () {
77
68
  var __defProp = Object.defineProperty;
78
69
  var __defProps = Object.defineProperties;
@@ -544,11 +535,11 @@ var VisualCIGallery = (function () {
544
535
  }
545
536
  finally { if (e_10) throw e_10.error; }
546
537
  }
547
- var kept = __spreadArray([], __read(screens), false).map(function (_w) {
538
+ var kept = Array.from(screens).map(function (_w) {
548
539
  var _x = __read(_w, 2), key = _x[0], variants = _x[1];
549
540
  return ({
550
541
  key: key,
551
- variants: __spreadArray([], __read(variants.values()), false).filter(function (v) { return v.url !== ""; }).sort(function (a, b) { return SIZES.indexOf(a.size) - SIZES.indexOf(b.size) || THEMES.indexOf(a.theme) - THEMES.indexOf(b.theme); })
542
+ variants: Array.from(variants.values()).filter(function (v) { return v.url !== ""; }).sort(function (a, b) { return SIZES.indexOf(a.size) - SIZES.indexOf(b.size) || THEMES.indexOf(a.theme) - THEMES.indexOf(b.theme); })
552
543
  });
553
544
  }).filter(function (sc) { return sc.variants.length > 0; });
554
545
  try {
@@ -899,13 +890,13 @@ var VisualCIGallery = (function () {
899
890
  /** Puts what the reader did (or is about to do) ahead of everything, replacing the last jump. To make room, the
900
891
  * background requests running are dropped first, then the old jump's. */
901
892
  Preloader.prototype.jump = function (items, high) {
902
- var e_24, _w, _x;
893
+ var e_24, _w;
903
894
  var _this = this;
904
895
  this.front = items.filter(function (i) { return !_this.finished.has(i.url); }).map(function (item) { return ({ item: item, high: high }); });
905
896
  var wanted = new Set(this.front.map(function (f) { return f.item.url; }));
906
897
  var waiting = this.front.filter(function (f) { return !_this.running.has(f.item.url); }).length;
907
898
  var free = this.parallel() - this.running.size;
908
- var victims = __spreadArray([], __read(this.running.values()), false).filter(function (r) { return !wanted.has(r.item.url); }).sort(function (a, b) { return Number(a.front) - Number(b.front); });
899
+ var victims = Array.from(this.running.values()).filter(function (r) { return !wanted.has(r.item.url); }).sort(function (a, b) { return Number(a.front) - Number(b.front); });
909
900
  var back = [];
910
901
  try {
911
902
  for (var victims_1 = __values(victims), victims_1_1 = victims_1.next(); !victims_1_1.done; victims_1_1 = victims_1.next()) {
@@ -925,7 +916,7 @@ var VisualCIGallery = (function () {
925
916
  }
926
917
  finally { if (e_24) throw e_24.error; }
927
918
  }
928
- (_x = this.queue).unshift.apply(_x, __spreadArray([], __read(back), false));
919
+ this.queue = back.concat(this.queue);
929
920
  this.pump();
930
921
  };
931
922
  /** Adds a likely next step (a tab the pointer is over) after the current jump, without dropping anything. */
@@ -957,7 +948,7 @@ var VisualCIGallery = (function () {
957
948
  };
958
949
  /** What's running, for tests. */
959
950
  Preloader.prototype.inFlight = function () {
960
- return __spreadArray([], __read(this.running.keys()), false);
951
+ return Array.from(this.running.keys());
961
952
  };
962
953
  Preloader.prototype.stop = function () {
963
954
  var e_26, _w;
@@ -1056,8 +1047,8 @@ var VisualCIGallery = (function () {
1056
1047
  this.samples.shift();
1057
1048
  if (this.samples.length < Math.min(3, RATE_WINDOW))
1058
1049
  return;
1059
- var start = Math.min.apply(Math, __spreadArray([], __read(this.samples.map(function (s) { return s.start; })), false));
1060
- var end = Math.max.apply(Math, __spreadArray([], __read(this.samples.map(function (s) { return s.end; })), false));
1050
+ var start = this.samples.reduce(function (min, s) { return Math.min(min, s.start); }, Infinity);
1051
+ var end = this.samples.reduce(function (max, s) { return Math.max(max, s.end); }, -Infinity);
1061
1052
  var bytes = this.samples.reduce(function (sum, s) { return sum + s.bytes; }, 0);
1062
1053
  var slow = bytes / ((end - start) / 1e3) < SLOW_RATE;
1063
1054
  if (slow !== this.slow)
package/dist/model.js CHANGED
@@ -219,10 +219,10 @@ export function buildModel(manifest, options = {}) {
219
219
  }
220
220
  }
221
221
  // The screens that have something to show; titles are made from these keys only.
222
- const kept = [...screens]
222
+ const kept = Array.from(screens)
223
223
  .map(([key, variants]) => ({
224
224
  key,
225
- variants: [...variants.values()]
225
+ variants: Array.from(variants.values())
226
226
  .filter((v) => v.url !== "")
227
227
  .sort((a, b) => SIZES.indexOf(a.size) - SIZES.indexOf(b.size) || THEMES.indexOf(a.theme) - THEMES.indexOf(b.theme)),
228
228
  }))
package/dist/preload.js CHANGED
@@ -174,7 +174,7 @@ export class Preloader {
174
174
  const wanted = new Set(this.front.map((f) => f.item.url));
175
175
  const waiting = this.front.filter((f) => !this.running.has(f.item.url)).length;
176
176
  let free = this.parallel() - this.running.size;
177
- const victims = [...this.running.values()]
177
+ const victims = Array.from(this.running.values())
178
178
  .filter((r) => !wanted.has(r.item.url))
179
179
  .sort((a, b) => Number(a.front) - Number(b.front));
180
180
  const back = [];
@@ -187,7 +187,7 @@ export class Preloader {
187
187
  back.push(r.item);
188
188
  free++;
189
189
  }
190
- this.queue.unshift(...back);
190
+ this.queue = back.concat(this.queue);
191
191
  this.pump();
192
192
  }
193
193
  /** Adds a likely next step (a tab the pointer is over) after the current jump, without dropping anything. */
@@ -208,7 +208,7 @@ export class Preloader {
208
208
  }
209
209
  /** What's running, for tests. */
210
210
  inFlight() {
211
- return [...this.running.keys()];
211
+ return Array.from(this.running.keys());
212
212
  }
213
213
  stop() {
214
214
  this.stopped = true;
@@ -286,8 +286,8 @@ export class Preloader {
286
286
  this.samples.shift();
287
287
  if (this.samples.length < Math.min(3, RATE_WINDOW))
288
288
  return;
289
- const start = Math.min(...this.samples.map((s) => s.start));
290
- const end = Math.max(...this.samples.map((s) => s.end));
289
+ const start = this.samples.reduce((min, s) => Math.min(min, s.start), Infinity);
290
+ const end = this.samples.reduce((max, s) => Math.max(max, s.end), -Infinity);
291
291
  const bytes = this.samples.reduce((sum, s) => sum + s.bytes, 0);
292
292
  const slow = bytes / ((end - start) / 1000) < SLOW_RATE;
293
293
  if (slow !== this.slow)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "visualci-gallery",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A screenshots page from VisualCI's public gallery: render it into an empty element, or hydrate markup a server rendered.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://visualci.com/docs/gallery/",
@@ -27,7 +27,8 @@
27
27
  },
28
28
  "files": [
29
29
  "dist",
30
- "README.md"
30
+ "README.md",
31
+ "LICENSE"
31
32
  ],
32
33
  "devDependencies": {
33
34
  "@types/jsdom": "^30.0.0",