szld-libs 0.2.25 → 0.2.26

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.
@@ -1,11 +1,11 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { Upload, Image, Button, message, Modal } from "antd";
3
2
  import { PlusOutlined, UploadOutlined } from "@ant-design/icons";
4
- import { FileSuffix } from "../../utils/filetype";
3
+ import { Upload, Image, Button, message, Modal } from "antd";
5
4
  import { useState } from "react";
6
- import { getFileSuffix, getBase64 } from "../../utils";
7
5
  import "react-dom";
8
- import { compressionFile } from "../../utils/compression-file";
6
+ import { getFileSuffix, getBase64 } from "../../utils";
7
+ import { FileSuffix } from "../../utils/filetype";
8
+ import compressionImage from "../../utils/image-compression";
9
9
  const defaultFileType = [FileSuffix.jpeg, FileSuffix.jpg, FileSuffix.png];
10
10
  const UploadFile = (props) => {
11
11
  const {
@@ -50,9 +50,8 @@ const UploadFile = (props) => {
50
50
  }
51
51
  if (compression) {
52
52
  resolve(
53
- compressionFile(
53
+ compressionImage(
54
54
  file,
55
- compression.type,
56
55
  compression.quality,
57
56
  compression.limit
58
57
  )
package/es/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useEffect } from "react";
3
3
  import ReactDOM from "react-dom/client";
4
4
  import { BrowserRouter } from "react-router-dom";
5
5
  import useConfig from "./hooks/useConfig";
6
- import { AES } from "./main";
6
+ import { AES, UploadFile } from "./main";
7
7
  let key = "U2FsdGVkX1/dG1NSXNR9hnp3Ech/v6Gh8CDDJxgBm1EPFQel12ySIf84ARXCPwTae7TzwgPvjOyE3S5rAEzl/wAZmId6pbezpFeFcJqxdmIl3FeluYHFxJzQHDETTvrr3G/REvv00kHptOVwg6ecjPH6yk7PNit0sWTBLorROxLxMD8lVDmOA66p7Zp4QnYzqScYJGFbutmfHYXfBRBe1Q2UKummJ798svNY5SIwEwl4spzgyWmhARtuyq4zhysFrj/xODuNDjtwitA6XfX566WcZkj3F+2P+mkYzDYOhXXaomnlybjrZ2hEHfcczQhUfJd89O8PNIuEWo24wjYRgMdKlw5CWSeocFCqV7ZJ/CV/7vNRcaO4awKlFNobLikkwDznxpcX+4UEej+ED+pgfmPQLsKedcfEscStkSAZXaD5pBRTiFU9xGLfDt6seUrEnMBeXkpMIY9j1SZDDK18/G7lSHjDQMZYZP6sfLdBdwY=";
8
8
  const Demo = () => {
9
9
  useConfig(key);
@@ -21,7 +21,10 @@ const Demo = () => {
21
21
  Salt: "HnSzldjt#2557013#"
22
22
  }));
23
23
  };
24
- return /* @__PURE__ */ jsx("div", { style: { height: "100vh" }, children: "测试页面" });
24
+ return /* @__PURE__ */ jsxs("div", { style: { height: "100vh" }, children: [
25
+ "测试页面",
26
+ /* @__PURE__ */ jsx(UploadFile, { compression: { quality: 0.8, limit: 5 * 1024 }, accept: ".heic,.jpg,.png,.jpeg", maxSize: 100 })
27
+ ] });
25
28
  };
26
29
  ReactDOM.createRoot(document.getElementById("root")).render(
27
30
  /* @__PURE__ */ jsx(BrowserRouter, { children: /* @__PURE__ */ jsx(Demo, {}) })
package/es/main.d.ts CHANGED
@@ -9,6 +9,7 @@ import showWorkFlow, { WorkFlowNode } from "./components/WorkFlowNode";
9
9
  import * as download from "./utils/download";
10
10
  import * as fileType from "./utils/filetype";
11
11
  import * as FormRules from './utils/formRules';
12
+ import compressionImage from './utils/image-compression';
12
13
  import * as utils from "./utils/index";
13
14
  import * as verfyCode from "./utils/verify-code";
14
15
  import useCaptcha from "./hooks/useCaptcha";
@@ -18,4 +19,4 @@ import useRemember from "./hooks/useRemember";
18
19
  import useRowSelection from "./hooks/useRowSelection";
19
20
  import AES from "./utils/aes";
20
21
  import HmacSHA512 from './utils/hmacSHA512';
21
- export { AES, AuthButton, BackHeader, CoralButton, CreateForm, EditTable, FormRules, HmacSHA512, SearchTable, UploadFile, WorkFlowNode, download, fileType, showWorkFlow, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, utils, verfyCode };
22
+ export { AES, AuthButton, BackHeader, CoralButton, CreateForm, EditTable, FormRules, HmacSHA512, SearchTable, UploadFile, WorkFlowNode, compressionImage, download, fileType, showWorkFlow, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, utils, verfyCode };
package/es/main.js CHANGED
@@ -9,35 +9,37 @@ import { WorkFlowNode, default as default9 } from "./components/WorkFlowNode";
9
9
  import * as download from "./utils/download";
10
10
  import * as filetype from "./utils/filetype";
11
11
  import * as formRules from "./utils/formRules";
12
+ import { default as default10 } from "./utils/image-compression";
12
13
  import * as index from "./utils/index";
13
14
  import * as verifyCode from "./utils/verify-code";
14
- import { default as default10 } from "./hooks/useCaptcha";
15
- import { default as default11 } from "./hooks/useChangePwd";
16
- import { default as default12 } from "./hooks/useConfig";
17
- import { default as default13 } from "./hooks/useRemember";
18
- import { default as default14 } from "./hooks/useRowSelection";
19
- import { default as default15 } from "./utils/aes";
20
- import { default as default16 } from "./utils/hmacSHA512";
15
+ import { default as default11 } from "./hooks/useCaptcha";
16
+ import { default as default12 } from "./hooks/useChangePwd";
17
+ import { default as default13 } from "./hooks/useConfig";
18
+ import { default as default14 } from "./hooks/useRemember";
19
+ import { default as default15 } from "./hooks/useRowSelection";
20
+ import { default as default16 } from "./utils/aes";
21
+ import { default as default17 } from "./utils/hmacSHA512";
21
22
  export {
22
- default15 as AES,
23
+ default16 as AES,
23
24
  default7 as AuthButton,
24
25
  default2 as BackHeader,
25
26
  default8 as CoralButton,
26
27
  default3 as CreateForm,
27
28
  default6 as EditTable,
28
29
  formRules as FormRules,
29
- default16 as HmacSHA512,
30
+ default17 as HmacSHA512,
30
31
  default4 as SearchTable,
31
32
  default5 as UploadFile,
32
33
  WorkFlowNode,
34
+ default10 as compressionImage,
33
35
  download,
34
36
  filetype as fileType,
35
37
  default9 as showWorkFlow,
36
- default10 as useCaptcha,
37
- default11 as useChangePwd,
38
- default12 as useConfig,
39
- default13 as useRemember,
40
- default14 as useRowSelection,
38
+ default11 as useCaptcha,
39
+ default12 as useChangePwd,
40
+ default13 as useConfig,
41
+ default14 as useRemember,
42
+ default15 as useRowSelection,
41
43
  index as utils,
42
44
  verifyCode as verfyCode
43
45
  };
@@ -0,0 +1,142 @@
1
+ export default UPNG;
2
+ declare namespace UPNG {
3
+ function toRGBA8(out: any): ArrayBufferLike[];
4
+ namespace toRGBA8 {
5
+ function decodeImage(data: any, w: any, h: any, out: any): Uint8Array;
6
+ }
7
+ function decode(buff: any): {
8
+ tabs: {};
9
+ frames: never[];
10
+ };
11
+ namespace decode {
12
+ function _decompress(out: any, dd: any, w: any, h: any): any;
13
+ function _inflate(data: any, buff: any): any;
14
+ function _readInterlace(data: any, out: any): Uint8Array;
15
+ function _getBPP(out: any): number;
16
+ function _filterZero(data: any, out: any, off: any, w: any, h: any): any;
17
+ function _paeth(a: any, b: any, c: any): any;
18
+ function _IHDR(data: any, offset: any, out: any): void;
19
+ }
20
+ function inflateRaw(N: any, W: any): any;
21
+ namespace _bin {
22
+ function nextZero(data: any, p: any): any;
23
+ function readUshort(buff: any, p: any): number;
24
+ function writeUshort(buff: any, p: any, n: any): void;
25
+ function readUint(buff: any, p: any): number;
26
+ function writeUint(buff: any, p: any, n: any): void;
27
+ function readASCII(buff: any, p: any, l: any): string;
28
+ function writeASCII(data: any, p: any, s: any): void;
29
+ function readBytes(buff: any, p: any, l: any): any[];
30
+ function pad(n: any): any;
31
+ function readUTF8(buff: any, p: any, l: any): string;
32
+ }
33
+ function _copyTile(sb: any, sw: any, sh: any, tb: any, tw: any, th: any, xoff: any, yoff: any, mode: any): boolean;
34
+ function encode(bufs: any, w: any, h: any, ps: any, dels: any, tabs: any, forbidPlte: any): ArrayBufferLike;
35
+ namespace encode {
36
+ function _main(nimg: any, w: any, h: any, dels: any, tabs: any): ArrayBufferLike;
37
+ function compressPNG(out: any, filter: any, levelZero: any): void;
38
+ function compress(bufs: any, w: any, h: any, ps: any, prms: any): {
39
+ ctype: number;
40
+ depth: number;
41
+ plte: any[];
42
+ frames: {
43
+ rect: {
44
+ x: number;
45
+ y: number;
46
+ width: any;
47
+ height: any;
48
+ };
49
+ img: Uint8Array;
50
+ blend: number;
51
+ dispose: number;
52
+ }[];
53
+ };
54
+ function framize(bufs: any, w: any, h: any, alwaysBlend: any, evenCrd: any, forbidPrev: any): {
55
+ rect: {
56
+ x: number;
57
+ y: number;
58
+ width: any;
59
+ height: any;
60
+ };
61
+ img: Uint8Array;
62
+ blend: number;
63
+ dispose: number;
64
+ }[];
65
+ function _updateFrame(bufs: any, w: any, h: any, frms: any, i: any, r: any, evenCrd: any): void;
66
+ function _prepareDiff(cimg: any, w: any, h: any, nimg: any, rec: any): void;
67
+ function _filterZero(img: any, h: any, bpp: any, bpl: any, data: any, filter: any, levelZero: any): any;
68
+ function _filterLine(data: any, img: any, y: any, bpl: any, bpp: any, type: any): void;
69
+ function concatRGBA(bufs: any): ArrayBufferLike;
70
+ }
71
+ function encodeLL(bufs: any, w: any, h: any, cc: any, ac: any, depth: any, dels: any, tabs: any): ArrayBufferLike;
72
+ namespace crc {
73
+ export const table: Uint32Array;
74
+ export function update(c: any, buf: any, off: any, len: any): any;
75
+ export function crc_1(b: any, o: any, l: any): number;
76
+ export { crc_1 as crc };
77
+ }
78
+ function quantize(abuf: any, ps: any): {
79
+ abuf: ArrayBufferLike;
80
+ inds: Uint8Array;
81
+ plte: {
82
+ i0: number;
83
+ i1: any;
84
+ bst: null;
85
+ est: null;
86
+ tdst: number;
87
+ left: null;
88
+ right: null;
89
+ } | {
90
+ i0: number;
91
+ i1: any;
92
+ bst: null;
93
+ est: null;
94
+ tdst: number;
95
+ left: null;
96
+ right: null;
97
+ }[];
98
+ };
99
+ namespace quantize {
100
+ function getKDtree(nimg: any, ps: any, err: any): ({
101
+ i0: number;
102
+ i1: any;
103
+ bst: null;
104
+ est: null;
105
+ tdst: number;
106
+ left: null;
107
+ right: null;
108
+ } | {
109
+ i0: number;
110
+ i1: any;
111
+ bst: null;
112
+ est: null;
113
+ tdst: number;
114
+ left: null;
115
+ right: null;
116
+ }[])[];
117
+ function getNearest(nd: any, r: any, g: any, b: any, a: any): any;
118
+ function planeDst(est: any, r: any, g: any, b: any, a: any): number;
119
+ function dist(q: any, r: any, g: any, b: any, a: any): number;
120
+ function splitPixels(nimg: any, nimg32: any, i0: any, i1: any, e: any, eMq: any): any;
121
+ function vecDot(nimg: any, i: any, e: any): number;
122
+ function stats(nimg: any, i0: any, i1: any): {
123
+ R: number[];
124
+ m: number[];
125
+ N: number;
126
+ };
127
+ function estats(stats: any): {
128
+ Cov: number[];
129
+ q: number[];
130
+ e: number[];
131
+ L: number;
132
+ eMq255: number;
133
+ eMq: number;
134
+ rgba: number;
135
+ };
136
+ }
137
+ namespace M4 {
138
+ function multVec(m: any, v: any): number[];
139
+ function dot(x: any, y: any): number;
140
+ function sml(a: any, y: any): number[];
141
+ }
142
+ }