@design.estate/wcctools 6.1.0 → 7.0.0

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.
Files changed (112) hide show
  1. package/changelog.md +41 -0
  2. package/dist_shell/bundle.js +405 -368
  3. package/dist_shell/bundle.js.map +1 -1
  4. package/dist_shell/bundle.js.third-party-notices.json +52 -0
  5. package/dist_shell/bundle.js.third-party-notices.txt +107 -1
  6. package/dist_shell/index.html +1 -1
  7. package/dist_ts/00_commitinfo_data.js +1 -1
  8. package/dist_ts/capture/classes.capturebrowser.d.ts +65 -0
  9. package/dist_ts/capture/classes.capturebrowser.js +251 -0
  10. package/dist_ts/capture/classes.captureservice.d.ts +39 -0
  11. package/dist_ts/capture/classes.captureservice.js +119 -0
  12. package/dist_ts/capture/classes.screencast.d.ts +47 -0
  13. package/dist_ts/capture/classes.screencast.js +127 -0
  14. package/dist_ts/capture/errors.d.ts +14 -0
  15. package/dist_ts/capture/errors.js +23 -0
  16. package/dist_ts/capture/images.d.ts +3 -0
  17. package/dist_ts/capture/images.js +58 -0
  18. package/dist_ts/capture/index.d.ts +4 -0
  19. package/dist_ts/capture/index.js +5 -0
  20. package/dist_ts/capture/interaction.d.ts +11 -0
  21. package/dist_ts/capture/interaction.js +138 -0
  22. package/dist_ts/capture/navigationguard.d.ts +44 -0
  23. package/dist_ts/capture/navigationguard.js +129 -0
  24. package/dist_ts/capture/previewpage.d.ts +29 -0
  25. package/dist_ts/capture/previewpage.js +96 -0
  26. package/dist_ts/capture/request.d.ts +69 -0
  27. package/dist_ts/capture/request.js +239 -0
  28. package/dist_ts/classes.bundlestatus.d.ts +36 -0
  29. package/dist_ts/classes.bundlestatus.js +110 -0
  30. package/dist_ts/classes.devapi.d.ts +3 -0
  31. package/dist_ts/classes.devapi.js +8 -1
  32. package/dist_ts/classes.devserver.d.ts +65 -14
  33. package/dist_ts/classes.devserver.js +157 -52
  34. package/dist_ts/classes.hostpolicy.d.ts +63 -0
  35. package/dist_ts/classes.hostpolicy.js +171 -0
  36. package/dist_ts/cli.js +28 -3
  37. package/dist_ts/cli.screenshot.d.ts +6 -0
  38. package/dist_ts/cli.screenshot.js +89 -0
  39. package/dist_ts/index.d.ts +0 -2
  40. package/dist_ts/index.js +1 -3
  41. package/dist_ts/plugins.d.ts +6 -2
  42. package/dist_ts/plugins.js +8 -3
  43. package/dist_ts_interfaces/capture.d.ts +151 -0
  44. package/dist_ts_interfaces/capture.js +2 -0
  45. package/dist_ts_interfaces/index.d.ts +1 -0
  46. package/dist_ts_interfaces/index.js +2 -1
  47. package/dist_ts_interfaces/requests.d.ts +59 -0
  48. package/dist_ts_shell/bundlestatus.d.ts +15 -0
  49. package/dist_ts_shell/bundlestatus.js +64 -0
  50. package/dist_ts_shell/elements/wcc-contextmenu.d.ts +3 -0
  51. package/dist_ts_shell/elements/wcc-contextmenu.js +18 -3
  52. package/dist_ts_shell/elements/wcc-preview-frame.d.ts +6 -0
  53. package/dist_ts_shell/elements/wcc-preview-frame.js +50 -2
  54. package/dist_ts_shell/elements/wcc-recording-panel.d.ts +9 -0
  55. package/dist_ts_shell/elements/wcc-recording-panel.js +12 -1
  56. package/dist_ts_shell/elements/wcc-shell.d.ts +15 -0
  57. package/dist_ts_shell/elements/wcc-shell.js +45 -3
  58. package/dist_ts_shell/plugins.d.ts +2 -1
  59. package/dist_ts_shell/plugins.js +3 -2
  60. package/dist_ts_shell/services/framesampler.service.d.ts +23 -0
  61. package/dist_ts_shell/services/framesampler.service.js +101 -0
  62. package/dist_ts_web/00_commitinfo_data.js +1 -1
  63. package/package.json +6 -2
  64. package/readme.md +108 -6
  65. package/ts/00_commitinfo_data.ts +1 -1
  66. package/ts/capture/classes.capturebrowser.ts +290 -0
  67. package/ts/capture/classes.captureservice.ts +152 -0
  68. package/ts/capture/classes.screencast.ts +152 -0
  69. package/ts/capture/errors.ts +25 -0
  70. package/ts/capture/images.ts +61 -0
  71. package/ts/capture/index.ts +4 -0
  72. package/ts/capture/interaction.ts +146 -0
  73. package/ts/capture/navigationguard.ts +147 -0
  74. package/ts/capture/previewpage.ts +130 -0
  75. package/ts/capture/request.ts +304 -0
  76. package/ts/classes.bundlestatus.ts +123 -0
  77. package/ts/classes.devapi.ts +9 -0
  78. package/ts/classes.devserver.ts +172 -50
  79. package/ts/classes.hostpolicy.ts +201 -0
  80. package/ts/cli.screenshot.ts +95 -0
  81. package/ts/cli.ts +28 -2
  82. package/ts/index.ts +0 -2
  83. package/ts/plugins.ts +9 -2
  84. package/ts_interfaces/bridge.ts +95 -0
  85. package/ts_interfaces/capture.ts +144 -0
  86. package/ts_interfaces/catalog.ts +37 -0
  87. package/ts_interfaces/index.ts +5 -0
  88. package/ts_interfaces/plugins.ts +3 -0
  89. package/ts_interfaces/requests.ts +104 -0
  90. package/ts_interfaces/standard.ts +103 -0
  91. package/ts_shared/index.ts +1 -0
  92. package/ts_shared/plugins.ts +3 -0
  93. package/ts_shared/previewroute.ts +58 -0
  94. package/ts_shell/bundlestatus.ts +68 -0
  95. package/ts_shell/elements/wcc-contextmenu.ts +306 -0
  96. package/ts_shell/elements/wcc-preview-frame.ts +167 -0
  97. package/ts_shell/elements/wcc-properties.ts +998 -0
  98. package/ts_shell/elements/wcc-record-button.ts +108 -0
  99. package/ts_shell/elements/wcc-recording-panel.ts +1017 -0
  100. package/ts_shell/elements/wcc-shell.ts +485 -0
  101. package/ts_shell/elements/wcc-sidebar.ts +1419 -0
  102. package/ts_shell/index.html +21 -0
  103. package/ts_shell/index.ts +4 -0
  104. package/ts_shell/plugins.ts +12 -0
  105. package/ts_shell/previewconnection.ts +103 -0
  106. package/ts_shell/services/framesampler.service.ts +112 -0
  107. package/ts_shell/services/recorder.service.ts +451 -0
  108. package/ts_shell/types/dom-mediacapture-stub/index.d.ts +12 -0
  109. package/ts_shell/types/dom-mediacapture-stub/package.json +6 -0
  110. package/ts_shell/types/dom-webcodecs-stub/index.d.ts +2 -0
  111. package/ts_shell/types/dom-webcodecs-stub/package.json +6 -0
  112. package/ts_web/00_commitinfo_data.ts +1 -1
