bigpipe-util 0.2.1 → 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/CHANGELOG.md CHANGED
@@ -4,23 +4,29 @@ All notable changes to `bigpipe-util` will be documented in this file.
4
4
 
5
5
  Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
6
6
 
7
- ## v0.1.1 - 2022-03-27
7
+ ## v0.2.2 - 2022-08-03
8
8
 
9
- ### Added
10
- - Part of BigPipe implementation for Webpack.
9
+ ### Fixed
10
+ - calls for modules without constructor
11
+ - dialog opening when using instant closing
11
12
 
12
- ## v0.1.2 - 2022-04-14
13
+ ## v0.2.1 - 2022-06-02
13
14
 
14
15
  ### Added
15
- - Dialogs support.
16
+ - Prevent links from being double-clicked
17
+ - Support for keyboard (close by escape)
16
18
 
17
- ## v0.1.3 - 2022-04-27
19
+ ### Fixed
20
+ - Closing dialogs with [esc] in the correct order
21
+
22
+ ## v0.2.0 - 2022-05-17
18
23
 
19
24
  ### Added
20
- - Method to close only current dialog
25
+ - Shield to prevent "JSON Hijacking"
26
+ - Invalid node checking for AsyncDOM
21
27
 
22
28
  ### Fixed
23
- - Dialog z-index
29
+ - Backdrop for 2+ opened dialogs
24
30
 
25
31
  ## v0.1.4 - 2022-05-06
26
32
 
@@ -31,20 +37,20 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
31
37
  ### Fixed
32
38
  - Arguments for non-method require calls
33
39
 
34
- ## v0.2.0 - 2022-05-17
40
+ ## v0.1.3 - 2022-04-27
35
41
 
36
42
  ### Added
37
- - Shield to prevent "JSON Hijacking"
38
- - Invalid node checking for AsyncDOM
43
+ - Method to close only current dialog
39
44
 
40
45
  ### Fixed
41
- - Backdrop for 2+ opened dialogs
46
+ - Dialog z-index
42
47
 
43
- ## v0.2.1 - 2022-06-02
48
+ ## v0.1.2 - 2022-04-14
44
49
 
45
50
  ### Added
46
- - Prevent links from being double-clicked
47
- - Support for keyboard (close by escape)
51
+ - Dialogs support.
48
52
 
49
- ### Fixed
50
- - Closing dialogs with [esc] in the correct order
53
+ ## v0.1.1 - 2022-03-27
54
+
55
+ ### Added
56
+ - Part of BigPipe implementation for Webpack.
package/README.md CHANGED
@@ -58,7 +58,7 @@ export default class ServerJS extends ServerJSImpl {
58
58
  ```javascript
59
59
  import AsyncRequest from 'bigpipe-util/src/AsyncRequest';
60
60
 
61
- const request = AsyncRequest('/ajax/remove.php')
61
+ const request = (new AsyncRequest('/ajax/remove.php'))
62
62
  // or .setURI('/ajax/remove.php')
63
63
  .setMethod('POST')
64
64
  .setData({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bigpipe-util",
3
3
  "description": "This library currently implements small part of Facebook BigPipe so far, but the advantage is to efficiently insert/replace content and work with the DOM. It is also possible to easily call JavaScript modules from PHP.",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "keywords": [
6
6
  "bigpipe",
7
7
  "xhr",
package/src/ServerJS.js CHANGED
@@ -21,7 +21,8 @@ export default class ServerJS {
21
21
  replaceTransportMarkers(this._relativeTo, marker);
22
22
  }
23
23
 
24
- const context = new (window.require(modulePath));
24
+ const factory = window.require(modulePath);
25
+ const context = typeof factory === 'function' ? new factory : factory;
25
26
 
26
27
  if (!context[method]) {
27
28
  throw new TypeError(`Module ${modulePath} has no method "${method}"`);
@@ -3,7 +3,7 @@ import DOM from "./DOM";
3
3
 
4
4
  const DEFAULT_Z_INDEX = 1040;
5
5
 
6
- const stack = [];
6
+ let stack = [];
7
7
  let modalId = 1;
8
8
  let zIndex;
9
9
  let originalBodyPad = null;
@@ -81,7 +81,9 @@ export default class Dialog {
81
81
  el.style.zIndex = zIndex;
82
82
  setTimeout(() => document.querySelector('.modal-backdrop').style.zIndex = zIndex - 1);
83
83
  }).on('showBackdrop', this._fixBackdrop).on('hidden', function ({el}) {
84
- stack.pop();
84
+ stack = stack.filter((modal) => {
85
+ return ! modal.el.isEqualNode(el);
86
+ });
85
87
 
86
88
  if (stack.length) {
87
89
  document.body.classList.add('modal-open');