zartui 3.1.19 → 3.1.21

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 (60) hide show
  1. package/README.md +23 -23
  2. package/es/avatar/Avatar.mjs +1 -1
  3. package/es/icon/index.css +1 -1
  4. package/es/index.d.ts +1 -1
  5. package/es/index.mjs +1 -1
  6. package/es/lazyload/vue-lazyload/index.d.ts +55 -55
  7. package/es/media-picker/MediaPicker.d.ts +14 -1
  8. package/es/media-picker/MediaPicker.mjs +45 -6
  9. package/es/media-picker/index.d.ts +10 -1
  10. package/es/media-picker/type.d.ts +1 -0
  11. package/es/media-picker/util/media-util.d.ts +0 -55
  12. package/es/media-picker/util/media-util.mjs +1 -203
  13. package/es/tabs/Tabs.mjs +1 -0
  14. package/es/tabs/TabsTitle.d.ts +2 -0
  15. package/es/tabs/TabsTitle.mjs +24 -2
  16. package/es/uploader/Uploader.d.ts +1 -1
  17. package/es/uploader/index.d.ts +1 -1
  18. package/es/vue-sfc-shim.d.ts +6 -6
  19. package/es/vue-tsx-shim.d.ts +23 -23
  20. package/lib/avatar/Avatar.js +1 -1
  21. package/lib/icon/index.css +1 -1
  22. package/lib/index.css +1 -1
  23. package/lib/index.d.ts +1 -1
  24. package/lib/index.js +1 -1
  25. package/lib/lazyload/vue-lazyload/index.d.ts +55 -55
  26. package/lib/media-picker/MediaPicker.d.ts +14 -1
  27. package/lib/media-picker/MediaPicker.js +49 -10
  28. package/lib/media-picker/index.d.ts +10 -1
  29. package/lib/media-picker/type.d.ts +1 -0
  30. package/lib/media-picker/util/media-util.d.ts +0 -55
  31. package/lib/media-picker/util/media-util.js +1 -203
  32. package/lib/tabs/Tabs.js +1 -0
  33. package/lib/tabs/TabsTitle.d.ts +2 -0
  34. package/lib/tabs/TabsTitle.js +23 -1
  35. package/lib/uploader/Uploader.d.ts +1 -1
  36. package/lib/uploader/index.d.ts +1 -1
  37. package/lib/vue-sfc-shim.d.ts +6 -6
  38. package/lib/vue-tsx-shim.d.ts +23 -23
  39. package/lib/web-types.json +1 -1
  40. package/lib/zartui.cjs.js +101 -1019
  41. package/lib/zartui.es.js +97 -1015
  42. package/lib/zartui.js +1159 -649
  43. package/lib/zartui.min.js +1 -1
  44. package/package.json +7 -6
  45. package/es/media-picker/watermark/compress-options.d.ts +0 -5
  46. package/es/media-picker/watermark/compress-options.mjs +0 -23
  47. package/es/media-picker/watermark/image-processor.d.ts +0 -12
  48. package/es/media-picker/watermark/image-processor.mjs +0 -97
  49. package/es/media-picker/watermark/resize-options.d.ts +0 -4
  50. package/es/media-picker/watermark/resize-options.mjs +0 -27
  51. package/es/media-picker/watermark/watermark.d.ts +0 -42
  52. package/es/media-picker/watermark/watermark.mjs +0 -653
  53. package/lib/media-picker/watermark/compress-options.d.ts +0 -5
  54. package/lib/media-picker/watermark/compress-options.js +0 -41
  55. package/lib/media-picker/watermark/image-processor.d.ts +0 -12
  56. package/lib/media-picker/watermark/image-processor.js +0 -110
  57. package/lib/media-picker/watermark/resize-options.d.ts +0 -4
  58. package/lib/media-picker/watermark/resize-options.js +0 -45
  59. package/lib/media-picker/watermark/watermark.d.ts +0 -42
  60. package/lib/media-picker/watermark/watermark.js +0 -664
