@uploadcare/file-uploader 1.5.3-alpha.6 → 1.6.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.
Files changed (217) hide show
  1. package/README.md +4 -4
  2. package/abstract/ActivityBlock.d.ts +3 -3
  3. package/abstract/ActivityBlock.d.ts.map +1 -1
  4. package/abstract/Block.d.ts +11 -4
  5. package/abstract/Block.d.ts.map +1 -1
  6. package/abstract/Block.js +16 -16
  7. package/abstract/CTX.d.ts +7 -7
  8. package/abstract/CTX.d.ts.map +1 -1
  9. package/abstract/CTX.js +1 -1
  10. package/abstract/LocaleManager.d.ts +3 -3
  11. package/abstract/SecureUploadsManager.d.ts +2 -2
  12. package/abstract/SecureUploadsManager.d.ts.map +1 -1
  13. package/abstract/SolutionBlock.d.ts +2 -2
  14. package/abstract/SolutionBlock.d.ts.map +1 -1
  15. package/abstract/TypedCollection.d.ts +1 -1
  16. package/abstract/TypedCollection.d.ts.map +1 -1
  17. package/abstract/TypedCollection.js +4 -4
  18. package/abstract/TypedData.d.ts +2 -2
  19. package/abstract/TypedData.d.ts.map +1 -1
  20. package/abstract/TypedData.js +4 -4
  21. package/abstract/UploaderBlock.d.ts +9 -6
  22. package/abstract/UploaderBlock.d.ts.map +1 -1
  23. package/abstract/UploaderBlock.js +16 -23
  24. package/abstract/UploaderPublicApi.d.ts +21 -22
  25. package/abstract/UploaderPublicApi.d.ts.map +1 -1
  26. package/abstract/UploaderPublicApi.js +4 -3
  27. package/abstract/ValidationManager.d.ts +3 -3
  28. package/abstract/ValidationManager.d.ts.map +1 -1
  29. package/abstract/a11y.d.ts +2 -2
  30. package/abstract/a11y.d.ts.map +1 -1
  31. package/abstract/buildOutputCollectionState.d.ts +1 -1
  32. package/abstract/buildOutputCollectionState.d.ts.map +1 -1
  33. package/abstract/defineComponents.d.ts.map +1 -1
  34. package/abstract/defineComponents.js +0 -5
  35. package/abstract/l10nProcessor.d.ts.map +1 -1
  36. package/abstract/l10nProcessor.js +3 -3
  37. package/abstract/loadFileUploaderFrom.d.ts.map +1 -1
  38. package/abstract/localeRegistry.d.ts.map +1 -1
  39. package/abstract/sharedConfigKey.d.ts.map +1 -1
  40. package/abstract/uploadEntrySchema.d.ts +4 -2
  41. package/abstract/uploadEntrySchema.d.ts.map +1 -1
  42. package/abstract/uploadEntrySchema.js +2 -1
  43. package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
  44. package/blocks/CameraSource/CameraSource.js +4 -5
  45. package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +1 -1
  46. package/blocks/CloudImageEditor/src/CropFrame.d.ts +11 -11
  47. package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +1 -1
  48. package/blocks/CloudImageEditor/src/CropFrame.js +1 -2
  49. package/blocks/CloudImageEditor/src/EditorButtonControl.d.ts.map +1 -1
  50. package/blocks/CloudImageEditor/src/EditorButtonControl.js +1 -2
  51. package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -1
  52. package/blocks/CloudImageEditor/src/EditorFilterControl.js +7 -3
  53. package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +3 -3
  54. package/blocks/CloudImageEditor/src/EditorImageCropper.js +2 -2
  55. package/blocks/CloudImageEditor/src/EditorImageFader.d.ts +1 -1
  56. package/blocks/CloudImageEditor/src/EditorImageFader.d.ts.map +1 -1
  57. package/blocks/CloudImageEditor/src/EditorOperationControl.js +1 -1
  58. package/blocks/CloudImageEditor/src/EditorScroller.d.ts.map +1 -1
  59. package/blocks/CloudImageEditor/src/EditorScroller.js +1 -2
  60. package/blocks/CloudImageEditor/src/EditorSlider.d.ts.map +1 -1
  61. package/blocks/CloudImageEditor/src/EditorSlider.js +1 -2
  62. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +1 -1
  63. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -1
  64. package/blocks/CloudImageEditor/src/EditorToolbar.js +3 -4
  65. package/blocks/CloudImageEditor/src/crop-utils.d.ts +14 -14
  66. package/blocks/CloudImageEditor/src/crop-utils.d.ts.map +1 -1
  67. package/blocks/CloudImageEditor/src/css/common.css +2 -2
  68. package/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts.map +1 -1
  69. package/blocks/CloudImageEditor/src/elements/button/BtnUi.js +3 -3
  70. package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts.map +1 -1
  71. package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js +1 -2
  72. package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts.map +1 -1
  73. package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js +2 -3
  74. package/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts.map +1 -1
  75. package/blocks/CloudImageEditor/src/elements/slider/SliderUi.js +1 -2
  76. package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts +15 -0
  77. package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts.map +1 -0
  78. package/blocks/CloudImageEditor/src/lib/FocusVisible.js +33 -0
  79. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts +10 -0
  80. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts.map +1 -0
  81. package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js +256 -0
  82. package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +1 -1
  83. package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +3 -3
  84. package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts.map +1 -1
  85. package/blocks/CloudImageEditor/src/state.d.ts +4 -4
  86. package/blocks/CloudImageEditor/src/template.d.ts.map +1 -1
  87. package/blocks/CloudImageEditor/src/template.js +1 -2
  88. package/blocks/CloudImageEditor/src/types.d.ts +2 -2
  89. package/blocks/CloudImageEditor/src/types.d.ts.map +1 -1
  90. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +1 -1
  91. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +1 -1
  92. package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +1 -2
  93. package/blocks/Config/Config.d.ts +11 -3
  94. package/blocks/Config/Config.d.ts.map +1 -1
  95. package/blocks/Config/initialConfig.d.ts +1 -1
  96. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  97. package/blocks/Copyright/Copyright.d.ts.map +1 -1
  98. package/blocks/Copyright/Copyright.js +1 -2
  99. package/blocks/DropArea/DropArea.d.ts +2 -2
  100. package/blocks/DropArea/DropArea.d.ts.map +1 -1
  101. package/blocks/DropArea/DropArea.js +4 -4
  102. package/blocks/DropArea/addDropzone.d.ts.map +1 -1
  103. package/blocks/DropArea/getDropItems.d.ts +2 -2
  104. package/blocks/DropArea/getDropItems.d.ts.map +1 -1
  105. package/blocks/ExternalSource/ExternalSource.d.ts +5 -5
  106. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  107. package/blocks/ExternalSource/ExternalSource.js +3 -3
  108. package/blocks/ExternalSource/buildStyles.js +2 -2
  109. package/blocks/ExternalSource/query-string.d.ts.map +1 -1
  110. package/blocks/FileItem/FileItem.d.ts +2 -2
  111. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  112. package/blocks/FileItem/FileItem.js +3 -3
  113. package/blocks/FormInput/FormInput.js +1 -1
  114. package/blocks/Icon/Icon.d.ts +1 -0
  115. package/blocks/Icon/Icon.d.ts.map +1 -1
  116. package/blocks/Icon/Icon.js +4 -2
  117. package/blocks/Img/ImgBase.js +9 -9
  118. package/blocks/Img/ImgConfig.d.ts +2 -2
  119. package/blocks/Img/ImgConfig.d.ts.map +1 -1
  120. package/blocks/Img/ImgConfig.js +3 -3
  121. package/blocks/Img/utils/parseObjectToString.js +1 -1
  122. package/blocks/Modal/Modal.d.ts.map +1 -1
  123. package/blocks/Modal/Modal.js +1 -2
  124. package/blocks/ProgressBar/ProgressBar.d.ts.map +1 -1
  125. package/blocks/ProgressBar/ProgressBar.js +1 -2
  126. package/blocks/ProgressBarCommon/ProgressBarCommon.d.ts.map +1 -1
  127. package/blocks/ProgressBarCommon/ProgressBarCommon.js +1 -2
  128. package/blocks/Range/Range.d.ts +16 -0
  129. package/blocks/Range/Range.d.ts.map +1 -0
  130. package/blocks/Range/Range.js +44 -0
  131. package/blocks/Range/range.css +65 -0
  132. package/blocks/Select/Select.d.ts.map +1 -1
  133. package/blocks/Select/Select.js +9 -14
  134. package/blocks/SimpleBtn/SimpleBtn.d.ts +2 -2
  135. package/blocks/SimpleBtn/SimpleBtn.d.ts.map +1 -1
  136. package/blocks/SimpleBtn/SimpleBtn.js +1 -2
  137. package/blocks/SourceBtn/SourceBtn.d.ts +2 -2
  138. package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -1
  139. package/blocks/SourceBtn/SourceBtn.js +8 -7
  140. package/blocks/SourceList/SourceList.d.ts.map +1 -1
  141. package/blocks/SourceList/SourceList.js +4 -5
  142. package/blocks/StartFrom/StartFrom.d.ts.map +1 -1
  143. package/blocks/StartFrom/StartFrom.js +1 -2
  144. package/blocks/UploadCtxProvider/EventEmitter.d.ts +19 -19
  145. package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -1
  146. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +4 -4
  147. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +1 -1
  148. package/blocks/UploadList/UploadList.d.ts +2 -2
  149. package/blocks/UploadList/UploadList.d.ts.map +1 -1
  150. package/blocks/UploadList/UploadList.js +4 -3
  151. package/blocks/UrlSource/UrlSource.d.ts.map +1 -1
  152. package/blocks/UrlSource/UrlSource.js +3 -4
  153. package/blocks/themes/uc-basic/index.css +1 -0
  154. package/blocks/utils/UploadSource.d.ts +27 -1
  155. package/blocks/utils/UploadSource.d.ts.map +1 -1
  156. package/blocks/utils/UploadSource.js +20 -1
  157. package/blocks/utils/debounce.d.ts +1 -3
  158. package/blocks/utils/debounce.d.ts.map +1 -1
  159. package/blocks/utils/throttle.d.ts +1 -3
  160. package/blocks/utils/throttle.d.ts.map +1 -1
  161. package/blocks/utils/userAgent.d.ts +1 -1
  162. package/blocks/utils/userAgent.d.ts.map +1 -1
  163. package/env.d.ts +1 -1
  164. package/env.js +1 -1
  165. package/index.d.ts +2 -1
  166. package/index.js +2 -1
  167. package/index.ssr.d.ts +98 -129
  168. package/index.ssr.d.ts.map +1 -1
  169. package/index.ssr.js +93 -132
  170. package/package.json +8 -12
  171. package/solutions/file-uploader/inline/FileUploaderInline.d.ts +2 -2
  172. package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -1
  173. package/solutions/file-uploader/inline/FileUploaderInline.js +4 -3
  174. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
  175. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +1 -2
  176. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +3 -3
  177. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
  178. package/solutions/file-uploader/regular/FileUploaderRegular.js +1 -2
  179. package/types/exported.d.ts +2 -0
  180. package/types/jsx.d.ts +3 -9
  181. package/utils/getPluralForm.d.ts.map +1 -1
  182. package/utils/isSecureTokenExpired.d.ts +1 -1
  183. package/utils/memoize.d.ts.map +1 -1
  184. package/utils/mixinClass.d.ts +1 -3
  185. package/utils/mixinClass.d.ts.map +1 -1
  186. package/utils/prettyBytes.d.ts.map +1 -1
  187. package/utils/template-utils.d.ts.map +1 -1
  188. package/utils/toKebabCase.d.ts.map +1 -1
  189. package/utils/uniqueArray.d.ts.map +1 -1
  190. package/utils/validators/collection/validateCollectionUploadError.d.ts +1 -1
  191. package/utils/validators/collection/validateMultiple.d.ts +1 -1
  192. package/utils/validators/file/validateFileType.d.ts +1 -1
  193. package/utils/validators/file/validateIsImage.d.ts +1 -1
  194. package/utils/validators/file/validateMaxSizeLimit.d.ts +1 -1
  195. package/utils/validators/file/validateUploadError.d.ts +1 -1
  196. package/utils/waitForAttribute.d.ts +6 -12
  197. package/utils/waitForAttribute.d.ts.map +1 -1
  198. package/utils/waitForAttribute.js +8 -38
  199. package/utils/waitForAttribute.test.js +47 -10
  200. package/web/file-uploader.iife.min.js +4 -5
  201. package/web/file-uploader.min.js +4 -5
  202. package/web/uc-basic.min.css +1 -1
  203. package/web/uc-cloud-image-editor.min.css +1 -1
  204. package/web/uc-cloud-image-editor.min.js +4 -5
  205. package/web/uc-file-uploader-inline.min.css +1 -1
  206. package/web/uc-file-uploader-inline.min.js +4 -5
  207. package/web/uc-file-uploader-minimal.min.js +3 -4
  208. package/web/uc-file-uploader-regular.min.css +1 -1
  209. package/web/uc-file-uploader-regular.min.js +4 -5
  210. package/web/uc-img.min.js +3 -4
  211. package/symbiote.js +0 -18
  212. package/utils/withResolvers.d.ts +0 -7
  213. package/utils/withResolvers.d.ts.map +0 -1
  214. package/utils/withResolvers.js +0 -17
  215. package/utils/withResolvers.test.d.ts +0 -2
  216. package/utils/withResolvers.test.d.ts.map +0 -1
  217. package/utils/withResolvers.test.js +0 -27
