@uploadcare/file-uploader 1.25.0-alpha.2 → 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.2";
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.2";
1053
+ var version = "1.25.0-alpha.3";
1054
1054
 
1055
1055
  // src/env.ts
1056
1056
  var PACKAGE_NAME = "blocks";
@@ -4749,6 +4749,15 @@ var CameraSource = class extends LitUploaderBlock {
4749
4749
  this._cameraDevices = [];
4750
4750
  this._audioDevices = [];
4751
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
+ };
4752
4761
  this.timerRef = createRef();
4753
4762
  this.lineRef = createRef();
4754
4763
  this.videoRef = createRef();
@@ -5005,14 +5014,7 @@ var CameraSource = class extends LitUploaderBlock {
5005
5014
  videoElement.volume = 1;
5006
5015
  this.video = null;
5007
5016
  videoElement.src = videoURL;
5008
- videoElement.addEventListener("play", () => {
5009
- this._startTimeline();
5010
- this.currentTimelineIcon = "pause";
5011
- });
5012
- videoElement.addEventListener("pause", () => {
5013
- this.currentTimelineIcon = "play";
5014
- this._stopTimeline();
5015
- });
5017
+ this._attachPreviewListeners(videoElement);
5016
5018
  } catch (error) {
5017
5019
  console.error("Failed to preview video", error);
5018
5020
  this.telemetryManager.sendEventError(error, "camera previewing. Failed to preview video");
@@ -5200,6 +5202,7 @@ var CameraSource = class extends LitUploaderBlock {
5200
5202
  }
5201
5203
  const tracks = this.video?.getTracks?.();
5202
5204
  tracks?.[0]?.stop();
5205
+ this._detachPreviewListeners(this.videoRef.value);
5203
5206
  this.video = null;
5204
5207
  this._makeStreamInactive();
5205
5208
  this._stopTimer();
@@ -5248,14 +5251,22 @@ var CameraSource = class extends LitUploaderBlock {
5248
5251
  };
5249
5252
  this._permissionAccess = async () => {
5250
5253
  try {
5254
+ this._teardownPermissionListeners();
5251
5255
  for (const permission of DEFAULT_PERMISSIONS) {
5252
5256
  const response = await navigator.permissions.query({
5253
5257
  name: permission
5254
5258
  });
5255
5259
  this._permissionResponses[permission] = response;
5256
5260
  response.addEventListener("change", this._handlePermissionsChange);
5261
+ this._permissionCleanupFns.push(() => {
5262
+ response.removeEventListener("change", this._handlePermissionsChange);
5263
+ });
5257
5264
  }
5265
+ this._unsubPermissions = () => {
5266
+ this._teardownPermissionListeners();
5267
+ };
5258
5268
  } catch (error) {
5269
+ this._teardownPermissionListeners();
5259
5270
  console.log("Failed to use permissions API. Fallback to manual request mode.", error);
5260
5271
  this.telemetryManager.sendEventError(error, "camera permissions. Failed to use permissions API");
5261
5272
  this._capture();
@@ -5323,6 +5334,15 @@ var CameraSource = class extends LitUploaderBlock {
5323
5334
  }
5324
5335
  };
5325
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
+ }
5326
5346
  _shot() {
5327
5347
  this._setCameraState("shot");
5328
5348
  this._canvas = document.createElement("canvas");
@@ -5371,6 +5391,16 @@ var CameraSource = class extends LitUploaderBlock {
5371
5391
  (mode) => mode === CameraSourceTypes.PHOTO || mode === CameraSourceTypes.VIDEO
5372
5392
  );
5373
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
+ }
5374
5404
  initCallback() {
5375
5405
  super.initCallback();
5376
5406
  this.registerActivity(this.activityType, {
@@ -5395,10 +5425,9 @@ var CameraSource = class extends LitUploaderBlock {
5395
5425
  });
5396
5426
  }
5397
5427
  _destroy() {
5398
- for (const permission of DEFAULT_PERMISSIONS) {
5399
- this._permissionResponses[permission]?.removeEventListener("change", this._handlePermissionsChange);
5400
- }
5428
+ this._teardownPermissionListeners();
5401
5429
  navigator.mediaDevices?.removeEventListener("devicechange", this._getDevices);
5430
+ this._detachPreviewListeners(this.videoRef.value);
5402
5431
  }
5403
5432
  disconnectedCallback() {
5404
5433
  super.disconnectedCallback();
@@ -10702,6 +10731,10 @@ var ExternalSource = class extends LitUploaderBlock {
10702
10731
  this.doneBtnTextClass = "uc-hidden";
10703
10732
  this._latestSelectionSummary = null;
10704
10733
  }
10734
+ disconnectedCallback() {
10735
+ super.disconnectedCallback();
10736
+ this.unmountIframe();
10737
+ }
10705
10738
  render() {
10706
10739
  return html18`
10707
10740
  <uc-activity-header>
@@ -10844,13 +10877,13 @@ var FileItemConfig = class extends LitUploaderBlock {
10844
10877
 
10845
10878
  // src/blocks/FileItem/FileItem.ts
10846
10879
  var FileItemState = Object.freeze({
10847
- FINISHED: Symbol("FINISHED"),
10848
- FAILED: Symbol("FAILED"),
10849
- UPLOADING: Symbol("UPLOADING"),
10850
- VALIDATION: Symbol("VALIDATION"),
10851
- QUEUED_UPLOADING: Symbol("QUEUED-UPLOADING"),
10852
- QUEUED_VALIDATION: Symbol("QUEUED-VALIDATION"),
10853
- 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")
10854
10887
  });
10855
10888
  var _FileItem = class _FileItem extends FileItemConfig {
10856
10889
  constructor() {
@@ -11225,6 +11258,9 @@ var _FileItem = class _FileItem extends FileItemConfig {
11225
11258
  `;
11226
11259
  }
11227
11260
  };
11261
+ __decorateClass([
11262
+ state14()
11263
+ ], _FileItem.prototype, "pauseRender", 2);
11228
11264
  __decorateClass([
11229
11265
  property12({ type: String, attribute: false })
11230
11266
  ], _FileItem.prototype, "uid", 2);
@@ -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.2`;
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.2",
3
+ "version": "1.25.0-alpha.3",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -110,43 +110,43 @@
110
110
  },
111
111
  "devDependencies": {
112
112
  "@arethetypeswrong/cli": "^0.18.2",
113
- "@biomejs/biome": "2.3.6",
113
+ "@biomejs/biome": "2.3.8",
114
114
  "@biomejs/js-api": "^4.0.0",
115
- "@biomejs/wasm-nodejs": "^2.3.6",
115
+ "@biomejs/wasm-nodejs": "^2.3.8",
116
116
  "@csstools/postcss-cascade-layers": "^5.0.2",
117
- "@happy-dom/global-registrator": "^20.0.10",
118
- "@size-limit/esbuild-why": "^11.2.0",
119
- "@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",
120
120
  "@total-typescript/ts-reset": "^0.6.1",
121
- "@types/node": "^24",
121
+ "@types/node": "^22",
122
122
  "@types/react": "^18.0.0",
123
123
  "@types/svg-sprite": "^0.0.39",
124
- "@vitest/browser": "^4.0.14",
125
- "@vitest/browser-playwright": "^4.0.14",
126
- "@vitest/coverage-v8": "^4.0.14",
127
- "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",
128
128
  "husky": "^9.1.7",
129
- "lint-staged": "^16.2.6",
129
+ "lint-staged": "^16.2.7",
130
130
  "node-watch": "^0.7.4",
131
131
  "npm-run-all": "^4.1.5",
132
- "playwright": "^1.56.1",
132
+ "playwright": "^1.57.0",
133
133
  "postcss": "^8.5.6",
134
134
  "publint": "^0.3.15",
135
135
  "render-jsx": "^0.2.4",
136
- "rimraf": "^6.1.0",
136
+ "rimraf": "^6.1.2",
137
137
  "shipjs": "^0.27.0",
138
- "size-limit": "^11.2.0",
139
- "stylelint": "^16.25.0",
138
+ "size-limit": "^12.0.0",
139
+ "stylelint": "^16.26.1",
140
140
  "stylelint-config-standard": "^39.0.1",
141
141
  "stylelint-declaration-block-no-ignored-properties": "^2.8.0",
142
142
  "stylelint-order": "^7.0.0",
143
143
  "svg-sprite": "^2.0.4",
144
144
  "tsd": "^0.33.0",
145
- "tsup": "^8.5.0",
146
- "tsx": "^4.20.6",
145
+ "tsup": "^8.5.1",
146
+ "tsx": "^4.21.0",
147
147
  "typescript": "^5.9.3",
148
148
  "vite": "npm:rolldown-vite@latest",
149
- "vitest": "^4.0.14",
149
+ "vitest": "^4.0.15",
150
150
  "vitest-browser-lit": "^1.0.1"
151
151
  },
152
152
  "author": "Uploadcare Inc.",
@@ -158,7 +158,7 @@
158
158
  "@uploadcare/image-shrink": "^6.18.2",
159
159
  "@uploadcare/quality-insights": "^6.18.2",
160
160
  "@uploadcare/upload-client": "^6.18.2",
161
- "keyux": "^0.7.1",
161
+ "keyux": "^0.11.3",
162
162
  "lit": "^3.3.1"
163
163
  },
164
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;