@uploadcare/file-uploader 1.20.0 → 1.20.1-alpha.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.
@@ -31,11 +31,15 @@ export class UploaderBlock extends ActivityBlock {
31
31
  /** @returns {TypedCollection<typeof uploadEntrySchema>} */
32
32
  get uploadCollection(): TypedCollection<typeof uploadEntrySchema>;
33
33
  /** @private */
34
- private initCtxOwner;
34
+ private _initCtxOwner;
35
+ /** @private */
36
+ private _observeUploadCollection;
35
37
  /** @private */
36
38
  private _unobserveCollection;
37
39
  /** @private */
38
40
  private _unobserveCollectionProperties;
41
+ /** @private */
42
+ private _unobserveUploadCollection;
39
43
  /**
40
44
  * @private
41
45
  * @param {import('../types').OutputCollectionState} collectionState
@@ -1 +1 @@
1
- {"version":3,"file":"UploaderBlock.d.ts","sourceRoot":"","sources":["UploaderBlock.js"],"names":[],"mappings":"AAmBA;IACE,iBAAiB;IACjB,mCAAwB;IAExB,eAAe;IACf,mBAAmB;IAEnB;;;;;;;;;;;;;;MAA+B;IAE/B,eAAe;IACf,0BAOC;IA2BD;;;OAGG;IACH,mCAHa,iBAAiB,CAQ7B;IAED,mCAAmC;IACnC,WADc,iBAAiB,CAM9B;IAED,4BAEC;IAED,2DAA2D;IAC3D,wBADc,eAAe,CAAC,OAAO,iBAAiB,CAAC,CAMtD;IAkBD,eAAe;IACf,qBAkBC;IAfC,eAAe;IACf,6BAAiG;IAEjG,eAAe;IACf,uCAEC;IAWH;;;OAGG;IACH,qBAkBC;IAED,eAAe;IACf,0BAYQ;IAER;;;OAGG;IACH,gCAkCE;IAEF;;;OAGG;IACH,0CA6FE;IAEF,eAAe;IACf,mCAsBE;IAEF,6BAiBC;IAED,eAAe;IACf,uBAyDC;IAED;;;OAGG;IACH,kCAHW,MAAM,qEAWhB;IAED;;;OAGG;IACH,oCAHa,OAAO,CAAC,OAAO,2BAA2B,EAAE,eAAe,CAAC,CA4BxE;IAED,kEAAkE;IAClE,iBADc,OAAO,sBAAsB,EAAE,eAAe,EAAE,CAK7D;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA/c6B,oBAAoB;qCAWb,2BAA2B;kCAG9B,wBAAwB;kCADxB,wBAAwB;gCAD1B,sBAAsB;kCAGpB,wBAAwB"}
1
+ {"version":3,"file":"UploaderBlock.d.ts","sourceRoot":"","sources":["UploaderBlock.js"],"names":[],"mappings":"AAmBA;IACE,iBAAiB;IACjB,mCAAwB;IAExB,eAAe;IACf,mBAAmB;IAEnB;;;;;;;;;;;;;;MAA+B;IAE/B,eAAe;IACf,0BAOC;IA2BD;;;OAGG;IACH,mCAHa,iBAAiB,CAQ7B;IAED,mCAAmC;IACnC,WADc,iBAAiB,CAM9B;IAED,4BAEC;IAED,2DAA2D;IAC3D,wBADc,eAAe,CAAC,OAAO,iBAAiB,CAAC,CAMtD;IAgCD,eAAe;IACf,sBAYC;IAED,eAAe;IACf,iCAUC;IAPC,eAAe;IACf,6BAAiG;IAEjG,eAAe;IACf,uCAEC;IAGH,eAAe;IACf,mCAMC;IAED;;;OAGG;IACH,qBAkBC;IAED,eAAe;IACf,0BAYQ;IAER;;;OAGG;IACH,gCAkCE;IAEF;;;OAGG;IACH,0CA6FE;IAEF,eAAe;IACf,mCAsBE;IAEF,6BAiBC;IAED,eAAe;IACf,uBAyDC;IAED;;;OAGG;IACH,kCAHW,MAAM,qEAWhB;IAED;;;OAGG;IACH,oCAHa,OAAO,CAAC,OAAO,2BAA2B,EAAE,eAAe,CAAC,CA4BxE;IAED,kEAAkE;IAClE,iBADc,OAAO,sBAAsB,EAAE,eAAe,EAAE,CAK7D;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA7e6B,oBAAoB;qCAWb,2BAA2B;kCAG9B,wBAAwB;kCADxB,wBAAwB;gCAD1B,sBAAsB;kCAGpB,wBAAwB"}
@@ -57,7 +57,7 @@ export class UploaderBlock extends ActivityBlock {
57
57
  }
58
58
 
59
59
  if (!this.hasCtxOwner && this.couldBeCtxOwner) {
60
- this.initCtxOwner();
60
+ this._initCtxOwner();
61
61
  }
62
62
  }
63
63
 
@@ -94,14 +94,28 @@ export class UploaderBlock extends ActivityBlock {
94
94
 
95
95
  /** @protected */
96
96
  destroyCtxCallback() {
97
- this._unobserveCollectionProperties?.();
98
- this._unobserveCollection?.();
99
97
  this.uploadCollection.destroy();
100
98
  this.$['*uploadCollection'] = null;
101
99
 
102
100
  super.destroyCtxCallback();
103
101
  }
104
102
 
103
+ disconnectedCallback() {
104
+ super.disconnectedCallback();
105
+
106
+ if (this.isCtxOwner) {
107
+ this._unobserveUploadCollection();
108
+ }
109
+ }
110
+
111
+ connectedCallback() {
112
+ super.connectedCallback();
113
+
114
+ if (this.isCtxOwner) {
115
+ this._observeUploadCollection();
116
+ }
117
+ }
118
+
105
119
  destroyCallback() {
106
120
  super.destroyCallback();
107
121
 
@@ -109,9 +123,24 @@ export class UploaderBlock extends ActivityBlock {
109
123
  }
110
124
 
111
125
  /** @private */
112
- initCtxOwner() {
126
+ _initCtxOwner() {
113
127
  this.isCtxOwner = true;
114
128
 
129
+ this._observeUploadCollection();
130
+
131
+ this.subConfigValue('maxConcurrentRequests', (value) => {
132
+ this.$['*uploadQueue'].concurrency = Number(value) || 1;
133
+ });
134
+
135
+ if (!this.$['*secureUploadsManager']) {
136
+ this.$['*secureUploadsManager'] = new SecureUploadsManager(this);
137
+ }
138
+ }
139
+
140
+ /** @private */
141
+ _observeUploadCollection() {
142
+ this._unobserveUploadCollection();
143
+
115
144
  /** @private */
116
145
  this._unobserveCollection = this.uploadCollection.observeCollection(this._handleCollectionUpdate);
117
146
 
@@ -119,14 +148,15 @@ export class UploaderBlock extends ActivityBlock {
119
148
  this._unobserveCollectionProperties = this.uploadCollection.observeProperties(
120
149
  this._handleCollectionPropertiesUpdate,
121
150
  );
151
+ }
122
152
 
123
- this.subConfigValue('maxConcurrentRequests', (value) => {
124
- this.$['*uploadQueue'].concurrency = Number(value) || 1;
125
- });
153
+ /** @private */
154
+ _unobserveUploadCollection() {
155
+ this._unobserveCollectionProperties?.();
156
+ this._unobserveCollection?.();
126
157
 
127
- if (!this.$['*secureUploadsManager']) {
128
- this.$['*secureUploadsManager'] = new SecureUploadsManager(this);
129
- }
158
+ this._unobserveCollectionProperties = undefined;
159
+ this._unobserveCollection = undefined;
130
160
  }
131
161
 
132
162
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.20.0",
3
+ "version": "1.20.1-alpha.0",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -119,7 +119,7 @@
119
119
  "nano-jsx": "^0.1.0",
120
120
  "node-watch": "^0.7.3",
121
121
  "npm-run-all": "^4.1.5",
122
- "playwright": "^1.51.1",
122
+ "playwright": "^1.55.0",
123
123
  "postcss": "^8.4.21",
124
124
  "prettier": "^3.2.4",
125
125
  "prettier-plugin-jsdoc": "1.3.0",