@@ -5,8 +5,8 @@ export class FileUploaderInline extends SolutionBlock {
5
5
  '*commonProgress': number;
6
6
  '*uploadList': never[];
7
7
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
8
- '*collectionErrors': import("./index.js").OutputErrorCollection[];
9
- '*collectionState': import("./index.js").OutputCollectionState | null;
8
+ '*collectionErrors': any[];
9
+ '*collectionState': import("./index.js").OutputCollectionState<import("./index.js").OutputCollectionStatus, "maybe-has-group"> | null;
10
10
  '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
11
11
  '*uploadTrigger': Set<string>;
12
12
  '*secureUploadsManager': import("../../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderInline.d.ts","sourceRoot":"","sources":["FileUploaderInline.js"],"names":[],"mappings":"AAKA;IAMI;;;;;;oCAUA,YACF;mCAIK,YAAU;6BAAmF,2BAGhF;;wCAOf,2CAA2B;;;;;;MAf3B;IAGH,gCAGC;IAED,6BAEC;CA0BF;;;;8BAtD6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderInline.d.ts","sourceRoot":"","sources":["FileUploaderInline.js"],"names":[],"mappings":"AAIA;IAMI;;;;;;;;;;;;;;;;MAUC;IAGH,gCAGC;IAED,6BAEC;CA0BF;;;;8BAtD6B,oCAAoC"}
@@ -1,5 +1,4 @@
1
1
  // @ts-check
2
- import { html } from '../../../symbiote.js';
3
2
  import { ActivityBlock } from '../../../abstract/ActivityBlock.js';
4
3
  import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
5
4
 
@@ -57,7 +56,8 @@ export class FileUploaderInline extends SolutionBlock {
57
56
  }
58
57
  }
