@uploadcare/file-uploader 1.7.0 → 1.9.0-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.
Files changed (36) hide show
  1. package/README.md +37 -62
  2. package/abstract/ActivityBlock.d.ts +1 -0
  3. package/abstract/ActivityBlock.d.ts.map +1 -1
  4. package/abstract/ActivityBlock.js +1 -0
  5. package/blocks/CloudImageEditor/src/CropFrame.d.ts +16 -11
  6. package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +1 -1
  7. package/blocks/CloudImageEditor/src/CropFrame.js +42 -34
  8. package/blocks/CloudImageEditor/src/types.d.ts +56 -0
  9. package/blocks/CloudImageEditor/src/types.d.ts.map +1 -1
  10. package/blocks/CloudImageEditor/src/types.js +11 -0
  11. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  12. package/blocks/FileItem/FileItem.js +7 -4
  13. package/blocks/LocalEditorImage/LocalEditorImage.d.ts +22 -0
  14. package/blocks/LocalEditorImage/LocalEditorImage.d.ts.map +1 -0
  15. package/blocks/LocalEditorImage/LocalEditorImage.js +139 -0
  16. package/blocks/LocalEditorImage/localEditorImage.css +19 -0
  17. package/blocks/themes/uc-basic/index.css +1 -0
  18. package/env.d.ts +1 -1
  19. package/env.js +1 -1
  20. package/index.d.ts +1 -0
  21. package/index.js +1 -0
  22. package/index.ssr.d.ts +68 -1
  23. package/index.ssr.d.ts.map +1 -1
  24. package/index.ssr.js +67 -1
  25. package/package.json +7 -3
  26. package/solutions/file-uploader/regular/FileUploaderRegular.js +1 -0
  27. package/web/file-uploader.iife.min.js +392 -29
  28. package/web/file-uploader.min.js +392 -29
  29. package/web/uc-basic.min.css +1 -1
  30. package/web/uc-cloud-image-editor.min.js +4 -4
  31. package/web/uc-file-uploader-inline.min.css +1 -1
  32. package/web/uc-file-uploader-inline.min.js +392 -29
  33. package/web/uc-file-uploader-minimal.min.js +2 -2
  34. package/web/uc-file-uploader-regular.min.css +1 -1
  35. package/web/uc-file-uploader-regular.min.js +392 -29
  36. package/web/uc-img.min.js +1 -1
package/README.md CHANGED
@@ -8,66 +8,57 @@
8
8
  </a>
9
9
  </p>
10
10
  <p align="center">
11
- <a href="https://uploadcare.com?ref=github-readme">Website</a> •
12
- <a href="https://uploadcare.com/docs/start/quickstart?ref=github-readme">Quick Start</a> •
13
- <a href="https://uploadcare.com/docs?ref=github-readme">Docs</a> •
11
+ <a href="https://uploadcare.com/?ref=github-readme">Website</a> •
12
+ <a href="https://uploadcare.com/docs/file-uploader?ref=github-readme">Docs</a> •
14
13
  <a href="https://uploadcare.com/blog?ref=github-readme">Blog</a> •
15
14
  <a href="https://discord.gg/mKWRgRsVz8?ref=github-readme">Discord</a> •
16
15
  <a href="https://twitter.com/Uploadcare?ref=github-readme">Twitter</a>
17
16
  </p>
18
17
 
19
- # 📦 Uploadcare File Uploader: stack-agnostic library for uploading, processing, and editing images on-the-fly
18
+ # Uploadcare File Uploader
20
19
 