@@ -1,6 +1,19 @@
1
1
  {
2
2
  "generator": "@git.zone/tsbundle",
3
3
  "packages": [
4
+ {
5
+ "name": "@api.global/typedrequest",
6
+ "version": "8.2.0",
7
+ "license": "MIT",
8
+ "files": [
9
+ {
10
+ "name": "license.md",
11
+ "origin": "package",
12
+ "sha256": "d4df21792a018c250ee96e4fcf8c3914dc69dc24a710c34a5902b94102febbb9",
13
+ "text": "Copyright (c) 2019 Lossless GmbH (hello@lossless.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
14
+ }
15
+ ]
16
+ },
4
17
  {
5
18
  "name": "@api.global/typedrequest",
6
19
  "version": "9.0.2",
@@ -105,6 +118,19 @@
105
118
  }
106
119
  ]
107
120
  },
121
+ {
122
+ "name": "@push.rocks/isounique",
123
+ "version": "1.0.5",
124
+ "license": "MIT",
125
+ "files": [
126
+ {
127
+ "name": "license",
128
+ "origin": "package",
129
+ "sha256": "e1e7bd6c95d8e5bceb1e98922a47ebe72f281313a10ad80d6189758e007e07b1",
130
+ "text": "Copyright (c) 2020 Lossless GmbH (hello@lossless.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
131
+ }
132
+ ]
133
+ },
108
134
  {
109
135
  "name": "@push.rocks/lik",
110
136
  "version": "6.4.4",
@@ -144,6 +170,19 @@
144
170
  }