59
58
 
60
- FileUploaderInline.template = html` <uc-start-from>
59
+ FileUploaderInline.template = /* HTML */ `
60
+ <uc-start-from>
61
61
  <uc-drop-area with-icon clickable></uc-drop-area>
62
62
  <uc-source-list wrap></uc-source-list>
63
63
  <button
@@ -72,4 +72,5 @@ FileUploaderInline.template = html` <uc-start-from>
72
72
  <uc-camera-source></uc-camera-source>
73
73
  <uc-url-source></uc-url-source>
74
74
  <uc-external-source></uc-external-source>
75
- <uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;
75
+ <uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>
76
+ `;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAIA;CAkCC;;;;8BApC6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderMinimal.d.ts","sourceRoot":"","sources":["FileUploaderMinimal.js"],"names":[],"mappings":"AAGA;CAkCC;;;;8BApC6B,oCAAoC"}
@@ -1,4 +1,3 @@
1
- import { html } from '../../../symbiote.js';
2
1
  import { ActivityBlock } from '../../../abstract/ActivityBlock.js';
3
2
  import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
4
3
 
@@ -38,7 +37,7 @@ export class FileUploaderMinimal extends SolutionBlock {
38
37
  }
39
38
  }
40
39
 
41
- FileUploaderMinimal.template = html`
40
+ FileUploaderMinimal.template = /* HTML */ `
42
41
  <uc-start-from>