21
20
  [![npm version](https://badge.fury.io/js/@uploadcare%2Ffile-uploader.svg)](https://www.npmjs.com/package/@uploadcare/file-uploader)
22
21
  [![GitHub Actions](https://github.com/uploadcare/blocks/workflows/checks/badge.svg)](https://github.com/uploadcare/blocks/actions?query=workflow%3ABuild+branch%3Amaster)
23
22
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
23
+ [![minzipped size](https://img.shields.io/bundlephobia/minzip/@uploadcare/file-uploader@latest)](https://bundlephobia.com/package/@uploadcare/file-uploader@latest)
24
24
 
25
- _Uploadcare File Uploader_ is a powerful JavaScript library for creating custom file-handling services.
26
- It includes various interactive and customizable UI components to enhance users' file uploading
27
- and processing experience. As a bonus, you receive all the
28
- [Uploadcare's](https://uploadcare.com/?ref=github-readme) versatile file-handling capabilities,
29
- including [smart CDN](https://uploadcare.com/docs/delivery/cdn/#content-delivery-network/?ref=github-readme),
30
- [MIME-type filtering](https://uploadcare.com/docs/moderation/#file-types/?ref=github-readme),
31
- [signed uploads](https://uploadcare.com/docs/security/secure-uploads/?ref=github-readme),
32
- and [even more](<(https://uploadcare.com/features/?ref=github-readme)>).
25
+ Add file uploads to your app and configure behavior and appearance as needed. Process and transform files before and after uploading. Compatible with any framework or environment.
33
26
 
34
- See Uploadcare File Uploader [in action](https://codesandbox.io/p/devbox/github/uploadcare/blocks-examples/tree/main/examples/js-uploader)!
27
+ <img alt="Uploadcare File Uploader examples" src="https://ucarecdn.com/916a1054-ca44-4c4a-9f7b-99fa499043d9/-/preview/">
35
28
 
36
- <img alt="Uploadcare File Uploader examples" src="https://ucarecdn.com/2883da9f-6962-49db-9947-f91a3e25be2f/-/preview/">
29
+ ## Features
37
30
 
38
- ## Core features
31
+ - **Multiple upload sources:** Drop files, select from the filesystem, use a link, camera, Dropbox, Google Drive, add them via the upload API, and more.
32
+ - **Large file handling:** Upload faster with chunking, retries, and resumable uploads.
33
+ - **Customizable appearance:** Use pre-built themes or modify styles with CSS to fit your project.
34
+ - **Responsive and cross-browser:** Fits any device; supports the latest desktop and mobile versions of Chrome, Edge, Firefox, Opera, and Safari.
35
+ - **Fully accessible:** A11Y options, including keyboard navigation, screen reader support, and color contrast settings.
36
+ - **Advanced image editing:** Optimize images and apply smart transformations like cropping, resizing, or color filters via the built-in image editor, REST, or URL API.
37
+ - **Secure uploads:** Protect your app by automatically detecting inappropriate content, malicious files, or unauthorized uploads.
38
+ - **Typescript support:** Full Typescript support with autocompletion, type checking, and more for a better developer experience.
39
39
 
40
- - [File Uploader](https://uploadcare.com/docs/file-uploader/?ref=github-readme) — implement file-managing functionality with minimal or comprehensive interfaces in just a few minutes.
41
- <!-- - [Advanced Customization](/blocks/) — create unique file-uploading interfaces by reorganizing pre-built components and styles with custom based on your needs. -->
42
- - [Adaptive Images](https://uploadcare.com/docs/adaptive-image/?ref=github-readme) — build responsive user interfaces that adapt to various screen sizes and devices, ensuring a performant experience across platforms.
43
- - [Cloud Image Editor](https://uploadcare.com/docs/file-uploader/image-editor/?ref=github-readme) — edit, transform, and process images right from a browser on-the-fly.
44
- - [Uploadcare power and features](https://uploadcare.com/features/?ref=github-readme) — upload, process, deliver, and manage images without building custom infrastructure.
45
-
46
- * **Coming soon!** Web Components for any media content management like audio, video, image galleries, and more.
47
-
48
- ## Why Uploadcare File Uploader?
49
-
50
- ### Rapid integration
51
-
52
- We provide a ready-to-use set of UI components for file handling. It saves you valuable development time and effort, allowing you to focus on other core aspects of your application. You even don't need to build a stage while developing — just run the code directly from the browser.
53
-
54
- ### Cross-platform compatibility
40
+ ## Framework support
55
41
 
56
- Uploadcare File Uploader are designed to work seamlessly across various platforms and frameworks. Whether you're building a web application using React, Vue.js, Angular, Svelte, or other frameworks, you get [integrations and support](https://uploadcare.com/docs/integrations/?ref=github-readme) for various development environments.
42
+ Uploadcare File Uploader is built with [Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components), meaning you can integrate it into any environment—no adapters required.
57
43
 
58
- ### Developer-friendly
44
+ For hands-on examples, visit our live sandboxes:
59
45
 
60
- The library comes with modern technologies at your fingertips, like [Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components), [ESM-level](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) code sharing, and other cutting-edge web standards. _Uploadcare File Uploader_ is designed lightweight with minimum external dependencies for a cheap security audit.
46
+ - [React](https://github.com/uploadcare/file-uploader-examples/tree/main/examples/react-uploader)
47
+ - [Next.js](https://github.com/uploadcare/file-uploader-examples/tree/main/examples/next-uploader)
48
+ - [JavaScript](https://github.com/uploadcare/file-uploader-examples/tree/main/examples/js-uploader)
49
+ - [Angular](https://github.com/uploadcare/file-uploader-examples/tree/main/examples/angular-uploader)
50
+ - [Vue](https://github.com/uploadcare/file-uploader-examples/tree/main/examples/vue-uploader)
51
+ - [Svelte](https://github.com/uploadcare/file-uploader-examples/tree/main/examples/svelte-uploader)
61
52
 
62
- ### Typescript support
53
+ Check out the [documentation](https://uploadcare.com/docs/integrations/?ref=github-readme) for quickstart guides tailored to your framework or tool.
63
54
 
64
- We use [JSDoc type annotations](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html) and type definitions ([\*.d.ts files](https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html)) for TypeScript static analysis support during development.
55
+ Explore more tutorials in our [blog](https://uploadcare.com/blog/category/uploading/?ref=github-readme).
65
56
 
66
- ## 🚀 Getting started
57
+ ## Quick Start
67
58
 
68
59
  ### From CDN
69
60
 
70
- 1. Connect Uploadcare File Uploader directly from your document:
61
+ 1. Connect File Uploader directly from your document:
71
62
 
72
63
  ```html
73
64
  <script type="module">
@@ -77,7 +68,7 @@ We use [JSDoc type annotations](https://www.typescriptlang.org/docs/handbook/int
77
68
  </script>
78
69
  ```
79
70
 
80
- 2. Start using Uploadcare File Uploader in your application markup:
71
+ 2. Add File Uploader in your application markup:
81
72
 
82
73
  ```html
83
74
  <link
@@ -88,12 +79,12 @@ We use [JSDoc type annotations](https://www.typescriptlang.org/docs/handbook/int
88
79
  <uc-file-uploader-regular ctx-name="my-uploader"> </uc-file-uploader-regular>
89
80
  ```
90
81
 
91
- 3. Configure Uploadcare File Uploader and add your personal public key to the project. Discover the instructions in the [following section](#configuration).
82
+ 3. Configure File Uploader and add your personal public key to the project. [Learn more](#configuration).
92
83
 
93
84
  ### From NPM
94
85
 
95
- 1. Install Uploadcare File Uploader package: `npm i @uploadcare/file-uploader`
96
- 2. Connect `Blocks` from your script file:
86
+ 1. Install the package: `npm i @uploadcare/file-uploader`
87
+ 2. Connect File Uploader from your script file:
97
88
 
98
89
  ```js
99
90
  import * as UC from '@uploadcare/file-uploader';
@@ -101,7 +92,7 @@ import * as UC from '@uploadcare/file-uploader';
101
92
  UC.defineComponents(UC);
102
93
  ```
103
94
 
104
- 3. Start using Uploadcare File Uploader in your application markup:
95
+ 3. Add File Uploader in your application markup:
105
96
 
106
97
  ```html
107
98
  <link
@@ -112,11 +103,11 @@ UC.defineComponents(UC);
112
103
  <uc-file-uploader-inline ctx-name="my-uploader"> </uc-file-uploader-inline>
113
104
  ```
114
105
 
115
- 4. Configure Uploadcare File Uploader and add your personal public key to the project. Discover the instructions in the [following section](#configuration).
106
+ 4. Configure File Uploader and add your personal public key to the project. [Learn more](#configuration).
116
107
 
117
108
  ### Configuration
118
109
 
119
- All configurations in Uploadcare File Uploader are managed from `uc-config` block.
110
+ All configurations in File Uploader are managed from `uc-config` block.
120
111
 
121
112
  1. Sign up to [Uploadcare](https://app.uploadcare.com/accounts/signup/?ref=github-readme).
122
113
  2. Get a Public API key in [Uploadcare project's dashboard](https://app.uploadcare.com/projects/-/api-keys/?ref=github-readme).
@@ -126,13 +117,9 @@ All configurations in Uploadcare File Uploader are managed from `uc-config` bloc
126
117
  <uc-config ctx-name="my-uploader" pubkey="YOUR_PUBLIC_KEY"></uc-config>
127
118
  ```
128
119
 
129
- 4. Make sure that your config block uses the same `ctx-name` attribute value as your solution block.
130
-
131
- Discover more about Uploadcare File Uploader configuration in [our documentation](https://uploadcare.com/docs/file-uploader/configuration/?ref=github-readme).
120
+ 4. Make sure that your config uses the same `ctx-name` attribute value as your solution block.
132
121
 
133
- ### Deep dive in Uploadcare File Uploader 🛠
134
-
135
- Follow our [step-by-step installation guide](https://uploadcare.com/docs/file-uploader/installation/?ref=github-readme) to launch Uploadcare File Uploader in a few minutes and set it up based on your needs.
122
+ Discover more about configuration options in [our documentation](https://uploadcare.com/docs/file-uploader/configuration/?ref=github-readme).
136
123
 
137
124
  ## Browser support
138
125
 
@@ -140,18 +127,6 @@ Latest desktop and mobile stable versions of Chrome, Edge, Firefox, Opera, and S
140
127
 
141
128
  Internet Explorer is outdated and [not supported anymore](https://uploadcare.com/blog/uploadcare-stops-internet-explorer-support/?ref=github-readme).
142
129
 
143
- ## Framework support
144
-
145
- _Uploadcare File Uploader_ is a framework-agnostic solution, so you can use it with **any** runtime you like. Discover the integration examples:
146
- <br/>
147
-
148
- - [React](https://github.com/uploadcare/uc-blocks-examples/tree/main/examples/react-uploader)
149
- - [Vue](https://github.com/uploadcare/uc-blocks-examples/tree/main/examples/vue-uploader)
150
- - [Angular](https://github.com/uploadcare/uc-blocks-examples/tree/main/examples/angular-uploader)
151
- - [Svelte](https://github.com/uploadcare/uc-blocks-examples/tree/main/examples/svelte-uploader)
152
-
153
- All the source code is accessible and works in raw mode. Use _developer tools_ to dive into details.
154
-
155
130
  ## Contribution
156
131
 
157
132
  You’re always welcome to contribute:
@@ -67,6 +67,7 @@ export namespace ActivityBlock {
67
67
  URL: "url";
68
68
  CLOUD_IMG_EDIT: "cloud-image-edit";
69
69
  EXTERNAL: "external";
70
+ LOCAL_IMAGE_EDITOR: "local-image-editor";
70
71
  }>;
71
72
  }
72
73
  export type ActivityParamsMap = {
@@ -1 +1 @@
1
- {"version":3,"file":"ActivityBlock.d.ts","sourceRoot":"","sources":["ActivityBlock.js"],"names":[],"mappings":"AASA;;;;;GAKG;AAEH;IA4FE;;;;;;OAMG;IACH,kCAAsC;IAlGtC,iBAAiB;IACjB,kCAAuB;IAEvB;;;;;;MAA+B;IAE/B;;MAAqE;IAErE,eAAe;IACf,oBAKC;IAED,eAAe;IACf,kBAaC;IA2CD,eAAe;IACf,sBAWC;IAED,eAAe;IACf,8BAEC;IAWD,4CAEC;IAED,iCAEC;IAED;;;;;;;OAOG;IACH;4BAHiB,IAAI;8BACJ,IAAI;yBAQpB;IAED,2BAKC;IAoBD,0BAEC;IAED,yDAAyD;IACzD,oLAEC;IAED,qBAAqB;IACrB,2BAEC;IAED,qBAAqB;IACrB,2BAEC;IAED,oBAoBC;IAlLC,8CAAyB;CAmL5B;;;;;;;;;;;;gCApMY;IACZ,kBAAsB,EAAE,OAAO,gEAAgE,EAAE,cAAc,CAAC;IAChH,UAAc,OAAO,4CAA4C,EAAE,cAAc,CAAC;CAC/E;qCA6MU,CAAC,oBAAoB,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,YAAY,CAAC,CAAC;2BAChF,sBAAsB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI;sBAxNrC,YAAY"}
1
+ {"version":3,"file":"ActivityBlock.d.ts","sourceRoot":"","sources":["ActivityBlock.js"],"names":[],"mappings":"AASA;;;;;GAKG;AAEH;IA4FE;;;;;;OAMG;IACH,kCAAsC;IAlGtC,iBAAiB;IACjB,kCAAuB;IAEvB;;;;;;MAA+B;IAE/B;;MAAqE;IAErE,eAAe;IACf,oBAKC;IAED,eAAe;IACf,kBAaC;IA2CD,eAAe;IACf,sBAWC;IAED,eAAe;IACf,8BAEC;IAWD,4CAEC;IAED,iCAEC;IAED;;;;;;;OAOG;IACH;4BAHiB,IAAI;8BACJ,IAAI;yBAQpB;IAED,2BAKC;IAoBD,0BAEC;IAED,yDAAyD;IACzD,oLAEC;IAED,qBAAqB;IACrB,2BAEC;IAED,qBAAqB;IACrB,2BAEC;IAED,oBAoBC;IAlLC,8CAAyB;CAmL5B;;;;;;;;;;;;;gCApMY;IACZ,kBAAsB,EAAE,OAAO,gEAAgE,EAAE,cAAc,CAAC;IAChH,UAAc,OAAO,4CAA4C,EAAE,cAAc,CAAC;CAC/E;qCA8MU,CAAC,oBAAoB,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,YAAY,CAAC,CAAC;2BAChF,sBAAsB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI;sBAzNrC,YAAY"}
@@ -214,6 +214,7 @@ ActivityBlock.activities = Object.freeze({
214
214
  URL: 'url',
215
215
  CLOUD_IMG_EDIT: 'cloud-image-edit',
216
216
  EXTERNAL: 'external',
217
+ LOCAL_IMAGE_EDITOR: 'local-image-editor',
217
218
  });
218
219
 
219
220
  /** @typedef {(typeof ActivityBlock)['activities'][keyof (typeof ActivityBlock)['activities']]} RegisteredActivityType */
@@ -26,6 +26,11 @@ export class CropFrame extends Block {
26
26
  private _updateBackdrop;
27
27
  /** @private */
28
28
  private _updateFrame;
29
+ /**
30
+ * @param {import('./types.js').FrameThumbs} frameThumbs
31
+ * @param {import('./types.js').Direction} direction
32
+ */
33
+ _createThumb(frameThumbs: import('./types.js').FrameThumbs, direction: import('./types.js').Direction): void;
29
34
  /** @private */
30
35
  private _createThumbs;
31
36
  /** @private */
@@ -34,55 +39,55 @@ export class CropFrame extends Block {
34
39
  private _createFrame;
35
40
  _frameThumbs: Partial<{
36
41
  "": {
37
- direction: import('./types.js').Direction;
42
+ direction: import("./types.js").Direction;
38
43
  pathNode: SVGElement;
39
44
  interactionNode: SVGElement;
40
45
  groupNode: SVGElement;
41
46
  };
42
47
  n: {
43
- direction: import('./types.js').Direction;
48
+ direction: import("./types.js").Direction;
44
49
  pathNode: SVGElement;
45
50
  interactionNode: SVGElement;
46
51
  groupNode: SVGElement;
47
52
  };
48
53
  s: {
49
- direction: import('./types.js').Direction;
54
+ direction: import("./types.js").Direction;
50
55
  pathNode: SVGElement;
51
56
  interactionNode: SVGElement;
52
57
  groupNode: SVGElement;
53
58
  };
54
59
  e: {
55
- direction: import('./types.js').Direction;
60
+ direction: import("./types.js").Direction;
56
61
  pathNode: SVGElement;
57
62
  interactionNode: SVGElement;
58
63
  groupNode: SVGElement;
59
64
  };
60
65
  w: {
61
- direction: import('./types.js').Direction;
66
+ direction: import("./types.js").Direction;
62
67
  pathNode: SVGElement;
63
68
  interactionNode: SVGElement;
64
69
  groupNode: SVGElement;
65
70
  };
66
71
  ne: {
67
- direction: import('./types.js').Direction;
72
+ direction: import("./types.js").Direction;
68
73
  pathNode: SVGElement;
69
74
  interactionNode: SVGElement;
70
75
  groupNode: SVGElement;
71
76
  };
72
77
  nw: {
73
- direction: import('./types.js').Direction;
78
+ direction: import("./types.js").Direction;
74
79
  pathNode: SVGElement;
75
80
  interactionNode: SVGElement;
76
81
  groupNode: SVGElement;
77
82
  };
78
83
  se: {
79
- direction: import('./types.js').Direction;
84
+ direction: import("./types.js").Direction;
80
85
  pathNode: SVGElement;
81
86
  interactionNode: SVGElement;
82
87
  groupNode: SVGElement;
83
88
  };
84
89
  sw: {
85
- direction: import('./types.js').Direction;
90
+ direction: import("./types.js").Direction;
86
91
  pathNode: SVGElement;
87
92
  interactionNode: SVGElement;
88
93
  groupNode: SVGElement;
@@ -96,7 +101,7 @@ export class CropFrame extends Block {
96
101
  */
97
102
  private _handlePointerDown;
98
103
  _draggingThumb: {
99
- direction: import('./types.js').Direction;
104
+ direction: import("./types.js").Direction;
100
105
  pathNode: SVGElement;
101
106
  interactionNode: SVGElement;
102
107
  groupNode: SVGElement;
@@ -126,7 +131,7 @@ export class CropFrame extends Block {
126
131
  */
127
132
  private _handleSvgPointerMove_;
128
133
  _hoverThumb: {
129
- direction: import('./types.js').Direction;
134
+ direction: import("./types.js").Direction;
130
135
  pathNode: SVGElement;
131
136
  interactionNode: SVGElement;
132
137
  groupNode: SVGElement;
@@ -1 +1 @@
1
- {"version":3,"file":"CropFrame.d.ts","sourceRoot":"","sources":["CropFrame.js"],"names":[],"mappings":"AA2BA;IAII;;MAGC;IAED,eAAe;IACf,yBAAyD;IAEzD,eAAe;IACf,2BAA6D;IAE7D,eAAe;IACf,8BAAmE;IAGrE;;;OAGG;IACH,+BAaC;IAED,eAAe;IACf,wBAyCC;IAFC,sCAAyB;IACzB,2CAAuC;IAGzC;;;OAGG;IACH,wBAUC;IAED,eAAe;IACf,wBASC;IAED,eAAe;IACf,qBAgEC;IAED,eAAe;IACf,sBAyCC;IAED,eAAe;IACf,sBA4CC;IAED,eAAe;IACf,qBAeC;IAFC;;uBApGkB,OAAO,YAAY,EAAE,SAAS;sBAC/B,UAAU;6BACH,UAAU;uBAChB,UAAU;;;uBAHV,OAAO,YAAY,EAAE,SAAS;sBAC/B,UAAU;6BACH,UAAU;uBAChB,UAAU;;;uBAHV,OAAO,YAAY,EAAE,SAAS;sBAC/B,UAAU;6BACH,UAAU;uBAChB,UAAU;;;uBAHV,OAAO,YAAY,EAAE,SAAS;sBAC/B,UAAU;6BACH,UAAU;uBAChB,UAAU;;;uBAHV,OAAO,YA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,WAAW,aAChC,OAAO,YAAY,EAAE,SAAS,QA4BxC;IAED,eAAe;IACf,sBAiBC;IAED,eAAe;IACf,sBA4CC;IAED,eAAe;IACf,qBAeC;IAFC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAA+B;IAC/B,qCAA+B;IAGjC;;;;OAIG;IACH,2BAiBC;IAJC;;;;;kBAA2B;IAC3B,sCAA6B;IAC7B,6CAA6C;IAC7C,2DAAoC;IAGtC;;;OAGG;IACH,0BAUC;IAED;;;OAGG;IACH,4BAmBC;IAED;;;;OAIG;IACH,qBAsBC;IAED;;;OAGG;IACH,+BAqBC;IAFC;;;;;kBAA6B;IAI/B,eAAe;IACf,sBAGC;IAED,eAAe;IACf,gBAGC;IAED,+BAA+B;IAC/B,sBADY,OAAO,QAclB;IAmBG,mCAAsF;CA6B3F;;;;sBAngBqB,4BAA4B"}
@@ -151,10 +151,10 @@ export class CropFrame extends Block {
151
151
 
152
152
  if (isCenter) {
153
153
  const moveThumbRect = {
154
- x: x + width / 3,
155
- y: y + height / 3,
156
- width: width / 3,
157
- height: height / 3,
154
+ x,
155
+ y,
156
+ width,
157
+ height,
158
158
  };
159
159
  setSvgNodeAttrs(interactionNode, moveThumbRect);
160
160
  } else {
@@ -202,47 +202,55 @@ export class CropFrame extends Block {
202
202
  });
203
203
  }
204
204
 
205
+ /**
206
+ * @param {import('./types.js').FrameThumbs} frameThumbs
207
+ * @param {import('./types.js').Direction} direction
208
+ */
209
+ _createThumb(frameThumbs, direction) {
210
+ let groupNode = createSvgNode('g');
211
+ groupNode.classList.add('uc-thumb');
212
+ groupNode.setAttribute('with-effects', '');
213
+ let interactionNode = createSvgNode('rect', {
214
+ fill: 'transparent',
215
+ });
216
+ let pathNode = createSvgNode('path', {
217
+ stroke: 'currentColor',
218
+ fill: 'none',
219
+ 'stroke-width': THUMB_STROKE_WIDTH,
220
+ });
221
+ groupNode.appendChild(pathNode);
222
+ groupNode.appendChild(interactionNode);
223
+ frameThumbs[direction] = {
224
+ direction,
225
+ pathNode,
226
+ interactionNode,
227
+ groupNode,
228
+ };
229
+
230
+ if (direction === '') {
231
+ groupNode.style.cursor = 'move';
232
+ }
233
+
234
+ interactionNode.addEventListener('pointerdown', this._handlePointerDown.bind(this, direction));
235
+ }
236
+
205
237
  /** @private */
206
238
  _createThumbs() {
207
- /**
208
- * @type {Partial<{
209
- * [K in import('./types.js').Direction]: {
210
- * direction: import('./types.js').Direction;
211
- * pathNode: SVGElement;
212
- * interactionNode: SVGElement;
213
- * groupNode: SVGElement;
214
- * };
215
- * }>}
216
- */
239
+ /** @type {import('./types.js').FrameThumbs} */
217
240
  const frameThumbs = {};
218
241
 
219
242
  for (let i = 0; i < 3; i++) {
220
243
  for (let j = 0; j < 3; j++) {
221
244
  let direction = /** @type {import('./types.js').Direction} */ (`${['n', '', 's'][i]}${['w', '', 'e'][j]}`);
222
- let groupNode = createSvgNode('g');
223
- groupNode.classList.add('uc-thumb');
224
- groupNode.setAttribute('with-effects', '');
225
- let interactionNode = createSvgNode('rect', {
226
- fill: 'transparent',
227
- });
228
- let pathNode = createSvgNode('path', {
229
- stroke: 'currentColor',
230
- fill: 'none',
231
- 'stroke-width': THUMB_STROKE_WIDTH,
232
- });
233
- groupNode.appendChild(pathNode);
234
- groupNode.appendChild(interactionNode);
235
- frameThumbs[direction] = {
236
- direction,
237
- pathNode,
238
- interactionNode,
239
- groupNode,
240
- };
245
+ if (direction === '') {
246
+ continue;
247
+ }
241
248
 
242
- interactionNode.addEventListener('pointerdown', this._handlePointerDown.bind(this, direction));
249
+ this._createThumb(frameThumbs, direction);
243
250
  }
244
251
  }
245
252
 
253
+ this._createThumb(frameThumbs, '');
246
254
  return frameThumbs;
247
255
  }
248
256
 
@@ -54,5 +54,61 @@ export type CropAspectRatio = {
54
54
  height: number;
55
55
  };
56
56
  export type CropPresetList = CropAspectRatio[];
57
+ export type FrameThumbs = {
58
+ ""?: {
59
+ direction: Direction;
60
+ pathNode: SVGElement;
61
+ interactionNode: SVGElement;
62
+ groupNode: SVGElement;
63
+ } | undefined;
64
+ n?: {
65
+ direction: Direction;
66
+ pathNode: SVGElement;
67
+ interactionNode: SVGElement;
68
+ groupNode: SVGElement;
69
+ } | undefined;
70
+ s?: {
71
+ direction: Direction;
72
+ pathNode: SVGElement;
73
+ interactionNode: SVGElement;
74
+ groupNode: SVGElement;
75
+ } | undefined;
76
+ e?: {
77
+ direction: Direction;
78
+ pathNode: SVGElement;
79
+ interactionNode: SVGElement;
80
+ groupNode: SVGElement;
81
+ } | undefined;
82
+ w?: {
83
+ direction: Direction;
84
+ pathNode: SVGElement;
85
+ interactionNode: SVGElement;
86
+ groupNode: SVGElement;
87
+ } | undefined;
88
+ ne?: {
89
+ direction: Direction;
90
+ pathNode: SVGElement;
91
+ interactionNode: SVGElement;
92
+ groupNode: SVGElement;
93
+ } | undefined;
94
+ nw?: {
95
+ direction: Direction;
96
+ pathNode: SVGElement;
97
+ interactionNode: SVGElement;
98
+ groupNode: SVGElement;
99
+ } | undefined;
100
+ se?: {
101
+ direction: Direction;
102
+ pathNode: SVGElement;
103
+ interactionNode: SVGElement;
104
+ groupNode: SVGElement;
105
+ } | undefined;
106
+ sw?: {
107
+ direction: Direction;
108
+ pathNode: SVGElement;
109
+ interactionNode: SVGElement;
110
+ groupNode: SVGElement;
111
+ } | undefined;
112
+ };
57
113
  export type Direction = '' | 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw';
58
114
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":";;;gCAGa,YAAY,YAAY,OAAO,CAAC,CAAC;;;;wBAMjC;IAAE,KAAK,SAAS;IAAC,MAAM,SAAQ;CAAE;;;;;;;8BAYjC;IACZ,OAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAY,CAAC,E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,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI"}
@@ -56,6 +56,17 @@
56
56
 
57
57
  /** @typedef {CropAspectRatio[]} CropPresetList */
58
58
 
59
+ /**
60
+ * @typedef {Partial<{
61
+ * [K in Direction]: {
62
+ * direction: Direction;
63
+ * pathNode: SVGElement;
64
+ * interactionNode: SVGElement;
65
+ * groupNode: SVGElement;
66
+ * };
67
+ * }>} FrameThumbs
68
+ */
69
+
59
70
  /** @typedef {'' | 'n' | 's' | 'e' | 'w' | 'ne' | 'nw' | 'se' | 'sw'} Direction */
60
71
 
61
72
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"AAkBA;IAIE,eAAe;IACf,mBAAuB;IACvB;;;OAGG;IACH,eAAc;IACd,eAAe;IACf,wBAAwB;IACxB,eAAe;IACf,gCAA4E;IAC5E,eAAe;IACf,iCAA0E;IAE1E,eAAe;IACf,sBAAsB;IAKpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA4BC;IAGH,eASC;IAED;;;OAGG;IACH,0BAaC;IAED,eAAe;IACf,wBAgBC;IAED,eAAe;IACf,2BAsCC;IAED;;;;OAIG;IACH,kBAUC;IAED;;;OAGG;IACH,uBAkDC;IAsCD,wEAAwE;IACxE,oBADY,CAAC,oBAAoB,CAAC,CAAC,MAAM,oBAAoB,CAAC,QA0B7D;IAaC,eAAe;IACf,kBAEE;IAWJ;;;MAEC;IAED;;;OAGG;IACH,uBAEC;IAED,wBAsFC;CACF;;;;;8BApa6B,iCAAiC;AAO/D;;;;;GAKG"}
1
+ {"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["FileItem.js"],"names":[],"mappings":"AAkBA;IAIE,eAAe;IACf,mBAAuB;IACvB;;;OAGG;IACH,eAAc;IACd,eAAe;IACf,wBAAwB;IACxB,eAAe;IACf,gCAA4E;IAC5E,eAAe;IACf,iCAA0E;IAE1E,eAAe;IACf,sBAAsB;IAKpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BC;IAGH,eASC;IAED;;;OAGG;IACH,0BAaC;IAED,eAAe;IACf,wBAgBC;IAED,eAAe;IACf,2BAsCC;IAED;;;;OAIG;IACH,kBAUC;IAED;;;OAGG;IACH,uBAkDC;IAsCD,wEAAwE;IACxE,oBADY,CAAC,oBAAoB,CAAC,CAAC,MAAM,oBAAoB,CAAC,QA0B7D;IAaC,eAAe;IACf,kBAEE;IAWJ;;;MAEC;IAED;;;OAGG;IACH,uBAEC;IAED,wBAsFC;CACF;;;;;8BAva6B,iCAAiC;AAO/D;;;;;GAKG"}
@@ -60,7 +60,10 @@ export class FileItem extends UploaderBlock {
60
60
  this.$['*currentActivityParams'] = {
61
61
  internalId: this._entry.uid,
62
62
  };
63
- this.$['*currentActivity'] = ActivityBlock.activities.CLOUD_IMG_EDIT;
63
+ this.cfg.useLocalImageEditor ?
64
+ this.$['*currentActivity'] = ActivityBlock.activities.LOCAL_IMAGE_EDITOR :
65
+ this.$['*currentActivity'] = ActivityBlock.activities.CLOUD_IMG_EDIT;
66
+
64
67
  },
65
68
  onRemove: () => {
66
69
  this.uploadCollection.remove(this.$.uid);
@@ -127,7 +130,7 @@ export class FileItem extends UploaderBlock {
127
130
  }
128
131
  let entry = this._entry;
129
132
 
130
- if (entry.getValue('fileInfo') && entry.getValue('isImage')) {
133
+ if (!this.cfg.useLocalImageEditor && entry.getValue('fileInfo') && entry.getValue('isImage')) {
131
134
  let size = this.cfg.thumbSize;
132
135
  let thumbUrl = await this.proxyUrl(
133
136
  createCdnUrl(
@@ -143,7 +146,7 @@ export class FileItem extends UploaderBlock {
143
146
  return;
144
147
  }
145
148
 
146
- if (entry.getValue('thumbUrl')) {
149
+ if (!this.cfg.useLocalImageEditor && entry.getValue('thumbUrl')) {
147
150
  return;
148
151
  }
149
152
 
@@ -289,7 +292,7 @@ export class FileItem extends UploaderBlock {
289
292
  isUploading: state === FileItemState.UPLOADING,
290
293
  isFinished: state === FileItemState.FINISHED,
291
294
  progressVisible: state === FileItemState.UPLOADING,
292
- isEditable: this.cfg.useCloudImageEditor && this._entry?.getValue('isImage') && this._entry?.getValue('cdnUrl'),
295
+ isEditable: this.cfg.useLocalImageEditor || ( this.cfg.useCloudImageEditor && this._entry?.getValue('isImage') && this._entry?.getValue('cdnUrl')),
293
296
  errorText: this._entry.getValue('errors')?.[0]?.message,
294
297
  ariaLabelStatusFile: this.l10n('a11y-file-item-status', {
295
298
  fileName: this._entry?.getValue('fileName'),
@@ -0,0 +1,22 @@
1
+ export class LocalEditorImage extends UploaderBlock {
2
+ activityType: "local-image-editor";
3
+ /**
4
+ * @private
5
+ * @type {import('../../abstract/TypedData.js').TypedData | undefined}
6
+ */
7
+ private _entry;
8
+ /**
9
+ * @private
10
+ * @type {undefined}
11
+ */
12
+ private _instance;
13
+ get activityParams(): import("../CloudImageEditorActivity/CloudImageEditorActivity.js").ActivityParams;
14
+ mounted(): void;
15
+ _applyButton(): void;
16
+ unmounted(): void;
17
+ }
18
+ export namespace LocalEditorImage {
19
+ let template: string;
20
+ }
21
+ import { UploaderBlock } from '../../abstract/UploaderBlock.js';
22
+ //# sourceMappingURL=LocalEditorImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalEditorImage.d.ts","sourceRoot":"","sources":["LocalEditorImage.js"],"names":[],"mappings":"AAoCA;IAGE,mCAA2D;IAE3D;;;OAGG;IACH,eAAO;IAEP;;;OAGG;IACH,kBAAU;IAEV,uGAMC;IAYD,gBA2BC;IAED,qBA4BC;IAED,kBAKC;CACF;;;;8BAtI6B,iCAAiC"}