145
171
  ]
146
172
  },
173
+ {
174
+ "name": "@push.rocks/smartdelay",
175
+ "version": "3.1.0",
176
+ "license": "MIT",
177
+ "files": [
178
+ {
179
+ "name": "license",
180
+ "origin": "package",
181
+ "sha256": "08a29c2b5fd80963b14f876049437c4f8e7c13e352067ba330457bbe8074d7d1",
182
+ "text": "The MIT License (MIT)\n\nCopyright (c) 2017 Task Venture Capital GmbH <hello@task.vc>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
183
+ }
184
+ ]
185
+ },
147
186
  {
148
187
  "name": "@push.rocks/smartenv",
149
188
  "version": "6.1.0",
@@ -352,6 +391,19 @@
352
391
  }
353
392
  ]
354
393
  },
394
+ {
395
+ "name": "@push.rocks/webrequest",
396
+ "version": "4.3.1",
397
+ "license": "MIT",
398
+ "files": [
399
+ {
400
+ "name": "license.md",
401
+ "origin": "package",
402
+ "sha256": "5262baa104dbbcf18084c74a3693541936067eeb9460fcfe3ccbe25164f5cb84",
403
+ "text": "Copyright (c) 2018 Lossless GmbH (hello@lossless.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
404
+ }
405
+ ]
406
+ },
355
407
  {
356
408
  "name": "@push.rocks/websetup",
357
409
  "version": "3.1.0",
@@ -1,10 +1,36 @@
1
1
  Third-party notices
2
2
 
3
3
  The JavaScript bundle this file accompanies, including its chunks and module workers,
4
- contains code from the following 132 npm package(s). Each entry reproduces
4
+ contains code from the following 136 npm package(s). Each entry reproduces
5
5
  the license and notice files the package ships, or the license text the project
6
6
  or a bundled package supplied for it.
7
7
 
8
+ ================================================================================
9
+ @api.global/typedrequest@8.2.0
10
+ License: MIT
11
+
12
+ --- license.md ---
13
+
14
+ Copyright (c) 2019 Lossless GmbH (hello@lossless.com)
15
+
16
+ Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ of this software and associated documentation files (the "Software"), to deal
18
+ in the Software without restriction, including without limitation the rights
19
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ copies of the Software, and to permit persons to whom the Software is
21
+ furnished to do so, subject to the following conditions:
22
+
23
+ The above copyright notice and this permission notice shall be included in all
24
+ copies or substantial portions of the Software.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ SOFTWARE.
33
+
8
34
  ================================================================================
9
35
  @api.global/typedrequest@9.0.2
10
36
  License: MIT
@@ -232,6 +258,32 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
232
258
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
233
259
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
234
260
 
261
+ ================================================================================
262
+ @push.rocks/isounique@1.0.5
263
+ License: MIT
264
+
265
+ --- license ---
266
+
267
+ Copyright (c) 2020 Lossless GmbH (hello@lossless.com)
268
+
269
+ Permission is hereby granted, free of charge, to any person obtaining a copy
270
+ of this software and associated documentation files (the "Software"), to deal
271
+ in the Software without restriction, including without limitation the rights
272
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
273
+ copies of the Software, and to permit persons to whom the Software is
274
+ furnished to do so, subject to the following conditions:
275
+
276
+ The above copyright notice and this permission notice shall be included in all
277
+ copies or substantial portions of the Software.
278
+
279
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
280
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
281
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
282
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
283
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
284
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
285
+ SOFTWARE.
286
+
235
287
  ================================================================================
236
288
  @push.rocks/lik@6.4.4
237
289
  License: MIT
@@ -314,6 +366,34 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
314
366
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
315
367
  SOFTWARE.
316
368
 
369
+ ================================================================================
370
+ @push.rocks/smartdelay@3.1.0
371
+ License: MIT
372
+
373
+ --- license ---
374
+
375
+ The MIT License (MIT)
376
+
377
+ Copyright (c) 2017 Task Venture Capital GmbH <hello@task.vc>
378
+
379
+ Permission is hereby granted, free of charge, to any person obtaining a copy
380
+ of this software and associated documentation files (the "Software"), to deal
381
+ in the Software without restriction, including without limitation the rights
382
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
383
+ copies of the Software, and to permit persons to whom the Software is
384
+ furnished to do so, subject to the following conditions:
385
+
386
+ The above copyright notice and this permission notice shall be included in all
387
+ copies or substantial portions of the Software.
388
+
389
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
390
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
391
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
392
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
393
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
394
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
395
+ SOFTWARE.
396
+
317
397
  ================================================================================
318
398
  @push.rocks/smartenv@6.1.0
319
399
  License: MIT
@@ -741,6 +821,32 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
741
821
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
742
822
  SOFTWARE.
743
823
 
824
+ ================================================================================
825
+ @push.rocks/webrequest@4.3.1
826
+ License: MIT
827
+
828
+ --- license.md ---
829
+
830
+ Copyright (c) 2018 Lossless GmbH (hello@lossless.com)
831
+
832
+ Permission is hereby granted, free of charge, to any person obtaining a copy
833
+ of this software and associated documentation files (the "Software"), to deal
834
+ in the Software without restriction, including without limitation the rights
835
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
836
+ copies of the Software, and to permit persons to whom the Software is
837
+ furnished to do so, subject to the following conditions:
838
+
839
+ The above copyright notice and this permission notice shall be included in all
840
+ copies or substantial portions of the Software.
841
+
842
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
843
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
844
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
845
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
846
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
847
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
848
+ SOFTWARE.
849
+
744
850
  ================================================================================
745
851
  @push.rocks/websetup@3.1.0
746
852
  License: MIT
@@ -16,6 +16,6 @@
16
16
  <script type="module" src="/wcctools/bundle.js"></script>
17
17
  </head>
18
18
  <body>
19
- <wcc-shell preview-path="/wcctools-preview"></wcc-shell>
19
+ <wcc-shell preview-path="/wcctools-preview" api-path="/wcctools/typedrequest"></wcc-shell>
20
20
  </body>
21
21
  </html>
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/wcctools',
6
- version: '6.1.0',
6
+ version: '7.0.0',
7
7
  description: 'A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx5QkFBeUI7SUFDL0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLG1KQUFtSjtDQUNqSyxDQUFBIn0=
@@ -0,0 +1,65 @@
1
+ import * as plugins from '../plugins.js';
2
+ type TBrowserContext = plugins.smartbrowser.puppeteer.BrowserContext;
3
+ export interface IWccCaptureBrowserOptions {
4
+ /** Captures that run at once; default 2. */
5
+ maxConcurrent?: number;
6
+ /** Captures that wait for a slot; more are refused as busy. Default 8. */
7
+ maxQueued?: number;
8
+ /** The browser closes after this long without captures; default 60 s. */
9
+ idleCloseMs?: number;
10
+ /** How long closing the browser may take before its process is killed; default 5 s. */
11
+ closeTimeoutMs?: number;
12
+ }
13
+ export declare const captureBrowserClosedMessage = "wcctools: the dev server is not serving captures.";
14
+ /**
15
+ * The headless browser of a dev server's captures: launched on the first capture, shared by the
16
+ * captures that follow and closed after a while without one, or when the server stops. Each
17
+ * capture runs in its own browser context, closed when it ends; a bounded number run at once and a
18
+ * bounded number wait for a slot. The browser leaves process signals to the application: the dev
19
+ * server's shutdown closes it.
20
+ */
21
+ export declare class WccCaptureBrowser {
22
+ private readonly maxConcurrent;
23
+ private readonly maxQueued;
24
+ private readonly idleCloseMs;
25
+ private readonly closeTimeoutMs;
26
+ private isOpen;
27
+ private launching;
28
+ private readonly closingBrowsers;
29
+ private readonly contexts;
30
+ private readonly running;
31
+ private readonly queue;
32
+ private activeCount;
33
+ private idleTimer;
34
+ private launchCount;
35
+ constructor(optionsArg?: IWccCaptureBrowserOptions);
36
+ /** How often a browser was launched; one browser serves every capture while it runs. */
37
+ getLaunchCount(): number;
38
+ /** The process id of the running browser, or null while none runs. */
39
+ getProcessId(): Promise<number | null>;
40
+ /** Takes captures from now on. */
41
+ open(): void;
42
+ /**
43
+ * Refuses new captures and the waiting ones, ends the running ones by closing their contexts,
44
+ * closes the browser and resolves once all of it has settled.
45
+ */
46
+ close(): Promise<void>;
47
+ /**
48
+ * Runs a capture in a browser context of its own, once a slot is free. The context closes when
49
+ * the capture ends, and at once when `abortSignalArg` aborts, which ends the capture with the
50
+ * signal's reason.
51
+ */
52
+ withContext<T>(abortSignalArg: AbortSignal, captureArg: (contextArg: TBrowserContext) => Promise<T>): Promise<T>;
53
+ private runInContext;
54
+ private acquireSlot;
55
+ private releaseSlot;
56
+ private clearIdleTimer;
57
+ /** The running browser, launched when none runs; refused once close() ran, so it never outlives it. */
58
+ private getBrowser;
59
+ private launch;
60
+ /** Closes the current browser, if one runs or launches; the next capture launches another. */
61
+ private closeBrowser;
62
+ /** Closes a browser, and kills its process when closing takes longer than allowed. */
63
+ private closeWithin;
64
+ }
65
+ export {};
@@ -0,0 +1,251 @@
1
+ import * as plugins from '../plugins.js';
2
+ import { WccCaptureError, getErrorMessage } from './errors.js';
3
+ export const captureBrowserClosedMessage = 'wcctools: the dev server is not serving captures.';
4
+ /**
5
+ * The headless browser of a dev server's captures: launched on the first capture, shared by the
6
+ * captures that follow and closed after a while without one, or when the server stops. Each
7
+ * capture runs in its own browser context, closed when it ends; a bounded number run at once and a
8
+ * bounded number wait for a slot. The browser leaves process signals to the application: the dev
9
+ * server's shutdown closes it.
10
+ */
11
+ export class WccCaptureBrowser {
12
+ maxConcurrent;
13
+ maxQueued;
14
+ idleCloseMs;
15
+ closeTimeoutMs;
16
+ isOpen = false;
17
+ launching = null;
18
+ closingBrowsers = new Set();
19
+ contexts = new Set();
20
+ running = new Set();
21
+ queue = [];
22
+ activeCount = 0;
23
+ idleTimer = null;
24
+ launchCount = 0;
25
+ constructor(optionsArg = {}) {
26
+ this.maxConcurrent = optionsArg.maxConcurrent ?? 2;
27
+ this.maxQueued = optionsArg.maxQueued ?? 8;
28
+ this.idleCloseMs = optionsArg.idleCloseMs ?? 60_000;
29
+ this.closeTimeoutMs = optionsArg.closeTimeoutMs ?? 5_000;
30
+ }
31
+ /** How often a browser was launched; one browser serves every capture while it runs. */
32
+ getLaunchCount() {
33
+ return this.launchCount;
34
+ }
35
+ /** The process id of the running browser, or null while none runs. */
36
+ async getProcessId() {
37
+ const launching = this.launching;
38
+ if (!launching) {
39
+ return null;
40
+ }
41
+ const browser = await launching.catch(() => null);
42
+ return browser?.process()?.pid ?? null;
43
+ }
44
+ /** Takes captures from now on. */
45
+ open() {
46
+ this.isOpen = true;
47
+ }
48
+ /**
49
+ * Refuses new captures and the waiting ones, ends the running ones by closing their contexts,
50
+ * closes the browser and resolves once all of it has settled.
51
+ */
52
+ async close() {
53
+ this.isOpen = false;
54
+ this.clearIdleTimer();
55
+ const refusal = new WccCaptureError(captureBrowserClosedMessage);
56
+ for (const queued of this.queue.splice(0)) {
57
+ queued.refuse(refusal);
58
+ }
59
+ await Promise.allSettled([...this.contexts].map((contextArg) => contextArg.close()));
60
+ await Promise.allSettled([...this.running]);
61
+ this.closeBrowser();
62
+ await Promise.allSettled([...this.closingBrowsers]);
63
+ }
64
+ /**
65
+ * Runs a capture in a browser context of its own, once a slot is free. The context closes when
66
+ * the capture ends, and at once when `abortSignalArg` aborts, which ends the capture with the
67
+ * signal's reason.
68
+ */
69
+ async withContext(abortSignalArg, captureArg) {
70
+ await this.acquireSlot(abortSignalArg);
71
+ const run = this.runInContext(abortSignalArg, captureArg);
72
+ this.running.add(run);
73
+ try {
74
+ return await run;
75
+ }
76
+ finally {
77
+ this.running.delete(run);
78
+ this.releaseSlot();
79
+ }
80
+ }
81
+ async runInContext(abortSignalArg, captureArg) {
82
+ let context = null;
83
+ const closeContext = () => {
84
+ void context?.close().catch(() => {
85
+ // The context is gone already: its browser closed or disconnected
86
+ });
87
+ };
88
+ abortSignalArg.addEventListener('abort', closeContext, { once: true });
89
+ try {
90
+ const browser = await this.getBrowser();
91
+ abortSignalArg.throwIfAborted();
92
+ context = await browser.createBrowserContext();
93
+ this.contexts.add(context);
94
+ abortSignalArg.throwIfAborted();
95
+ if (!this.isOpen) {
96
+ // close() ran while the browser launched; it does not wait for this capture's context
97
+ throw new WccCaptureError(captureBrowserClosedMessage);
98
+ }
99
+ return await captureArg(context);
100
+ }
101
+ catch (error) {
102
+ if (abortSignalArg.aborted) {
103
+ throw abortSignalArg.reason;
104
+ }
105
+ if (!this.isOpen) {
106
+ throw new WccCaptureError(captureBrowserClosedMessage);
107
+ }
108
+ throw error;
109
+ }
110
+ finally {
111
+ abortSignalArg.removeEventListener('abort', closeContext);
112
+ if (context) {
113
+ this.contexts.delete(context);
114
+ if (context.browser().connected) {
115
+ await context.close().catch(() => {
116
+ // Closed meanwhile by an abort, or its browser disconnected
117
+ });
118
+ }
119
+ }
120
+ }
121
+ }
122
+ acquireSlot(abortSignalArg) {
123
+ if (!this.isOpen) {
124
+ return Promise.reject(new WccCaptureError(captureBrowserClosedMessage));
125
+ }
126
+ abortSignalArg.throwIfAborted();
127
+ this.clearIdleTimer();
128
+ if (this.activeCount < this.maxConcurrent) {
129
+ this.activeCount++;
130
+ return Promise.resolve();
131
+ }
132
+ if (this.queue.length >= this.maxQueued) {
133
+ return Promise.reject(new WccCaptureError(`wcctools: the capture browser is busy (${this.maxConcurrent} captures running, ${this.queue.length} waiting); try again later.`));
134
+ }
135
+ return new Promise((resolve, reject) => {
136
+ const queued = {
137
+ grant: () => {
138
+ abortSignalArg.removeEventListener('abort', onAbort);
139
+ resolve();
140
+ },
141
+ refuse: (errorArg) => {
142
+ abortSignalArg.removeEventListener('abort', onAbort);
143
+ reject(errorArg);
144
+ },
145
+ };
146
+ const onAbort = () => {
147
+ const index = this.queue.indexOf(queued);
148
+ if (index !== -1) {
149
+ this.queue.splice(index, 1);
150
+ }
151
+ queued.refuse(abortSignalArg.reason);
152
+ };
153
+ abortSignalArg.addEventListener('abort', onAbort, { once: true });
154
+ this.queue.push(queued);
155
+ });
156
+ }
157
+ releaseSlot() {
158
+ const next = this.queue.shift();
159
+ if (next) {
160
+ // The slot passes to the next capture
161
+ next.grant();
162
+ return;
163
+ }
164
+ this.activeCount--;
165
+ if (this.activeCount === 0 && this.isOpen && this.launching) {
166
+ this.idleTimer = setTimeout(() => {
167
+ this.idleTimer = null;
168
+ if (this.activeCount === 0) {
169
+ this.closeBrowser();
170
+ }
171
+ }, this.idleCloseMs);
172
+ this.idleTimer.unref();
173
+ }
174
+ }
175
+ clearIdleTimer() {
176
+ if (this.idleTimer) {
177
+ clearTimeout(this.idleTimer);
178
+ this.idleTimer = null;
179
+ }
180
+ }
181
+ /** The running browser, launched when none runs; refused once close() ran, so it never outlives it. */
182
+ getBrowser() {
183
+ if (!this.isOpen) {
184
+ return Promise.reject(new WccCaptureError(captureBrowserClosedMessage));
185
+ }
186
+ this.launching ??= this.launch();
187
+ return this.launching;
188
+ }
189
+ async launch() {
190
+ this.launchCount++;
191
+ let browser;
192
+ try {
193
+ browser = await plugins.smartbrowser.getEnvAwareBrowserInstance({
194
+ launchOptions: {
195
+ // The application owns process signals: the dev server's shutdown closes the browser
196
+ handleSIGINT: false,
197
+ handleSIGTERM: false,
198
+ handleSIGHUP: false,
199
+ },
200
+ });
201
+ }
202
+ catch (error) {
203
+ this.launching = null;
204
+ throw new WccCaptureError(`wcctools: the capture browser failed to start: ${getErrorMessage(error)}. Captures need Chrome or Chromium: install google-chrome or chromium on the PATH.`);
205
+ }
206
+ const launching = this.launching;
207
+ browser.once('disconnected', () => {
208
+ // A crashed or closed browser is replaced by the next capture
209
+ if (this.launching === launching) {
210
+ this.launching = null;
211
+ }
212
+ });
213
+ return browser;
214
+ }
215
+ /** Closes the current browser, if one runs or launches; the next capture launches another. */
216
+ closeBrowser() {
217
+ this.clearIdleTimer();
218
+ const launching = this.launching;
219
+ if (!launching) {
220
+ return;
221
+ }
222
+ this.launching = null;
223
+ const closing = launching
224
+ .then((browserArg) => this.closeWithin(browserArg), () => undefined)
225
+ .finally(() => {
226
+ this.closingBrowsers.delete(closing);
227
+ });
228
+ this.closingBrowsers.add(closing);
229
+ }
230
+ /** Closes a browser, and kills its process when closing takes longer than allowed. */
231
+ async closeWithin(browserArg) {
232
+ if (!browserArg.connected) {
233
+ return;
234
+ }
235
+ let deadline = null;
236
+ const timedOut = new Promise((resolve) => {
237
+ deadline = setTimeout(() => resolve('timeout'), this.closeTimeoutMs);
238
+ });
239
+ const closed = browserArg.close().then(() => 'closed', () => 'failed');
240
+ try {
241
+ const result = await Promise.race([closed, timedOut]);
242
+ if (result !== 'closed') {
243
+ browserArg.process()?.kill('SIGKILL');
244
+ }
245
+ }
246
+ finally {
247
+ clearTimeout(deadline);
248
+ }
249
+ }
250
+ }
251
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5jYXB0dXJlYnJvd3Nlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3RzL2NhcHR1cmUvY2xhc3Nlcy5jYXB0dXJlYnJvd3Nlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGVBQWUsQ0FBQztBQUN6QyxPQUFPLEVBQUUsZUFBZSxFQUFFLGVBQWUsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQXFCL0QsTUFBTSxDQUFDLE1BQU0sMkJBQTJCLEdBQUcsbURBQW1ELENBQUM7QUFFL0Y7Ozs7OztHQU1HO0FBQ0gsTUFBTSxPQUFPLGlCQUFpQjtJQUNYLGFBQWEsQ0FBUztJQUN0QixTQUFTLENBQVM7SUFDbEIsV0FBVyxDQUFTO0lBQ3BCLGNBQWMsQ0FBUztJQUNoQyxNQUFNLEdBQUcsS0FBSyxDQUFDO0lBQ2YsU0FBUyxHQUE2QixJQUFJLENBQUM7SUFDbEMsZUFBZSxHQUFHLElBQUksR0FBRyxFQUFpQixDQUFDO0lBQzNDLFFBQVEsR0FBRyxJQUFJLEdBQUcsRUFB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ekIsQ0FBQztJQUNILENBQUM7Q0FDRiJ9
@@ -0,0 +1,39 @@
1
+ import * as plugins from '../plugins.js';
2
+ import type { WccBundleStatusBoard } from '../classes.bundlestatus.js';
3
+ import { type IWccCaptureBrowserOptions } from './classes.capturebrowser.js';
4
+ /** The longest a screenshot may take, from its request to its image. */
5
+ export declare const screenshotDeadlineMs = 30000;
6
+ /** The longest an interaction may take: its steps, its observation and the set-up around them. */
7
+ export declare const interactionDeadlineMs: number;
8
+ /**
9
+ * The captures of a dev server: screenshots and observed interactions of single demos, taken in a
10
+ * headless browser on the server's preview route. A capture waits while a catalog bundle builds,
11
+ * and is refused when one failed, so it never shows a stale or broken bundle. Every capture has a
12
+ * deadline and ends when its client goes away. The service registers `captureScreenshot` and
13
+ * `captureInteraction` on the dev server's typed API.
14
+ */
15
+ export declare class WccCaptureService {
16
+ private readonly bundleStatus;
17
+ private readonly browser;
18
+ private origin;
19
+ constructor(bundleStatus: WccBundleStatusBoard, browserOptionsArg?: IWccCaptureBrowserOptions);
20
+ /** Registers the capture requests on a typed router. */
21
+ addTypedHandlers(typedrouterArg: plugins.typedrequest.TypedRouter): void;
22
+ /** How often the capture browser was launched. */
23
+ getBrowserLaunchCount(): number;
24
+ /** The process id of the capture browser while it runs. */
25
+ getBrowserProcessId(): Promise<number | null>;
26
+ /** Takes captures of the dev server serving at `originArg` (scheme, host and port). */
27
+ open(originArg: string): void;
28
+ /** Ends every capture and closes the browser. */
29
+ close(): Promise<void>;
30
+ captureScreenshot(requestArg: plugins.interfaces.IWccScreenshotRequest, abortSignalArg?: AbortSignal): Promise<plugins.interfaces.IWccScreenshotResult>;
31
+ captureInteraction(requestArg: plugins.interfaces.IWccInteractionRequest, abortSignalArg?: AbortSignal): Promise<plugins.interfaces.IWccInteractionResult>;
32
+ /**
33
+ * Runs a capture within its deadline: waits for settled bundles, then runs it in a browser
34
+ * context of its own. The client's abort and the deadline both end it.
35
+ */
36
+ private run;
37
+ /** Resolves once no bundle builds; refused while a bundle's latest run failed. */
38
+ private waitForSettledBundles;
39
+ }