@uploadcare/file-uploader 1.25.0-alpha.1 → 1.25.0-alpha.3

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/dist/env.js CHANGED
@@ -25,7 +25,7 @@
25
25
  */
26
26
 
27
27
  // package.json
28
- var version = "1.25.0-alpha.1";
28
+ var version = "1.25.0-alpha.3";
29
29
 
30
30
  // src/env.ts
31
31
  var PACKAGE_NAME = "blocks";
package/dist/index.css CHANGED
@@ -255,7 +255,7 @@ uc-camera-source:not(#\#) .uc-camera-action {
255
255
  [uc-cloud-image-editor]:not(#\#):not(#\#):not(#\#) :is([can-handle-paste]:hover, [can-handle-paste]:focus) {
256
256
  --can-handle-paste: "true";
257
257
  }
258
- [uc-cloud-image-editor]:not(#\#):not(#\#):not(#\#) :is([tabindex][focus-visible], [tabindex]:hover, [with-effects][focus-visible], [with-effects]:hover) {
258
+ [uc-cloud-image-editor]:not(#\#):not(#\#):not(#\#) :is([tabindex]:focus-visible, [tabindex]:hover, [with-effects]:focus-visible, [with-effects]:hover) {
259
259
  --filter-effect: var(--hover-filter) !important;
260
260
  --opacity-effect: var(--hover-opacity) !important;
261
261
  --color-effect: var(--hover-color-rgb) !important;
package/dist/index.d.ts CHANGED
@@ -254,6 +254,9 @@ declare class CameraSource extends LitUploaderBlock {
254
254
  private _cameraDevices;
255
255
  private _audioDevices;
256
256
  private _permissionResponses;
257
+ private _permissionCleanupFns;
258
+ private readonly _handlePreviewPlay;
259
+ private readonly _handlePreviewPause;
257
260
  private timerRef;
258
261
  private lineRef;
259
262
  private videoRef;
@@ -306,6 +309,8 @@ declare class CameraSource extends LitUploaderBlock {
306
309
  * Previewing the video that was recorded on the camera
307
310
  */
308
311
  private _previewVideo;
312
+ private _attachPreviewListeners;
313
+ private _detachPreviewListeners;
309
314
  _retake: () => void;
310
315
  _accept: () => void;
311
316
  _handlePhoto: (status: CameraStatus) => void;
@@ -326,6 +331,7 @@ declare class CameraSource extends LitUploaderBlock {
326
331
  _capture: () => Promise<void>;
327
332
  _handlePermissionsChange: () => void;
328
333
  _permissionAccess: () => Promise<void>;
334
+ private _teardownPermissionListeners;
329
335
  _getPermission: () => void;
330
336
  _requestDeviceAccess: () => Promise<void>;
331
337
  _getDevices: () => Promise<void>;
@@ -1128,6 +1134,7 @@ declare class ExternalSource extends LitUploaderBlock {
1128
1134
  private mountIframe;
1129
1135
  private unmountIframe;
1130
1136
  private resetSelectionStatus;
1137
+ disconnectedCallback(): void;
1131
1138
  render(): lit_html.TemplateResult<1>;
1132
1139
  }
1133
1140
 
@@ -1999,7 +2006,7 @@ declare class FileItemConfig extends LitUploaderBlock {
1999
2006
 
2000
2007
  declare class FileItem extends FileItemConfig {
2001
2008
  couldBeCtxOwner: boolean;
2002
- pauseRender: boolean;
2009
+ private pauseRender;
2003
2010
  uid: string;
2004
2011
  protected itemName: string;
2005
2012
  protected errorText: string;
package/dist/index.js CHANGED
@@ -1050,7 +1050,7 @@ var config = {
1050
1050
  var initialConfig = Object.freeze(config);
1051
1051
 
1052
1052
  // package.json
1053
- var version = "1.25.0-alpha.1";
1053
+ var version = "1.25.0-alpha.3";
1054
1054
 
1055
1055
  // src/env.ts
1056
1056
  var PACKAGE_NAME = "blocks";
@@ -1531,6 +1531,7 @@ function SymbioteMixin(ctor) {
1531
1531
  this._ctxNameProvider = void 0;
1532
1532
  this._warnedAboutLocalState = false;
1533
1533
  this._pendingSharedAdds = /* @__PURE__ */ new Map();
1534
+ this._symbioteSubscriptions = /* @__PURE__ */ new Set();
1534
1535
  // Symbiote-style initial values declaration
1535
1536
  this.init$ = {};
1536
1537
  this.ctxOwner = false;
@@ -1725,8 +1726,22 @@ function SymbioteMixin(ctor) {
1725
1726
  sub(key, callback, init = true) {
1726
1727
  const sharedKey = this._requireSharedKey(key);
1727
1728
  const subscription = this._requireSharedPubSub().sub(sharedKey, callback, init);
1728
- return subscription ? subscription.remove : () => {
1729
+ if (!subscription || typeof subscription.remove !== "function") {
1730
+ return () => {
1731
+ };
1732
+ }
1733
+ const removeFn = subscription.remove.bind(subscription);
1734
+ let removed = false;
1735
+ const trackedRemove = () => {
1736
+ if (removed) {
1737
+ return;
1738
+ }
1739
+ removed = true;
1740
+ removeFn();
1741
+ this._symbioteSubscriptions.delete(trackedRemove);
1729
1742
  };
1743
+ this._symbioteSubscriptions.add(trackedRemove);
1744
+ return trackedRemove;
1730
1745
  }
1731
1746
  pub(key, value) {
1732
1747
  const sharedKey = this._requireSharedKey(key);
@@ -1827,11 +1842,21 @@ function SymbioteMixin(ctor) {
1827
1842
  }
1828
1843
  }
1829
1844
  disconnectedCallback() {
1845
+ this._cleanupSymbioteSubscriptions();
1830
1846
  super.disconnectedCallback();
1831
1847
  if (this._symbioteFirstUpdated) {
1832
1848
  this._needsReconnectInit = true;
1833
1849
  }
1834
1850
  }
1851
+ _cleanupSymbioteSubscriptions() {
1852
+ if (this._symbioteSubscriptions.size === 0) {
1853
+ return;
1854
+ }
1855
+ for (const unsubscribe of [...this._symbioteSubscriptions]) {
1856
+ unsubscribe();
1857
+ }
1858
+ this._symbioteSubscriptions.clear();
1859
+ }
1835
1860
  initCallback() {
1836
1861
  }
1837
1862
  }
@@ -4724,6 +4749,15 @@ var CameraSource = class extends LitUploaderBlock {
4724
4749
  this._cameraDevices = [];
4725
4750
  this._audioDevices = [];
4726
4751
  this._permissionResponses = {};
4752
+ this._permissionCleanupFns = [];
4753
+ this._handlePreviewPlay = () => {
4754
+ this._startTimeline();
4755
+ this.currentTimelineIcon = "pause";
4756
+ };
4757
+ this._handlePreviewPause = () => {
4758
+ this.currentTimelineIcon = "play";
4759
+ this._stopTimeline();
4760
+ };
4727
4761
  this.timerRef = createRef();
4728
4762
  this.lineRef = createRef();
4729
4763
  this.videoRef = createRef();
@@ -4980,14 +5014,7 @@ var CameraSource = class extends LitUploaderBlock {
4980
5014
  videoElement.volume = 1;
4981
5015
  this.video = null;
4982
5016
  videoElement.src = videoURL;
4983
- videoElement.addEventListener("play", () => {
4984
- this._startTimeline();
4985
- this.currentTimelineIcon = "pause";
4986
- });
4987
- videoElement.addEventListener("pause", () => {
4988
- this.currentTimelineIcon = "play";
4989
- this._stopTimeline();
4990
- });
5017
+ this._attachPreviewListeners(videoElement);
4991
5018
  } catch (error) {
4992
5019
  console.error("Failed to preview video", error);
4993
5020
  this.telemetryManager.sendEventError(error, "camera previewing. Failed to preview video");
@@ -5175,6 +5202,7 @@ var CameraSource = class extends LitUploaderBlock {
5175
5202
  }
5176
5203
  const tracks = this.video?.getTracks?.();
5177
5204
  tracks?.[0]?.stop();
5205
+ this._detachPreviewListeners(this.videoRef.value);
5178
5206
  this.video = null;
5179
5207
  this._makeStreamInactive();
5180
5208
  this._stopTimer();
@@ -5223,14 +5251,22 @@ var CameraSource = class extends LitUploaderBlock {
5223
5251
  };
5224
5252
  this._permissionAccess = async () => {
5225
5253
  try {
5254
+ this._teardownPermissionListeners();
5226
5255
  for (const permission of DEFAULT_PERMISSIONS) {
5227
5256
  const response = await navigator.permissions.query({
5228
5257
  name: permission
5229
5258
  });
5230
5259
  this._permissionResponses[permission] = response;
5231
5260
  response.addEventListener("change", this._handlePermissionsChange);
5261
+ this._permissionCleanupFns.push(() => {
5262
+ response.removeEventListener("change", this._handlePermissionsChange);
5263
+ });
5232
5264
  }
5265
+ this._unsubPermissions = () => {
5266
+ this._teardownPermissionListeners();
5267
+ };
5233
5268
  } catch (error) {
5269
+ this._teardownPermissionListeners();
5234
5270
  console.log("Failed to use permissions API. Fallback to manual request mode.", error);
5235
5271
  this.telemetryManager.sendEventError(error, "camera permissions. Failed to use permissions API");
5236
5272
  this._capture();
@@ -5298,6 +5334,15 @@ var CameraSource = class extends LitUploaderBlock {
5298
5334
  }
5299
5335
  };
5300
5336
  }
5337
+ _attachPreviewListeners(videoElement) {
5338
+ this._detachPreviewListeners(videoElement);
5339
+ videoElement.addEventListener("play", this._handlePreviewPlay);
5340
+ videoElement.addEventListener("pause", this._handlePreviewPause);
5341
+ }
5342
+ _detachPreviewListeners(videoElement) {
5343
+ videoElement?.removeEventListener("play", this._handlePreviewPlay);
5344
+ videoElement?.removeEventListener("pause", this._handlePreviewPause);
5345
+ }
5301
5346
  _shot() {
5302
5347
  this._setCameraState("shot");
5303
5348
  this._canvas = document.createElement("canvas");
@@ -5346,6 +5391,16 @@ var CameraSource = class extends LitUploaderBlock {
5346
5391
  (mode) => mode === CameraSourceTypes.PHOTO || mode === CameraSourceTypes.VIDEO
5347
5392
  );
5348
5393
  }
5394
+ _teardownPermissionListeners() {
5395
+ if (this._permissionCleanupFns.length === 0) {
5396
+ return;
5397
+ }
5398
+ for (const cleanup of this._permissionCleanupFns) {
5399
+ cleanup();
5400
+ }
5401
+ this._permissionCleanupFns = [];
5402
+ this._unsubPermissions = null;
5403
+ }
5349
5404
  initCallback() {
5350
5405
  super.initCallback();
5351
5406
  this.registerActivity(this.activityType, {
@@ -5370,10 +5425,9 @@ var CameraSource = class extends LitUploaderBlock {
5370
5425
  });
5371
5426
  }
5372
5427
  _destroy() {
5373
- for (const permission of DEFAULT_PERMISSIONS) {
5374
- this._permissionResponses[permission]?.removeEventListener("change", this._handlePermissionsChange);
5375
- }
5428
+ this._teardownPermissionListeners();
5376
5429
  navigator.mediaDevices?.removeEventListener("devicechange", this._getDevices);
5430
+ this._detachPreviewListeners(this.videoRef.value);
5377
5431
  }
5378
5432
  disconnectedCallback() {
5379
5433
  super.disconnectedCallback();
@@ -10677,6 +10731,10 @@ var ExternalSource = class extends LitUploaderBlock {
10677
10731
  this.doneBtnTextClass = "uc-hidden";
10678
10732
  this._latestSelectionSummary = null;
10679
10733
  }
10734
+ disconnectedCallback() {
10735
+ super.disconnectedCallback();
10736
+ this.unmountIframe();
10737
+ }
10680
10738
  render() {
10681
10739
  return html18`
10682
10740
  <uc-activity-header>
@@ -10819,13 +10877,13 @@ var FileItemConfig = class extends LitUploaderBlock {
10819
10877
 
10820
10878
  // src/blocks/FileItem/FileItem.ts
10821
10879
  var FileItemState = Object.freeze({
10822
- FINISHED: Symbol("FINISHED"),
10823
- FAILED: Symbol("FAILED"),
10824
- UPLOADING: Symbol("UPLOADING"),
10825
- VALIDATION: Symbol("VALIDATION"),
10826
- QUEUED_UPLOADING: Symbol("QUEUED-UPLOADING"),
10827
- QUEUED_VALIDATION: Symbol("QUEUED-VALIDATION"),
10828
- IDLE: Symbol("IDLE")
10880
+ FINISHED: /* @__PURE__ */ Symbol("FINISHED"),
10881
+ FAILED: /* @__PURE__ */ Symbol("FAILED"),
10882
+ UPLOADING: /* @__PURE__ */ Symbol("UPLOADING"),
10883
+ VALIDATION: /* @__PURE__ */ Symbol("VALIDATION"),
10884
+ QUEUED_UPLOADING: /* @__PURE__ */ Symbol("QUEUED-UPLOADING"),
10885
+ QUEUED_VALIDATION: /* @__PURE__ */ Symbol("QUEUED-VALIDATION"),
10886
+ IDLE: /* @__PURE__ */ Symbol("IDLE")
10829
10887
  });
10830
10888
  var _FileItem = class _FileItem extends FileItemConfig {
10831
10889
  constructor() {
@@ -11200,6 +11258,9 @@ var _FileItem = class _FileItem extends FileItemConfig {
11200
11258
  `;
11201
11259
  }
11202
11260
  };
11261
+ __decorateClass([
11262
+ state14()
11263
+ ], _FileItem.prototype, "pauseRender", 2);
11203
11264
  __decorateClass([
11204
11265
  property12({ type: String, attribute: false })
11205
11266
  ], _FileItem.prototype, "uid", 2);
@@ -13055,6 +13116,9 @@ __decorateClass([
13055
13116
  __decorateClass([
13056
13117
  state22()
13057
13118
  ], UploadList.prototype, "hasFiles", 2);
13119
+ __decorateClass([
13120
+ state22()
13121
+ ], UploadList.prototype, "_latestSummary", 2);
13058
13122
 
13059
13123
  // src/blocks/UrlSource/UrlSource.ts
13060
13124
  import { html as html32 } from "lit";
@@ -245,7 +245,7 @@
245
245
  [uc-cloud-image-editor] :is([can-handle-paste]:hover, [can-handle-paste]:focus) {
246
246
  --can-handle-paste: "true";
247
247
  }
248
- [uc-cloud-image-editor] :is([tabindex][focus-visible], [tabindex]:hover, [with-effects][focus-visible], [with-effects]:hover) {
248
+ [uc-cloud-image-editor] :is([tabindex]:focus-visible, [tabindex]:hover, [with-effects]:focus-visible, [with-effects]:hover) {
249
249
  --filter-effect: var(--hover-filter) !important;
250
250
  --opacity-effect: var(--hover-opacity) !important;
251
251
  --color-effect: var(--hover-color-rgb) !important;
package/dist/index.ssr.js CHANGED
@@ -892,7 +892,7 @@ export const ModalEvents = {
892
892
  DESTROY: "modal:destroy",
893
893
  };
894
894
  export const PACKAGE_NAME = `blocks`;
895
- export const PACKAGE_VERSION = `1.25.0-alpha.1`;
895
+ export const PACKAGE_VERSION = `1.25.0-alpha.3`;
896
896
  export const PresenceToggle = class {
897
897
  static elementProperties = {};
898
898
  static styleAttrs = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.25.0-alpha.1",
3
+ "version": "1.25.0-alpha.3",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -55,7 +55,6 @@
55
55
  "default": "./dist/index.layered.css"
56
56
  },
57
57
  "./abstract/loadFileUploaderFrom.js": "./dist/abstract/loadFileUploaderFrom.js",
58
- "./lit": "./dist/lit.js",
59
58
  "./env": "./dist/env.js",
60
59
  "./web/*": "./web/*",
61
60
  "./types/jsx": "./types/jsx.d.ts",
@@ -111,43 +110,43 @@
111
110
  },
112
111
  "devDependencies": {
113
112
  "@arethetypeswrong/cli": "^0.18.2",
114
- "@biomejs/biome": "2.3.6",
113
+ "@biomejs/biome": "2.3.8",
115
114
  "@biomejs/js-api": "^4.0.0",
116
- "@biomejs/wasm-nodejs": "^2.3.6",
115
+ "@biomejs/wasm-nodejs": "^2.3.8",
117
116
  "@csstools/postcss-cascade-layers": "^5.0.2",
118
- "@happy-dom/global-registrator": "^20.0.10",
119
- "@size-limit/esbuild-why": "^11.2.0",
120
- "@size-limit/preset-small-lib": "^11.2.0",
117
+ "@happy-dom/global-registrator": "^20.0.11",
118
+ "@size-limit/esbuild-why": "^12.0.0",
119
+ "@size-limit/preset-small-lib": "^12.0.0",
121
120
  "@total-typescript/ts-reset": "^0.6.1",
122
- "@types/node": "^24",
121
+ "@types/node": "^22",
123
122
  "@types/react": "^18.0.0",
124
123
  "@types/svg-sprite": "^0.0.39",
125
- "@vitest/browser": "^4.0.14",
126
- "@vitest/browser-playwright": "^4.0.14",
127
- "@vitest/coverage-v8": "^4.0.14",
128
- "esbuild": "^0.25.12",
124
+ "@vitest/browser": "^4.0.15",
125
+ "@vitest/browser-playwright": "^4.0.15",
126
+ "@vitest/coverage-v8": "^4.0.15",
127
+ "esbuild": "^0.27.1",
129
128
  "husky": "^9.1.7",
130
- "lint-staged": "^16.2.6",
129
+ "lint-staged": "^16.2.7",
131
130
  "node-watch": "^0.7.4",
132
131
  "npm-run-all": "^4.1.5",
133
- "playwright": "^1.56.1",
132
+ "playwright": "^1.57.0",
134
133
  "postcss": "^8.5.6",
135
134
  "publint": "^0.3.15",
136
135
  "render-jsx": "^0.2.4",
137
- "rimraf": "^6.1.0",
136
+ "rimraf": "^6.1.2",
138
137
  "shipjs": "^0.27.0",
139
- "size-limit": "^11.2.0",
140
- "stylelint": "^16.25.0",
138
+ "size-limit": "^12.0.0",
139
+ "stylelint": "^16.26.1",
141
140
  "stylelint-config-standard": "^39.0.1",
142
141
  "stylelint-declaration-block-no-ignored-properties": "^2.8.0",
143
142
  "stylelint-order": "^7.0.0",
144
143
  "svg-sprite": "^2.0.4",
145
144
  "tsd": "^0.33.0",
146
- "tsup": "^8.5.0",
147
- "tsx": "^4.20.6",
145
+ "tsup": "^8.5.1",
146
+ "tsx": "^4.21.0",
148
147
  "typescript": "^5.9.3",
149
148
  "vite": "npm:rolldown-vite@latest",
150
- "vitest": "^4.0.14",
149
+ "vitest": "^4.0.15",
151
150
  "vitest-browser-lit": "^1.0.1"
152
151
  },
153
152
  "author": "Uploadcare Inc.",
@@ -159,7 +158,7 @@
159
158
  "@uploadcare/image-shrink": "^6.18.2",
160
159
  "@uploadcare/quality-insights": "^6.18.2",
161
160
  "@uploadcare/upload-client": "^6.18.2",
162
- "keyux": "^0.7.1",
161
+ "keyux": "^0.11.3",
163
162
  "lit": "^3.3.1"
164
163
  },
165
164
  "size-limit": [
@@ -265,6 +265,9 @@ declare class CameraSource extends LitUploaderBlock {
265
265
  private _cameraDevices;
266
266
  private _audioDevices;
267
267
  private _permissionResponses;
268
+ private _permissionCleanupFns;
269
+ private readonly _handlePreviewPlay;
270
+ private readonly _handlePreviewPause;
268
271
  private timerRef;
269
272
  private lineRef;
270
273
  private videoRef;
@@ -317,6 +320,8 @@ declare class CameraSource extends LitUploaderBlock {
317
320
  * Previewing the video that was recorded on the camera
318
321
  */
319
322
  private _previewVideo;
323
+ private _attachPreviewListeners;
324
+ private _detachPreviewListeners;
320
325
  _retake: () => void;
321
326
  _accept: () => void;
322
327
  _handlePhoto: (status: CameraStatus) => void;
@@ -337,6 +342,7 @@ declare class CameraSource extends LitUploaderBlock {
337
342
  _capture: () => Promise<void>;
338
343
  _handlePermissionsChange: () => void;
339
344
  _permissionAccess: () => Promise<void>;
345
+ private _teardownPermissionListeners;
340
346
  _getPermission: () => void;
341
347
  _requestDeviceAccess: () => Promise<void>;
342
348
  _getDevices: () => Promise<void>;
@@ -1139,6 +1145,7 @@ declare class ExternalSource extends LitUploaderBlock {
1139
1145
  private mountIframe;
1140
1146
  private unmountIframe;
1141
1147
  private resetSelectionStatus;
1148
+ disconnectedCallback(): void;
1142
1149
  render(): lit_html.TemplateResult<1>;
1143
1150
  }
1144
1151
 
@@ -2010,7 +2017,7 @@ declare class FileItemConfig extends LitUploaderBlock {
2010
2017
 
2011
2018
  declare class FileItem extends FileItemConfig {
2012
2019
  couldBeCtxOwner: boolean;
2013
- pauseRender: boolean;
2020
+ private pauseRender;
2014
2021
  uid: string;
2015
2022
  protected itemName: string;
2016
2023
  protected errorText: string;