43
42
  <uc-drop-area tabindex="0" clickable l10n="choose-file"></uc-drop-area>
44
43
  <uc-copyright></uc-copyright>
@@ -4,9 +4,9 @@ export class FileUploaderRegular extends SolutionBlock {
4
4
  '*commonProgress': number;
5
5
  '*uploadList': never[];
6
6
  '*uploadQueue': import("@uploadcare/upload-client").Queue;
7
- '*collectionErrors': import("./index.js").OutputErrorCollection[];
8
- '*collectionState': import("./index.js").OutputCollectionState | null;
9
- '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
7
+ '*collectionErrors': any[];
8
+ '*collectionState': import("./index.js").OutputCollectionState<import("./index.js").OutputCollectionStatus, "maybe-has-group"> | null;
9
+ '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null; /** @private */
10
10
  '*uploadTrigger': Set<string>;
11
11
  '*secureUploadsManager': import("../../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
12
12
  '*currentActivity': null;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploaderRegular.d.ts","sourceRoot":"","sources":["FileUploaderRegular.js"],"names":[],"mappings":"AAMA;IAMI;;;;;oCAWwC,YACvC;mCAKC,YAAI;6BAEoC,2BAC1B;;wCAIZ,2CAAuB;;;;;;MArB1B;IAoBG,eAAe;IACf,yBAAmC;CAK1C;;;;8BAvC6B,oCAAoC"}
1
+ {"version":3,"file":"FileUploaderRegular.d.ts","sourceRoot":"","sources":["FileUploaderRegular.js"],"names":[],"mappings":"AAKA;IAMI;;;;;;;kFAuBI,eAAe;;;;;;;;MApBlB;IAoBG,eAAe;IACf,yBAAmC;CAK1C;;;;8BAvC6B,oCAAoC"}
@@ -1,5 +1,4 @@
1
1
  // @ts-check
2
- import { html } from '../../../symbiote.js';
3
2
  import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
4
3
  import { asBoolean } from '../../../blocks/Config/normalizeConfigValue.js';
5
4
  import { EventType } from '../../../blocks/UploadCtxProvider/EventEmitter.js';
@@ -41,7 +40,7 @@ export class FileUploaderRegular extends SolutionBlock {
41
40
  }
42
41
  }
43
42
 
44
- FileUploaderRegular.template = html`
43
+ FileUploaderRegular.template = /* HTML */ `
45
44
  <uc-simple-btn set="@hidden: isHidden"></uc-simple-btn>
46
45
 
47
46
  <uc-modal strokes block-body-scrolling>
@@ -21,6 +21,7 @@ export type SecureUploadsSignatureResolver = () => Promise<SecureUploadsSignatur
21
21
  export type IconHrefResolver = (iconName: string) => string;
22
22
  export type FileValidators = FuncFileValidator[];
23
23
  export type CollectionValidators = FuncCollectionValidator[];
24
+ export type SourceTypes = import('../blocks/utils/UploadSource').SourceTypes
24
25
 
25
26
  export type ConfigType = {
26
27
  pubkey: string;
@@ -168,6 +169,7 @@ export type OutputFileEntry<TStatus extends OutputFileStatus = OutputFileStatus>
168
169
  externalUrl: string | null;
169
170
  uploadProgress: number;
170
171
  fullPath: string | null;
172
+ source: SourceTypes | null;
171
173
  } & (
172
174
  | {
173
175
  status: 'success';
package/types/jsx.d.ts CHANGED
@@ -8,15 +8,9 @@ type FileUploaderRegular = import('../index.js').FileUploaderRegular;
8
8
  type FileUploaderMinimal = import('../index.js').FileUploaderMinimal;
9
9
  type FormInput = import('../index.js').FormInput;
10
10
  type CloudImageEditorBlock = import('../index.js').CloudImageEditorBlock;
11
- type CtxAttributes =
12
- | {
13
- ctx: string;
14
- 'ctx-name'?: never;
15
- }
16
- | {
17
- ctx?: never;
18
- 'ctx-name': string;
19
- };
11
+ type CtxAttributes = {
12
+ 'ctx-name': string;
13
+ };
20
14
  type CommonHtmlAttributes<T> = Partial<
21
15
  Pick<React.HTMLAttributes<T>, 'id' | 'children' | 'hidden'> & { class: React.HTMLAttributes<T>['className'] }
22
16
  >;
@@ -1 +1 @@
1
- {"version":3,"file":"getPluralForm.d.ts","sourceRoot":"","sources":["getPluralForm.js"],"names":[],"mappings":"AASO,sCAJI,MAAM,SACN,MAAM,GACJ,UAAU,CAKtB;yBAVa,IAAI,CAAC,cAAc"}
1
+ {"version":3,"file":"getPluralForm.d.ts","sourceRoot":"","sources":["getPluralForm.js"],"names":[],"mappings":"AASO,sCAJI,MAAM,SACN,MAAM,GACJ,UAAU,CAKtB;yBAVa,KAAK,cAAc"}
@@ -1,4 +1,4 @@
1
- export function isSecureTokenExpired(secureToken: import("../types").SecureUploadsSignatureAndExpire, { threshold }: {
1
+ export function isSecureTokenExpired(secureToken: import('../types').SecureUploadsSignatureAndExpire, { threshold }: {
2
2
  threshold?: number;
3
3
  }): boolean;
4
4
  //# sourceMappingURL=isSecureTokenExpired.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["memoize.js"],"names":[],"mappings":"AASO,wBANc,KAAK,SAAZ,GAAG,EAAG,EACD,OAAO,kBACiB,CAAC,SAA/B,CAAE,GAAG,IAAI,EAAE,KAAK,KAAK,OAAQ,MAC/B,CAAC,GACC,CAAC,CAeb"}
1
+ {"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["memoize.js"],"names":[],"mappings":"AASO,uHAaN"}
@@ -4,7 +4,5 @@ export type GConstructor<T> = new (...args: any[]) => T;
4
4
  * are some dynamic generated properties or native overrides in the class. We're use it to define dynamic access
5
5
  * properties and events to subscribe to.
6
6
  */
7
- export type MixinClass<Base extends GConstructor<HTMLElement>, InstanceProperties extends Record<string, any> = {}> = {
8
- new (...args: ConstructorParameters<Base>): InstanceProperties & InstanceType<Base>;
9
- } & Omit<Base, "new">;
7
+ export type MixinClass<Base extends GConstructor<HTMLElement>, InstanceProperties extends Record<string, any> = {}> = (new (...args: ConstructorParameters<Base>) => InstanceProperties & InstanceType<Base>) & Omit<Base, "new">;
10
8
  //# sourceMappingURL=mixinClass.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mixinClass.d.ts","sourceRoot":"","sources":["mixinClass.js"],"names":[],"mappings":"yBACa,CAAC,IACD,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC;;;;;;uBAQG,IAAI,SAA/B,YAAY,CAAC,WAAW,CAAE,EACJ,kBAAkB,SAAxC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAE,SACrB;IACZ,KAAS,GAAG,IAAI,EAAE,qBAAqB,CAAC,IAAI,CAAC,GAAG,kBAAkB,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;CACrF,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC"}
1
+ {"version":3,"file":"mixinClass.d.ts","sourceRoot":"","sources":["mixinClass.js"],"names":[],"mappings":"4CAE2B,GAAG,EAAE,KAAK,CAAC;;;;;;qIAWnB,sBAAsB,IAAI,CAAC,KAAG,kBAAkB,GAAG,aAAa,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prettyBytes.d.ts","sourceRoot":"","sources":["prettyBytes.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AAiBI,mCAJI,MAAM,SACN,CAAC,OAAO,YAAY,EAAE,MAAM,OAAO,YAAY,CAAC,GAC9C,MAAM,CAmClB"}
1
+ {"version":3,"file":"prettyBytes.d.ts","sourceRoot":"","sources":["prettyBytes.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AAiBI,mCAJI,MAAM,SACN,CAAC,mBAAmB,CAAC,CAAC,MAAM,mBAAmB,CAAC,GAC9C,MAAM,CAmClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"template-utils.d.ts","sourceRoot":"","sources":["template-utils.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AAEH;;;;;GAKG;AACH,yHAQC;AAED;;;GAGG;AACH,oDAFa;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,EAAE,CAiB5E;;;;;;;;;;;;;;;wBAjDa;IAAE,CAAC,GAAG,QAAQ,GAAG,4BAA4B,SAAS,CAAA;CAAE"}
1
+ {"version":3,"file":"template-utils.d.ts","sourceRoot":"","sources":["template-utils.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AAEH;;;;;GAKG;AACH,yHAQC;AAED;;;GAGG;AACH,oDAFa;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,EAAE,CAiB5E"}
@@ -1 +1 @@
1
- {"version":3,"file":"toKebabCase.d.ts","sourceRoot":"","sources":["toKebabCase.js"],"names":[],"mappings":"AAUO,4BAJe,CAAC,SAAV,MAAQ,OACV,CAAC,GACC,SAAS,CAAC,CAAC,CAAC,CAMX;sBAbQ,CAAC,SAAV,MAAQ,IACR,CAAC,SAAS,GAAG,MAAM,IAAI,IAAI,MAAM,IAAI,EAAE,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"toKebabCase.d.ts","sourceRoot":"","sources":["toKebabCase.js"],"names":[],"mappings":"AAUO,oEAIO"}
@@ -1 +1 @@
1
- {"version":3,"file":"uniqueArray.d.ts","sourceRoot":"","sources":["uniqueArray.js"],"names":[],"mappings":"AAKO,4BAJM,CAAC,OACH,CAAC,EAAE,GACD,CAAC,EAAE,CAIf"}
1
+ {"version":3,"file":"uniqueArray.d.ts","sourceRoot":"","sources":["uniqueArray.js"],"names":[],"mappings":"AAKO,8CAEN"}
@@ -1,3 +1,3 @@
1
1
  /** @type {import('../../../abstract/ValidationManager.js').FuncCollectionValidator} */
2
- export const validateCollectionUploadError: import("../../../abstract/ValidationManager.js").FuncCollectionValidator;
2
+ export const validateCollectionUploadError: import('../../../abstract/ValidationManager.js').FuncCollectionValidator;
3
3
  //# sourceMappingURL=validateCollectionUploadError.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /** @type {import('../../../abstract/ValidationManager.js').FuncCollectionValidator} */
2
- export const validateMultiple: import("../../../abstract/ValidationManager.js").FuncCollectionValidator;
2
+ export const validateMultiple: import('../../../abstract/ValidationManager.js').FuncCollectionValidator;
3
3
  //# sourceMappingURL=validateMultiple.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
2
- export const validateFileType: import("../../../abstract/ValidationManager.js").FuncFileValidator;
2
+ export const validateFileType: import('../../../abstract/ValidationManager.js').FuncFileValidator;
3
3
  //# sourceMappingURL=validateFileType.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
2
- export const validateIsImage: import("../../../abstract/ValidationManager.js").FuncFileValidator;
2
+ export const validateIsImage: import('../../../abstract/ValidationManager.js').FuncFileValidator;
3
3
  //# sourceMappingURL=validateIsImage.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
2
- export const validateMaxSizeLimit: import("../../../abstract/ValidationManager.js").FuncFileValidator;
2
+ export const validateMaxSizeLimit: import('../../../abstract/ValidationManager.js').FuncFileValidator;
3
3
  //# sourceMappingURL=validateMaxSizeLimit.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /** @type {import('../../../abstract/ValidationManager.js').FuncFileValidator} */
2
- export const validateUploadError: import("../../../abstract/ValidationManager.js").FuncFileValidator;
2
+ export const validateUploadError: import('../../../abstract/ValidationManager.js').FuncFileValidator;
3
3
  //# sourceMappingURL=validateUploadError.d.ts.map
@@ -1,14 +1,8 @@
1
- export function waitForAttribute<T extends string>({ element, attribute, timeout }: {
1
+ export function waitForAttribute({ element, attribute, onSuccess, onTimeout, timeout }: {
2
2
  element: HTMLElement;
3
- attribute: T;
4
- timeout?: number;
5
- }): Promise<ReturnType<T>>;
6
- export type ReturnType<T extends string> = {
7
- success: true;
8
- attribute: T;
9
- value: string;
10
- } | {
11
- success: false;
12
- attribute: T;
13
- };
3
+ attribute: string;
4
+ onSuccess: (value: string) => void;
5
+ onTimeout: () => void;
6
+ timeout?: number | undefined;
7
+ }): void;
14
8
  //# sourceMappingURL=waitForAttribute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"waitForAttribute.d.ts","sourceRoot":"","sources":["waitForAttribute.js"],"names":[],"mappings":"AA0BO,iCARe,CAAC,SAAV,MAAQ,mCACV;IACV,OAAW,EAAE,WAAW,CAAC;IACzB,SAAa,EAAE,CAAC,CAAC;IACjB,OAAW,CAAC,EAAE,MAAM,CAAC;CAClB,GACS,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAgDlC;uBAnEqB,CAAC,SAAV,MAAQ,IACR;IACZ,OAAe,EAAE,IAAI,CAAC;IACtB,SAAiB,EAAE,CAAC,CAAC;IACrB,KAAa,EAAE,MAAM,CAAC;CACf,GACD;IACN,OAAe,EAAE,KAAK,CAAC;IACvB,SAAiB,EAAE,CAAC,CAAC;CACd"}
1
+ {"version":3,"file":"waitForAttribute.d.ts","sourceRoot":"","sources":["waitForAttribute.js"],"names":[],"mappings":"AAWO;aAPO,WAAW;eACT,MAAM;uBACE,MAAM,KAAK,IAAI;eACvB,MAAM,IAAI;;SAmCzB"}
@@ -1,40 +1,19 @@
1
1
  // @ts-check
2
2
 
3
- import { withResolvers } from './withResolvers.js';
4
-
5
- /**
6
- * @template {string} T
7
- * @typedef {{
8
- * success: true;
9
- * attribute: T;
10
- * value: string;
11
- * }
12
- * | {
13
- * success: false;
14
- * attribute: T;
15
- * }} ReturnType
16
- */
17
-
18
3
  /**
19
- * @template {string} T
20
4
  * @param {{
21
5
  * element: HTMLElement;
22
- * attribute: T;
6
+ * attribute: string;
7
+ * onSuccess: (value: string) => void;
8
+ * onTimeout: () => void;
23
9
  * timeout?: number;
24
10
  * }} options
25
- * @returns {Promise<ReturnType<T>>}
26
11
  */
27
- export const waitForAttribute = async ({ element, attribute, timeout = 300 }) => {
28
- const { promise, resolve } = /** @type {typeof withResolvers<ReturnType<T>>} */ (withResolvers)();
29
-
12
+ export const waitForAttribute = ({ element, attribute, onSuccess, onTimeout, timeout = 300 }) => {
30
13
  const currentAttrValue = element.getAttribute(attribute);
31
14
  if (currentAttrValue !== null) {
32
- resolve({
33
- success: true,
34
- value: currentAttrValue,
35
- attribute,
36
- });
37
- return promise;
15
+ onSuccess(currentAttrValue);
16
+ return;
38
17
  }
39
18
 
40
19
  const observer = new MutationObserver((mutations) => {
@@ -49,10 +28,7 @@ export const waitForAttribute = async ({ element, attribute, timeout = 300 }) =>
49
28
 
50
29
  const timeoutId = setTimeout(() => {
51
30
  observer.disconnect();
52
- resolve({
53
- success: false,
54
- attribute,
55
- });
31
+ onTimeout();
56
32
  }, timeout);
57
33
 
58
34
  /** @param {MutationRecord} mutation */
@@ -61,13 +37,7 @@ export const waitForAttribute = async ({ element, attribute, timeout = 300 }) =>
61
37
  if (mutation.type === 'attributes' && mutation.attributeName === attribute && attrValue !== null) {
62
38
  clearTimeout(timeoutId);
63
39
  observer.disconnect();
64
- resolve({
65
- success: true,
66
- value: attrValue,
67
- attribute,
68
- });
40
+ onSuccess(attrValue);
69
41
  }
70
42
  };
71
-
72
- return promise;
73
43
  };
@@ -1,41 +1,78 @@
1
- // @ts-check
2
1
  import { expect } from '@esm-bundle/chai';
2
+ import { spy } from 'sinon';
3
3
  import { delay } from './delay';
4
4
  import { waitForAttribute } from './waitForAttribute';
5
5
 
6
6
  const TEST_ATTRIBUTE = 'test-attribute';
7
7
 
8
8
  describe('waitForAttribute', () => {
9
- it('should resolve success false when timeout is over', async () => {
9
+ it('should call onTimeout callback when timeout is over', async () => {
10
10
  const element = document.createElement('div');
11
- const promise = waitForAttribute({
11
+ const onSuccess = spy();
12
+ const onTimeout = spy();
13
+ waitForAttribute({
12
14
  element,
13
15
  attribute: TEST_ATTRIBUTE,
16
+ onSuccess,
17
+ onTimeout,
14
18
  timeout: 10,
15
19
  });
16
20
  await delay(100);
17
- expect(await promise).to.be.eql({ success: false, attribute: TEST_ATTRIBUTE });
21
+ expect(onSuccess.called).to.be.false;
22
+ expect(onTimeout.calledOnce).to.be.true;
18
23
  });
19
- it('should resolve success true when attribute is set async', async () => {
24
+ it('should call onSuccess callback when attribute is set async', async () => {
20
25
  const element = document.createElement('div');
21
- const promise = waitForAttribute({
26
+ const onSuccess = spy();
27
+ const onTimeout = spy();
28
+ waitForAttribute({
22
29
  element,
23
30
  attribute: TEST_ATTRIBUTE,
31
+ onSuccess,
32
+ onTimeout,
24
33
  timeout: 10,
25
34
  });
26
35
  element.setAttribute(TEST_ATTRIBUTE, 'test');
27
36
  await delay(100);
28
- expect(await promise).to.be.eql({ success: true, attribute: TEST_ATTRIBUTE, value: 'test' });
37
+ expect(onSuccess.calledOnce).to.be.true;
38
+ expect(onSuccess.getCall(0).args[0]).to.equal('test');
39
+ expect(onTimeout.called).to.be.false;
29
40
  });
30
- it('should resolve success true when attribute is set sync', async () => {
41
+ it('should call onSuccess callback when attribute is set sync', async () => {
31
42
  const element = document.createElement('div');
32
43
  element.setAttribute(TEST_ATTRIBUTE, 'test');
33
- const promise = waitForAttribute({
44
+ const onSuccess = spy();
45
+ const onTimeout = spy();
46
+ waitForAttribute({
34
47
  element,
35
48
  attribute: TEST_ATTRIBUTE,
49
+ onSuccess,
50
+ onTimeout,
36
51
  timeout: 10,
37
52
  });
38
53
  await delay(100);
39
- expect(await promise).to.be.eql({ success: true, attribute: TEST_ATTRIBUTE, value: 'test' });
54
+ expect(onSuccess.calledOnce).to.be.true;
55
+ expect(onSuccess.getCall(0).args[0]).to.equal('test');
56
+ expect(onTimeout.called).to.be.false;
57
+ });
58
+
59
+ it('should not call onSuccess on the second attribute change', async () => {
60
+ const element = document.createElement('div');
61
+ element.setAttribute(TEST_ATTRIBUTE, 'test');
62
+ const onSuccess = spy();
63
+ const onTimeout = spy();
64
+ waitForAttribute({
65
+ element,
66
+ attribute: TEST_ATTRIBUTE,
67
+ onSuccess,
68
+ onTimeout,
69
+ timeout: 10,
70
+ });
71
+ await delay(100);
72
+ element.setAttribute(TEST_ATTRIBUTE, 'tes2');
73
+ await delay(100);
74
+ expect(onSuccess.calledOnce).to.be.true;
75
+ expect(onSuccess.getCall(0).args[0]).to.equal('test');
76
+ expect(onTimeout.called).to.be.false;
40
77
  });
41
78
  });