@uploadcare/file-uploader 1.15.0-alpha.3 → 1.15.0-alpha.4

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 (48) hide show
  1. package/abstract/ActivityBlock.d.ts.map +1 -1
  2. package/abstract/ActivityBlock.js +3 -0
  3. package/abstract/UploaderBlock.js +1 -1
  4. package/blocks/Config/Config.d.ts +1 -1
  5. package/blocks/Config/Config.d.ts.map +1 -1
  6. package/blocks/Config/initialConfig.js +3 -3
  7. package/blocks/Config/normalizeConfigValue.d.ts +2 -1
  8. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  9. package/blocks/Config/normalizeConfigValue.js +18 -109
  10. package/blocks/Config/validatorsType.d.ts +37 -0
  11. package/blocks/Config/validatorsType.d.ts.map +1 -0
  12. package/blocks/Config/validatorsType.js +134 -0
  13. package/blocks/DropArea/DropArea.d.ts +1 -0
  14. package/blocks/DropArea/DropArea.d.ts.map +1 -1
  15. package/blocks/DropArea/DropArea.js +20 -2
  16. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  17. package/blocks/ExternalSource/ExternalSource.js +0 -1
  18. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  19. package/blocks/FileItem/FileItem.js +9 -3
  20. package/blocks/FileItem/file-item.css +24 -0
  21. package/blocks/ProgressBar/progress-bar.css +1 -0
  22. package/blocks/SimpleBtn/SimpleBtn.js +1 -1
  23. package/blocks/UploadList/UploadList.d.ts +2 -0
  24. package/blocks/UploadList/UploadList.d.ts.map +1 -1
  25. package/blocks/UploadList/UploadList.js +3 -1
  26. package/index.ssr.d.ts.map +1 -1
  27. package/index.ssr.js +12 -7
  28. package/package.json +1 -1
  29. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +1 -1
  30. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
  31. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +30 -8
  32. package/solutions/file-uploader/minimal/index.css +15 -14
  33. package/solutions/file-uploader/minimal/index.d.ts +1 -16
  34. package/solutions/file-uploader/minimal/index.js +1 -18
  35. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +1 -3
  36. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
  37. package/solutions/file-uploader/regular/FileUploaderRegular.js +1 -15
  38. package/types/exported.d.ts +4 -3
  39. package/web/file-uploader.iife.min.js +4 -4
  40. package/web/file-uploader.min.js +4 -4
  41. package/web/uc-basic.min.css +1 -1
  42. package/web/uc-cloud-image-editor.min.js +4 -4
  43. package/web/uc-file-uploader-inline.min.css +1 -1
  44. package/web/uc-file-uploader-inline.min.js +4 -4
  45. package/web/uc-file-uploader-minimal.min.css +1 -1
  46. package/web/uc-file-uploader-minimal.min.js +4 -4
  47. package/web/uc-file-uploader-regular.min.css +1 -1
  48. package/web/uc-file-uploader-regular.min.js +4 -4