@@ -1,110 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var __publicField = (obj, key, value) => {
20
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
- return value;
22
- };
23
- var stdin_exports = {};
24
- __export(stdin_exports, {
25
- ImageProcessor: () => ImageProcessor
26
- });
27
- module.exports = __toCommonJS(stdin_exports);
28
- var import_watermark = require("./watermark");
29
- var import_utils = require("../../utils");
30
- var import_media_util = require("../util/media-util");
31
- const DEFAULT_JPEG_QUALITY = 0.8;
32
- const MIN_JPEG_QUALITY = 0.1;
33
- const JPEG_QUALITY_STEP = 0.05;
34
- class ImageProcessor {
35
- // 压缩图片的配置
36
- constructor(file, resizeOptions, watermarkOptions, compressOptions) {
37
- __publicField(this, "file");
38
- // 图片文件
39
- __publicField(this, "resizeOptions");
40
- // 缩放图片的配置
41
- __publicField(this, "watermarkOptions");
42
- // 打水印配置项和相关环境信息
43
- __publicField(this, "compressOptions");
44
- this.file = file;
45
- this.resizeOptions = resizeOptions;
46
- this.watermarkOptions = watermarkOptions;
47
- this.compressOptions = compressOptions;
48
- }
49
- process() {
50
- const filename = this.file.name;
51
- let fileType = this.file.type;
52
- const { lastModified } = this.file;
53
- let orientation = 1;
54
- if (this.file.size > this.compressOptions.photoFileSizeLimit * 1024) {
55
- fileType = "image/jpeg";
56
- }
57
- if ((0, import_utils.isIOS)() && fileType === "image/jpeg" && (0, import_utils.getIosVersion)() < "13.4") {
58
- const reader = new FileReader();
59
- reader.readAsArrayBuffer(this.file);
60
- reader.onload = function(_ref) {
61
- const { target } = _ref;
62
- if (target == null ? void 0 : target.result) {
63
- orientation = (0, import_media_util.getOrientation)(target == null ? void 0 : target.result);
64
- }
65
- };
66
- }
67
- if (fileType === "image/gif") {
68
- fileType = "image/png";
69
- }
70
- return (0, import_media_util.file2Image)(this.file).then(
71
- (img) => (
72
- // 第一步 resize image
73
- (0, import_media_util.resize)(img, {
74
- inputType: fileType,
75
- orientation,
76
- sideLengthLimit: this.resizeOptions.maxSideLength,
77
- resultType: "canvas"
78
- })
79
- )
80
- ).then((result) => {
81
- const canvas = result;
82
- return (0, import_watermark.renderWatermark)(canvas, this.watermarkOptions);
83
- }).then((canvas) => {
84
- const exportFilename = filename.replace(/\./g, "-") + ".jpg";
85
- return this.compress(
86
- canvas,
87
- exportFilename,
88
- lastModified,
89
- fileType,
90
- DEFAULT_JPEG_QUALITY
91
- );
92
- });
93
- }
94
- compress(canvas, filename, lastModified, type, quality) {
95
- return (0, import_media_util.canvas2File)(canvas, filename, lastModified, type, quality).then(
96
- (file) => {
97
- if (file.size > this.compressOptions.photoFileSizeLimit * 1024 && quality - JPEG_QUALITY_STEP > MIN_JPEG_QUALITY) {
98
- return this.compress(
99
- canvas,
100
- filename,
101
- lastModified,
102
- type,
103
- quality - JPEG_QUALITY_STEP
104
- );
105
- }
106
- return Promise.resolve(file);
107
- }
108
- );
109
- }
110
- }
@@ -1,4 +0,0 @@
1
- export declare class ResizeOptions {
2
- maxSideLength: number;
3
- constructor(maxSideLength: number);
4
- }
@@ -1,45 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var __publicField = (obj, key, value) => {
20
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
- return value;
22
- };
23
- var stdin_exports = {};
24
- __export(stdin_exports, {
25
- ResizeOptions: () => ResizeOptions
26
- });
27
- module.exports = __toCommonJS(stdin_exports);
28
- var import_utils = require("../../utils");
29
- var import_media_util = require("../util/media-util");
30
- class ResizeOptions {
31
- // 最大边长
32
- constructor(maxSideLength) {
33
- __publicField(this, "maxSideLength");
34
- if (!(0, import_utils.isDef)(maxSideLength)) {
35
- this.maxSideLength = import_media_util.MAX_SIDE_LENGTH;
36
- } else {
37
- this.maxSideLength = maxSideLength;
38
- if (this.maxSideLength > import_media_util.MAX_SIDE_LENGTH) {
39
- this.maxSideLength = import_media_util.MAX_SIDE_LENGTH;
40
- } else if (this.maxSideLength < import_media_util.MIN_SIDE_LENGTH) {
41
- this.maxSideLength = import_media_util.MIN_SIDE_LENGTH;
42
- }
43
- }
44
- }
45
- }
@@ -1,42 +0,0 @@
1
- export interface WatermarkContextParams {
2
- address: string;
3
- watermarkTime: Date;
4
- humanName: string;
5
- projectName: string;
6
- logo: File;
7
- }
8
- export type WatermarkContext = {
9
- address: string;
10
- watermarkTime: Date;
11
- humanName: string;
12
- projectName: string;
13
- logo?: File;
14
- };
15
- export interface WatermarkOptionsParams {
16
- enabled: boolean;
17
- watermarkConfigString: string;
18
- context: WatermarkContext;
19
- }
20
- export type WatermarkOptions = {
21
- enabled: boolean;
22
- watermarkConfigString?: string;
23
- context?: WatermarkContext;
24
- };
25
- /**
26
- * A JavaScript Scanner like Java's
27
- * @see java.util.Scanner
28
- */
29
- export declare class TextScanner {
30
- private text;
31
- private cursor;
32
- /**
33
- * The content to scan
34
- * @param text
35
- */
36
- constructor(text: string);
37
- hasNext(obj?: any): boolean;
38
- next(obj?: any): string | RegExpMatchArray | null;
39
- skip(obj?: string): TextScanner;
40
- }
41
- export declare function renderWatermark(canvas: HTMLCanvasElement, options: WatermarkOptions): Promise<HTMLCanvasElement>;
42
- export declare function checkWatermarkConfigSupported(watermarkConfigString: string): boolean;