package/index.ssr.js CHANGED
@@ -377,9 +377,9 @@ export const Config = class {
377
377
  "enable-audio-recording",
378
378
  "enable-video-recording",
379
379
  "max-video-recording-duration",
380
- "display-upload-list",
381
- "enable-file-name",
382
- "use-preview-image",
380
+ "files-view-mode",
381
+ "grid-show-file-names",
382
+ "cloud-image-editor-auto-open",
383
383
  "multiplemin",
384
384
  "multiplemax",
385
385
  "confirmupload",
@@ -425,9 +425,9 @@ export const Config = class {
425
425
  "enableaudiorecording",
426
426
  "enablevideorecording",
427
427
  "maxvideorecordingduration",
428
- "displayuploadlist",
429
- "enablefilename",
430
- "usepreviewimage",
428
+ "filesviewmode",
429
+ "gridshowfilenames",
430
+ "cloudimageeditorautoopen",
431
431
  ];
432
432
  static reg = () => {};
433
433
  static styleAttrs = [];
@@ -491,6 +491,7 @@ export const DropArea = class {
491
491
  "text",
492
492
  "fullscreen",
493
493
  "disabled",
494
+ "initflow",
494
495
  ];
495
496
  static extSrcList = {
496
497
  FACEBOOK: "facebook",
@@ -870,7 +871,11 @@ export const FileItem = class {
870
871
  <uc-icon name="upload"></uc-icon>
871
872
  </button>
872
873
  </div>
873
- <uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible;"> </uc-progress-bar>
874
+ <uc-progress-bar
875
+ class="uc-progress-bar"
876
+ set="value: progressValue; visible: progressVisible; @hasFileName: !isFileName"
877
+ >
878
+ </uc-progress-bar>
874
879
  </div>
875
880
  `;
876
881
  static activeInstances = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.15.0-alpha.3",
3
+ "version": "1.15.0-alpha.4",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -5,7 +5,7 @@ export class FileUploaderMinimal extends SolutionBlock {
5
5
  '*uploadList': never[];
6
6
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
7
7
  '*collectionErrors': any[];
8
- '*collectionState': import("../inline/index.js").OutputCollectionState<import("../inline/index.js").OutputCollectionStatus, "maybe-has-group"> | null;
8
+ '*collectionState': import("./index.js").OutputCollectionState<import("./index.js").OutputCollectionStatus, "maybe-has-group"> | null;
9
9
  '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
10
10
  '*uploadTrigger': Set<string>;
11
11
  '*secureUploadsManager': import("../../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;;;;;;;;;;MAGC;CAsDJ;;;;8BAlE6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;;;;;;;;;;MAGC;CAwDJ;;;;8BApE6B,oCAAoC"}
@@ -20,6 +20,10 @@ export class FileUploaderMinimal extends SolutionBlock {
20
20
  /** @type {import('../../../abstract/UploaderBlock.js').UploaderBlock} */
21
21
  const uBlock = this.ref.uBlock;
22
22
  this.sub('*currentActivity', (val) => {
23
+ if (val === ActivityBlock.activities.UPLOAD_LIST) {
24
+ this.modalManager.closeAll();
25
+ }
26
+
23
27
  if (!val) {
24
28
  this.$['*currentActivity'] = uBlock.initActivity || ActivityBlock.activities.START_FROM;
25
29
  }
@@ -33,19 +37,13 @@ export class FileUploaderMinimal extends SolutionBlock {
33
37
  }
34
38
  });
35
39
 
36
- this.subConfigValue('sourceList', (sourceList) => {
37
- if (sourceList !== 'local') {
38
- this.cfg.sourceList = 'local';
39
- }
40
- });
41
-
42
40
  this.subConfigValue('confirmUpload', (confirmUpload) => {
43
41
  if (confirmUpload !== false) {
44
42
  this.cfg.confirmUpload = false;
45
43
  }
46
44
  });
47
45
 
48
- this.subConfigValue('displayUploadList', (mode) => {
46
+ this.subConfigValue('filesViewMode', (mode) => {
49
47
  this.setAttribute('mode', mode);
50
48
  });
51
49
 
@@ -60,6 +58,10 @@ export class FileUploaderMinimal extends SolutionBlock {
60
58
  });
61
59
 
62
60
  this.modalManager.subscribe(ModalEvents.CLOSE, (e) => {
61
+ if (e.id === this.$['*currentActivity']) {
62
+ this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
63
+ }
64
+
63
65
  if (e.id === ActivityBlock.activities.CLOUD_IMG_EDIT) {
64
66
  this.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
65
67
  }
@@ -69,11 +71,31 @@ export class FileUploaderMinimal extends SolutionBlock {
69
71
 
70
72
  FileUploaderMinimal.template = /* HTML */ `
71
73
  <uc-start-from>
72
- <uc-drop-area set="@single:singleUpload" tabindex="0" clickable l10n="choose-file"></uc-drop-area>
74
+ <uc-drop-area set="@single:singleUpload;" initflow clickable tabindex="0" l10n="choose-file"></uc-drop-area>
73
75
  <uc-copyright></uc-copyright>
74
76
  </uc-start-from>
75
77
  <uc-upload-list ref="uBlock"></uc-upload-list>
76
78
 
79
+ <uc-modal id="start-from" strokes block-body-scrolling>
80
+ <uc-start-from>
81
+ <uc-drop-area with-icon clickable></uc-drop-area>
82
+ <uc-source-list role="list" wrap></uc-source-list>
83
+ <button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button>
84
+ </uc-start-from>
85
+ </uc-modal>
86
+
87
+ <uc-modal id="camera" strokes block-body-scrolling>
88
+ <uc-camera-source></uc-camera-source>
89
+ </uc-modal>
90
+
91
+ <uc-modal id="url" strokes block-body-scrolling>
92
+ <uc-url-source></uc-url-source>
93
+ </uc-modal>
94
+
95
+ <uc-modal id="external" strokes block-body-scrolling>
96
+ <uc-external-source></uc-external-source>
97
+ </uc-modal>
98
+
77
99
  <uc-modal id="cloud-image-edit" strokes block-body-scrolling>
78
100
  <uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>
79
101
  </uc-modal>
@@ -1,13 +1,18 @@
1
- @import url('../../../blocks/themes/uc-basic/config.css');
1
+ @import url('../../../blocks/themes/uc-basic/index.css');
2
+
3
+ /* @import url('../../../blocks/themes/uc-basic/config.css'); */
2
4
 
3
5
  /* COMMON STYLES */
4
- @import url('../../../blocks/themes/uc-basic/common.css');
6
+
7
+ /* @import url('../../../blocks/themes/uc-basic/common.css'); */
5
8
 
6
9
  /* THEME */
7
- @import url('../../../blocks/themes/uc-basic/theme.css');
10
+
11
+ /* @import url('../../../blocks/themes/uc-basic/theme.css'); */
8
12
 
9
13
  /* BLOCKS: */
10
- @import url('../../../blocks/StartFrom/start-from.css');
14
+
15
+ /* @import url('../../../blocks/StartFrom/start-from.css');
11
16
  @import url('../../../blocks/DropArea/drop-area.css');
12
17
  @import url('../../../blocks/UploadList/upload-list.css');
13
18
  @import url('../../../blocks/FileItem/file-item.css');
@@ -16,7 +21,7 @@
16
21
  @import url('../../../blocks/Copyright/copyright.css');
17
22
  @import url('../../../blocks/Modal/modal.css');
18
23
  @import url('../../../blocks/CloudImageEditor/index.css');
19
- @import url('../../../blocks/CloudImageEditorActivity/index.css');
24
+ @import url('../../../blocks/CloudImageEditorActivity/index.css'); */
20
25
 
21
26
  /* ICONS: */
22
27
  :where([uc-file-uploader-minimal]) {
@@ -27,7 +32,7 @@
27
32
  display: block;
28
33
  }
29
34
 
30
- [uc-file-uploader-minimal] uc-start-from .uc-content {
35
+ [uc-file-uploader-minimal] > uc-start-from .uc-content {
31
36
  display: flex;
32
37
  flex-direction: column;
33
38
  gap: 4px;
@@ -37,7 +42,7 @@
37
42
  background-color: transparent;
38
43
  }
39
44
 
40
- :where([uc-file-uploader-minimal] uc-drop-area) {
45
+ :where([uc-file-uploader-minimal] > uc-start-from uc-drop-area) {
41
46
  display: flex;
42
47
  position: relative;
43
48
  align-items: center;
@@ -50,12 +55,12 @@
50
55
  border-radius: calc(var(--uc-radius) * 1.75);
51
56
  }
52
57
 
53
- :where(.uc-contrast) :where([uc-file-uploader-minimal] uc-drop-area) {
58
+ :where(.uc-contrast) :where([uc-file-uploader-minimal] > uc-start-from uc-drop-area) {
54
59
  background-color: transparent;
55
60
  }
56
61
 
57
62
  /* hack to make transparent :hover colors work in any conditions */
58
- :where([uc-file-uploader-minimal] uc-drop-area)::before {
63
+ :where([uc-file-uploader-minimal] > uc-start-from uc-drop-area)::before {
59
64
  content: '';
60
65
  z-index: -1;
61
66
  width: 100%;
@@ -64,7 +69,7 @@
64
69
  background-color: var(--uc-background);
65
70
  }
66
71
 
67
- :where([uc-file-uploader-minimal]:has([single]) uc-drop-area) {
72
+ :where([uc-file-uploader-minimal]:has([single]) > uc-start-from uc-drop-area) {
68
73
  aspect-ratio: var(--uc-grid-aspect-ratio);
69
74
  }
70
75
 
@@ -118,10 +123,6 @@
118
123
  display: flex;
119
124
  }
120
125
 
121
- [uc-file-uploader-minimal] uc-file-item .uc-edit-btn {
122
- /* display: none; */
123
- }
124
-
125
126
  [uc-file-uploader-minimal] uc-file-item uc-progress-bar {
126
127
  top: 0 !important;
127
128
  height: 100% !important;
@@ -1,17 +1,2 @@
1
- export { defineComponents } from "../../../abstract/defineComponents.js";
2
- export { defineLocale } from "../../../abstract/localeRegistry.js";
3
- export { FileUploaderMinimal } from "./FileUploaderMinimal.js";
4
- export { StartFrom } from "../../../blocks/StartFrom/StartFrom.js";
5
- export { DropArea } from "../../../blocks/DropArea/DropArea.js";
6
- export { UploadList } from "../../../blocks/UploadList/UploadList.js";
7
- export { FileItem } from "../../../blocks/FileItem/FileItem.js";
8
- export { Icon } from "../../../blocks/Icon/Icon.js";
9
- export { ProgressBar } from "../../../blocks/ProgressBar/ProgressBar.js";
10
- export { Copyright } from "../../../blocks/Copyright/Copyright.js";
11
- export { FormInput } from "../../../blocks/FormInput/FormInput.js";
12
- export { Config } from "../../../blocks/Config/Config.js";
13
- export { UploadCtxProvider } from "../../../blocks/UploadCtxProvider/UploadCtxProvider.js";
14
- export { Modal } from "../../../blocks/Modal/Modal.js";
15
- export * from "../../../blocks/CloudImageEditor/index.js";
16
- export { CloudImageEditorActivity } from "../../../blocks/CloudImageEditorActivity/CloudImageEditorActivity.js";
1
+ export * from "../../../index.js";
17
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,18 +1 @@
1
- export { defineComponents } from '../../../abstract/defineComponents.js';
2
- export { defineLocale } from '../../../abstract/localeRegistry.js';
3
- export { FileUploaderMinimal } from './FileUploaderMinimal.js';
4
- export { StartFrom } from '../../../blocks/StartFrom/StartFrom.js';
5
- export { DropArea } from '../../../blocks/DropArea/DropArea.js';
6
- export { UploadList } from '../../../blocks/UploadList/UploadList.js';
7
- export { FileItem } from '../../../blocks/FileItem/FileItem.js';
8
- export { Icon } from '../../../blocks/Icon/Icon.js';
9
- export { ProgressBar } from '../../../blocks/ProgressBar/ProgressBar.js';
10
- export { Copyright } from '../../../blocks/Copyright/Copyright.js';
11
- export { FormInput } from '../../../blocks/FormInput/FormInput.js';
12
- export { Config } from '../../../blocks/Config/Config.js';
13
- export { UploadCtxProvider } from '../../../blocks/UploadCtxProvider/UploadCtxProvider.js';
14
-
15
- export { Modal } from '../../../blocks/Modal/Modal.js';
16
-
17
- export * from '../../../blocks/CloudImageEditor/index.js';
18
- export { CloudImageEditorActivity } from '../../../blocks/CloudImageEditorActivity/CloudImageEditorActivity.js';
1
+ export * from '../../../index.js';
@@ -1,7 +1,7 @@
1
1
  export class FileUploaderRegular extends SolutionBlock {
2
2
  init$: {
3
3
  isHidden: boolean;
4
- /** @param {unknown} value */ '*commonProgress': number;
4
+ '*commonProgress': number;
5
5
  '*uploadList': never[];
6
6
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
7
7
  '*collectionErrors': any[];
@@ -15,8 +15,6 @@ export class FileUploaderRegular extends SolutionBlock {
15
15
  '*historyBack': null;
16
16
  '*closeModal': () => void;
17
17
  };
18
- /** @private */
19
- private _lastModalActive;
20
18
  }
21
19
  export namespace FileUploaderRegular {
22
20
  let template: string;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderRegular.d.ts","sourceRoot":"","sources":["FileUploaderRegular.js"],"names":[],"mappings":"AAKA;IAMI;;QAWE,6BAA6B;;;;;;;;;;;;;MAR9B;IAoBG,eAAe;IACf,yBAAmC;CAK1C;;;;8BAvC6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderRegular.d.ts","sourceRoot":"","sources":["FileUploaderRegular.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;;;;;;;;;;MAGC;CAaJ;;;;8BAzB6B,oCAAoC"}
@@ -1,7 +1,6 @@
1
1
  // @ts-check
2
2
  import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
3
- import { asBoolean } from '../../../blocks/Config/normalizeConfigValue.js';
4
- import { EventType } from '../../../blocks/UploadCtxProvider/EventEmitter.js';
3
+ import { asBoolean } from '../../../blocks/Config/validatorsType.js';
5
4
 
6
5
  export class FileUploaderRegular extends SolutionBlock {
7
6
  static styleAttrs = [...super.styleAttrs, 'uc-file-uploader-regular'];
@@ -24,19 +23,6 @@ export class FileUploaderRegular extends SolutionBlock {
24
23
  this.set$({ isHidden: asBoolean(value) });
25
24
  },
26
25
  );
27
-
28
- this.sub(
29
- '*modalActive',
30
- (modalActive) => {
31
- if (this._lastModalActive !== modalActive) {
32
- this.emit(modalActive ? EventType.MODAL_OPEN : EventType.MODAL_CLOSE, undefined, { debounce: true });
33
- }
34
-
35
- /** @private */
36
- this._lastModalActive = modalActive;
37
- },
38
- false,
39
- );
40
26
  }
41
27
  }
42
28
 
@@ -2,6 +2,7 @@ import type { LocaleDefinition } from '../abstract/localeRegistry';
2
2
  import type { complexConfigKeys } from '../blocks/Config/Config';
3
3
  import type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager';
4
4
  import type { CameraMode } from '../blocks/CameraSource/CameraSource';
5
+ import type { FilesViewMode } from '../blocks/UploadList/UploadList';
5
6
 
6
7
  export type { FuncFileValidator, FuncCollectionValidator } from '../abstract/ValidationManager';
7
8
  export type { UploaderPublicApi } from '../abstract/UploaderPublicApi';
@@ -279,11 +280,11 @@ export type ConfigType = {
279
280
  */
280
281
  mediaRecorderOptions: MediaRecorderOptions | null;
281
282
 
282
- displayUploadList: string;
283
+ filesViewMode: FilesViewMode;
283
284
 
284
- enableFileName: boolean;
285
+ gridShowFileNames: boolean;
285
286
 
286
- usePreviewImage: boolean;
287
+ cloudImageEditorAutoOpen: boolean;
287
288
  };
288
289
  export type ConfigComplexType = Pick<ConfigType, (typeof complexConfigKeys)[number]>;
289
290
  export type ConfigPlainType = Omit<ConfigType, keyof ConfigComplexType>;