@ablogcms/lib 3.2.28-beta.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.
- package/README.md +29 -0
- package/dist/a-table/index.d.ts +10 -0
- package/dist/a-table/index.mjs +48 -0
- package/dist/a-table/index.mjs.map +1 -0
- package/dist/acms.d.ts +8 -0
- package/dist/acms.mjs +1 -0
- package/dist/acms.mjs.map +1 -0
- package/dist/chunk-AMZYQ4DG.mjs +344 -0
- package/dist/chunk-AMZYQ4DG.mjs.map +1 -0
- package/dist/chunk-W7TT2YZB.mjs +271 -0
- package/dist/chunk-W7TT2YZB.mjs.map +1 -0
- package/dist/chunk-ZPZHEKTI.mjs +20 -0
- package/dist/chunk-ZPZHEKTI.mjs.map +1 -0
- package/dist/command.d.ts +5 -0
- package/dist/command.mjs +63 -0
- package/dist/command.mjs.map +1 -0
- package/dist/create-pdf.d.ts +1 -0
- package/dist/create-pdf.mjs +27 -0
- package/dist/create-pdf.mjs.map +1 -0
- package/dist/events.d.ts +210 -0
- package/dist/flatpicker/date-picker.d.ts +6 -0
- package/dist/flatpicker/date-picker.mjs +28 -0
- package/dist/flatpicker/date-picker.mjs.map +1 -0
- package/dist/flatpicker/time-picker.d.ts +6 -0
- package/dist/flatpicker/time-picker.mjs +28 -0
- package/dist/flatpicker/time-picker.mjs.map +1 -0
- package/dist/geolocation.d.ts +1 -0
- package/dist/geolocation.mjs +30 -0
- package/dist/geolocation.mjs.map +1 -0
- package/dist/google-maps/google-maps.d.ts +6 -0
- package/dist/google-maps/google-maps.mjs +105 -0
- package/dist/google-maps/google-maps.mjs.map +1 -0
- package/dist/google-maps/loader.d.ts +9 -0
- package/dist/google-maps/loader.mjs +7 -0
- package/dist/google-maps/loader.mjs.map +1 -0
- package/dist/google-maps/picker/google-maps-picker.d.ts +72 -0
- package/dist/google-maps/picker/index.d.ts +5 -0
- package/dist/google-maps/picker/index.mjs +483 -0
- package/dist/google-maps/picker/index.mjs.map +1 -0
- package/dist/google-maps/street-view.d.ts +2 -0
- package/dist/google-maps/street-view.mjs +25 -0
- package/dist/google-maps/street-view.mjs.map +1 -0
- package/dist/htmx/geolocation.d.ts +1 -0
- package/dist/htmx/geolocation.mjs +40 -0
- package/dist/htmx/geolocation.mjs.map +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.mjs +181 -0
- package/dist/icons.mjs.map +1 -0
- package/dist/lazy-load/index.d.ts +2 -0
- package/dist/lazy-load/index.mjs +21 -0
- package/dist/lazy-load/index.mjs.map +1 -0
- package/dist/lite-editor/index.d.ts +87 -0
- package/dist/lite-editor/index.mjs +274 -0
- package/dist/lite-editor/index.mjs.map +1 -0
- package/dist/lite-editor-field/index.d.ts +8 -0
- package/dist/lite-editor-field/index.mjs +18 -0
- package/dist/lite-editor-field/index.mjs.map +1 -0
- package/dist/loader/index.d.ts +2 -0
- package/dist/loader/index.mjs +262 -0
- package/dist/loader/index.mjs.map +1 -0
- package/dist/loader/loader.d.ts +29 -0
- package/dist/loader/sync-loader.d.ts +104 -0
- package/dist/open-street-map/open-street-map.d.ts +2 -0
- package/dist/open-street-map/open-street-map.mjs +60 -0
- package/dist/open-street-map/open-street-map.mjs.map +1 -0
- package/dist/open-street-map/picker/index.d.ts +6 -0
- package/dist/open-street-map/picker/index.mjs +50 -0
- package/dist/open-street-map/picker/index.mjs.map +1 -0
- package/dist/open-street-map/picker/open-street-map-picker.d.ts +55 -0
- package/dist/open-street-map/picker/open-street-map-picker.mjs +7 -0
- package/dist/open-street-map/picker/open-street-map-picker.mjs.map +1 -0
- package/dist/pdf2image.d.ts +21 -0
- package/dist/pdf2image.mjs +115 -0
- package/dist/pdf2image.mjs.map +1 -0
- package/dist/polyfill/index.d.ts +1 -0
- package/dist/polyfill/index.mjs +40 -0
- package/dist/polyfill/index.mjs.map +1 -0
- package/dist/read-files.d.ts +14 -0
- package/dist/read-files.mjs +62 -0
- package/dist/read-files.mjs.map +1 -0
- package/dist/resize-image/resize-image.d.ts +71 -0
- package/dist/resize-image/resize-image.mjs +308 -0
- package/dist/resize-image/resize-image.mjs.map +1 -0
- package/dist/resize-image/util.d.ts +134 -0
- package/dist/resize-image/util.mjs +7 -0
- package/dist/resize-image/util.mjs.map +1 -0
- package/dist/select2/index.d.ts +1 -0
- package/dist/select2/index.mjs +33 -0
- package/dist/select2/index.mjs.map +1 -0
- package/dist/trumbowyg.d.ts +12 -0
- package/dist/wysiwyg.d.ts +2 -0
- package/dist/wysiwyg.mjs +21 -0
- package/dist/wysiwyg.mjs.map +1 -0
- package/dist/zxcvbn/index.d.ts +2 -0
- package/dist/zxcvbn/index.mjs +35 -0
- package/dist/zxcvbn/index.mjs.map +1 -0
- package/package.json +203 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @ablogcms/lib
|
|
2
|
+
|
|
3
|
+
管理画面フロントエンドが共有するランタイムインフラを sub-path exports として提供するパッケージ。
|
|
4
|
+
|
|
5
|
+
## 使い方
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { resizeImage } from '@ablogcms/lib/resize-image';
|
|
9
|
+
import ExtendedFile from '@ablogcms/lib/read-files';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
モジュール単位で import する(バレル export はない)。主なモジュール:
|
|
13
|
+
|
|
14
|
+
| sub-path | 内容 |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `./read-files` | ファイル読み込みユーティリティ |
|
|
17
|
+
| `./resize-image` / `./resize-image-util` | 画像リサイズ |
|
|
18
|
+
| `./google-maps` / `./google-maps-picker` / `./google-maps-street-view` | Google Maps 連携 |
|
|
19
|
+
| `./open-street-map` / `./open-street-map-picker` | OpenStreetMap 連携 |
|
|
20
|
+
| `./a-table` | 表組みライブラリのラッパー |
|
|
21
|
+
| `./lite-editor` / `./lite-editor-field` | リッチテキストエディタ |
|
|
22
|
+
| `./flatpicker-date-picker` / `./flatpicker-time-picker` | 日時ピッカー |
|
|
23
|
+
| `./wysiwyg` | WYSIWYG エディタ |
|
|
24
|
+
| `./pdf2image` / `./create-pdf` | PDF 変換 |
|
|
25
|
+
| `./lazy-load` / `./loader` | 遅延読み込み |
|
|
26
|
+
| `./select2` / `./zxcvbn` / `./polyfill` | 各種ライブラリラッパー |
|
|
27
|
+
|
|
28
|
+
複数パッケージから共有されるランタイムインフラのみを収容する。単一パッケージ専用のヘルパーは
|
|
29
|
+
各パッケージ側に置く。
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/a-table/index.ts
|
|
2
|
+
import Atable from "a-table";
|
|
3
|
+
import "a-table/css/a-table.css";
|
|
4
|
+
function setupAtable(element, options = {}) {
|
|
5
|
+
const { onChange, ...rest } = options;
|
|
6
|
+
const root = element.querySelector(ACMS.Config.aTableMark);
|
|
7
|
+
if (root === null) {
|
|
8
|
+
throw new Error("a-table root element not found");
|
|
9
|
+
}
|
|
10
|
+
if (root.aTable instanceof Atable) {
|
|
11
|
+
return root.aTable;
|
|
12
|
+
}
|
|
13
|
+
const dest = root.querySelector(ACMS.Config.aTableDestMark);
|
|
14
|
+
const table = root.querySelector("table");
|
|
15
|
+
if (table === null) {
|
|
16
|
+
throw new Error("a-table table element not found");
|
|
17
|
+
}
|
|
18
|
+
const aTable = new Atable(table, {
|
|
19
|
+
mark: ACMS.Config.aTableConf,
|
|
20
|
+
selector: {
|
|
21
|
+
option: ACMS.Config.aTableSelector
|
|
22
|
+
},
|
|
23
|
+
tableOption: ACMS.Config.aTableOption,
|
|
24
|
+
message: ACMS.Config.aTableMessage,
|
|
25
|
+
...rest
|
|
26
|
+
});
|
|
27
|
+
aTable.afterRendered = () => {
|
|
28
|
+
const value = aTable.getTable();
|
|
29
|
+
if (dest !== null) {
|
|
30
|
+
dest.value = value;
|
|
31
|
+
}
|
|
32
|
+
onChange?.(value);
|
|
33
|
+
};
|
|
34
|
+
aTable.afterEntered = () => {
|
|
35
|
+
const value = aTable.getTable();
|
|
36
|
+
if (dest !== null) {
|
|
37
|
+
dest.value = value;
|
|
38
|
+
}
|
|
39
|
+
onChange?.(value);
|
|
40
|
+
};
|
|
41
|
+
aTable.afterRendered();
|
|
42
|
+
root.aTable = aTable;
|
|
43
|
+
return aTable;
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
setupAtable as default
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/a-table/index.ts"],"sourcesContent":["// @ts-expect-error no types\nimport Atable from 'a-table';\nimport 'a-table/css/a-table.css';\n\nexport interface ATableOptions {\n onChange?: (value: string) => void;\n [key: string]: any; // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n\n/**\n * a-table を初期化する。\n * @deprecated a-table は非推奨です\n */\nexport default function setupAtable(element: HTMLElement, options: ATableOptions = {}) {\n const { onChange, ...rest } = options;\n const root = element.querySelector<HTMLElement & { aTable?: Atable }>(ACMS.Config.aTableMark);\n if (root === null) {\n throw new Error('a-table root element not found');\n }\n if (root.aTable instanceof Atable) {\n return root.aTable;\n }\n const dest = root.querySelector<HTMLInputElement>(ACMS.Config.aTableDestMark);\n const table = root.querySelector<HTMLTableElement>('table');\n if (table === null) {\n throw new Error('a-table table element not found');\n }\n const aTable = new Atable(table, {\n mark: ACMS.Config.aTableConf,\n selector: {\n option: ACMS.Config.aTableSelector,\n },\n tableOption: ACMS.Config.aTableOption,\n message: ACMS.Config.aTableMessage,\n ...rest,\n });\n aTable.afterRendered = () => {\n const value = aTable.getTable();\n if (dest !== null) {\n dest.value = value;\n }\n onChange?.(value);\n };\n aTable.afterEntered = () => {\n const value = aTable.getTable();\n if (dest !== null) {\n dest.value = value;\n }\n onChange?.(value);\n };\n aTable.afterRendered();\n root.aTable = aTable;\n\n return aTable;\n}\n"],"mappings":";AACA,OAAO,YAAY;AACnB,OAAO;AAWQ,SAAR,YAA6B,SAAsB,UAAyB,CAAC,GAAG;AACrF,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAC9B,QAAM,OAAO,QAAQ,cAAiD,KAAK,OAAO,UAAU;AAC5F,MAAI,SAAS,MAAM;AACjB,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,MAAI,KAAK,kBAAkB,QAAQ;AACjC,WAAO,KAAK;AAAA,EACd;AACA,QAAM,OAAO,KAAK,cAAgC,KAAK,OAAO,cAAc;AAC5E,QAAM,QAAQ,KAAK,cAAgC,OAAO;AAC1D,MAAI,UAAU,MAAM;AAClB,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AACA,QAAM,SAAS,IAAI,OAAO,OAAO;AAAA,IAC/B,MAAM,KAAK,OAAO;AAAA,IAClB,UAAU;AAAA,MACR,QAAQ,KAAK,OAAO;AAAA,IACtB;AAAA,IACA,aAAa,KAAK,OAAO;AAAA,IACzB,SAAS,KAAK,OAAO;AAAA,IACrB,GAAG;AAAA,EACL,CAAC;AACD,SAAO,gBAAgB,MAAM;AAC3B,UAAM,QAAQ,OAAO,SAAS;AAC9B,QAAI,SAAS,MAAM;AACjB,WAAK,QAAQ;AAAA,IACf;AACA,eAAW,KAAK;AAAA,EAClB;AACA,SAAO,eAAe,MAAM;AAC1B,UAAM,QAAQ,OAAO,SAAS;AAC9B,QAAI,SAAS,MAAM;AACjB,WAAK,QAAQ;AAAA,IACf;AACA,eAAW,KAAK;AAAA,EAClB;AACA,SAAO,cAAc;AACrB,OAAK,SAAS;AAEd,SAAO;AACT;","names":[]}
|
package/dist/acms.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type ResizeImage from './resize-image/resize-image.js';
|
|
2
|
+
import type geolocation from './geolocation.js';
|
|
3
|
+
declare module '@ablogcms/types/acms' {
|
|
4
|
+
interface AcmsLibrary {
|
|
5
|
+
ResizeImage: (elm: HTMLElement) => ResizeImage;
|
|
6
|
+
geolocation: typeof geolocation;
|
|
7
|
+
}
|
|
8
|
+
}
|
package/dist/acms.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=acms.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
// src/resize-image/util.ts
|
|
2
|
+
import { dataUrlToBlob } from "@ablogcms/utils/file";
|
|
3
|
+
var ResizeImageUtil = class {
|
|
4
|
+
/**
|
|
5
|
+
* URLからBASE64画像でリサイズ画像を取得
|
|
6
|
+
*
|
|
7
|
+
* @param url
|
|
8
|
+
* @param resizeType (null=long side, width, height)
|
|
9
|
+
* @param resizeSize (length)
|
|
10
|
+
* @param callback
|
|
11
|
+
*/
|
|
12
|
+
async getDataUrlFromUrl(url, resizeType, resizeSize, callback) {
|
|
13
|
+
const Mime = await import(
|
|
14
|
+
/* webpackChunkName: "mime-types" */
|
|
15
|
+
"mime-types"
|
|
16
|
+
);
|
|
17
|
+
const mimeType = Mime.lookup(url) || "image/png";
|
|
18
|
+
const image = new Image();
|
|
19
|
+
image.crossOrigin = "anonymous";
|
|
20
|
+
image.src = url;
|
|
21
|
+
const res = await this.getDataURL(image, mimeType, resizeType, resizeSize, callback);
|
|
22
|
+
return res;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* URLからBLOBデータでリサイズ画像を取得
|
|
26
|
+
*
|
|
27
|
+
* @param url
|
|
28
|
+
* @param resizeType
|
|
29
|
+
* @param resizeSize
|
|
30
|
+
* @param callback
|
|
31
|
+
*/
|
|
32
|
+
async getBlobFromUrl(url, resizeType, resizeSize, callback) {
|
|
33
|
+
const Mime = await import(
|
|
34
|
+
/* webpackChunkName: "mime-types" */
|
|
35
|
+
"mime-types"
|
|
36
|
+
);
|
|
37
|
+
const mimeType = Mime.lookup(url) || "image/png";
|
|
38
|
+
const image = new Image();
|
|
39
|
+
image.crossOrigin = "anonymous";
|
|
40
|
+
image.src = url;
|
|
41
|
+
const res = await this.getBlob(image, mimeType, resizeType, resizeSize, callback);
|
|
42
|
+
return res;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* FileからBASE64画像でリサイズ画像を取得
|
|
46
|
+
*
|
|
47
|
+
* @param file
|
|
48
|
+
* @param resizeType
|
|
49
|
+
* @param resizeSize
|
|
50
|
+
* @param callback
|
|
51
|
+
* @returns {Promise}
|
|
52
|
+
*/
|
|
53
|
+
async getDataUrlFromFile(file, resizeType, resizeSize, callback) {
|
|
54
|
+
const mimeType = file.type || "image/png";
|
|
55
|
+
const image = new Image();
|
|
56
|
+
image.src = this._createObjectURL(file);
|
|
57
|
+
const res = await this.getDataURL(image, mimeType, resizeType, resizeSize, callback);
|
|
58
|
+
return res;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* FileからBLOBデータでリサイズ画像を取得
|
|
62
|
+
*
|
|
63
|
+
* @param file
|
|
64
|
+
* @param resizeType
|
|
65
|
+
* @param resizeSize
|
|
66
|
+
* @param callback
|
|
67
|
+
* @returns {Promise}
|
|
68
|
+
*/
|
|
69
|
+
async getBlobFromFile(file, resizeType, resizeSize, callback) {
|
|
70
|
+
const mimeType = file.type || "image/png";
|
|
71
|
+
const image = new Image();
|
|
72
|
+
image.src = this._createObjectURL(file);
|
|
73
|
+
const res = await this.getBlob(image, mimeType, resizeType, resizeSize, callback);
|
|
74
|
+
return res;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* BASE64画像を取得
|
|
78
|
+
*
|
|
79
|
+
* @param image
|
|
80
|
+
* @param mimeType
|
|
81
|
+
* @param resizeType
|
|
82
|
+
* @param resizeSize
|
|
83
|
+
* @param callback
|
|
84
|
+
* @returns {Promise}
|
|
85
|
+
*/
|
|
86
|
+
getDataURL(image, mimeType, resizeType, resizeSize, callback) {
|
|
87
|
+
return new Promise((resolve) => {
|
|
88
|
+
const onload = () => {
|
|
89
|
+
const canvas = document.createElement("canvas");
|
|
90
|
+
if (!resizeSize) {
|
|
91
|
+
resizeSize = image.width;
|
|
92
|
+
}
|
|
93
|
+
const destinationSize = this._getDestinationSize(image, resizeType, resizeSize);
|
|
94
|
+
const drawInfo = {
|
|
95
|
+
rad: 0,
|
|
96
|
+
dx: 0,
|
|
97
|
+
dy: 0
|
|
98
|
+
};
|
|
99
|
+
canvas.width = destinationSize.width;
|
|
100
|
+
canvas.height = destinationSize.height;
|
|
101
|
+
this._drawImage(image, canvas, destinationSize, drawInfo);
|
|
102
|
+
const dataUrl = canvas.toDataURL(mimeType);
|
|
103
|
+
resolve({
|
|
104
|
+
dataUrl,
|
|
105
|
+
resize: destinationSize.resize
|
|
106
|
+
});
|
|
107
|
+
if (typeof callback === "function") {
|
|
108
|
+
callback(dataUrl, destinationSize.resize);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
if (image.width) {
|
|
112
|
+
onload();
|
|
113
|
+
} else {
|
|
114
|
+
image.onload = onload;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* リサイズした上で、Blobデータを取得
|
|
120
|
+
*
|
|
121
|
+
* @param image
|
|
122
|
+
* @param mimeType
|
|
123
|
+
* @param resizeType
|
|
124
|
+
* @param resizeSize
|
|
125
|
+
* @param callback
|
|
126
|
+
* @returns {Promise}
|
|
127
|
+
*/
|
|
128
|
+
getBlob(image, mimeType, resizeType, resizeSize, callback) {
|
|
129
|
+
return new Promise((resolve, reject) => {
|
|
130
|
+
const onload = () => {
|
|
131
|
+
const canvas = document.createElement("canvas");
|
|
132
|
+
if (!resizeSize) {
|
|
133
|
+
resizeSize = image.width;
|
|
134
|
+
}
|
|
135
|
+
const destinationSize = this._getDestinationSize(image, resizeType, resizeSize);
|
|
136
|
+
const drawInfo = {
|
|
137
|
+
rad: 0,
|
|
138
|
+
dx: 0,
|
|
139
|
+
dy: 0
|
|
140
|
+
};
|
|
141
|
+
canvas.width = destinationSize.width;
|
|
142
|
+
canvas.height = destinationSize.height;
|
|
143
|
+
this._drawImage(image, canvas, destinationSize, drawInfo);
|
|
144
|
+
canvas.toBlob(
|
|
145
|
+
(blob) => {
|
|
146
|
+
if (blob === null) {
|
|
147
|
+
reject(new Error("Failed to create Blob"));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
resolve({
|
|
151
|
+
blob,
|
|
152
|
+
resize: destinationSize.resize
|
|
153
|
+
});
|
|
154
|
+
if (typeof callback === "function") {
|
|
155
|
+
callback(blob, destinationSize.resize);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
mimeType,
|
|
159
|
+
1
|
|
160
|
+
);
|
|
161
|
+
};
|
|
162
|
+
if (image.width) {
|
|
163
|
+
onload();
|
|
164
|
+
} else {
|
|
165
|
+
image.onload = onload;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* データUrlをBlobに変換
|
|
171
|
+
*
|
|
172
|
+
* @param dataUrl
|
|
173
|
+
* @returns {*}
|
|
174
|
+
*/
|
|
175
|
+
dataUrlToBlob(dataUrl) {
|
|
176
|
+
return dataUrlToBlob(dataUrl);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* fileからデータURL作成
|
|
180
|
+
*
|
|
181
|
+
* @param file
|
|
182
|
+
* @returns {*}
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
_createObjectURL(file) {
|
|
186
|
+
const createObjectURL = window.URL && window.URL.createObjectURL;
|
|
187
|
+
return createObjectURL(file);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* リサイズ画像の書き出し
|
|
191
|
+
*
|
|
192
|
+
* @param image
|
|
193
|
+
* @param canvas
|
|
194
|
+
* @param destinationSize
|
|
195
|
+
* @param drawInfo
|
|
196
|
+
* @returns {*}
|
|
197
|
+
*/
|
|
198
|
+
_drawImage(image, canvas, destinationSize, drawInfo) {
|
|
199
|
+
const ctx = canvas.getContext("2d");
|
|
200
|
+
ctx.imageSmoothingEnabled = true;
|
|
201
|
+
ctx.imageSmoothingQuality = "high";
|
|
202
|
+
const { rad, dx, dy } = drawInfo;
|
|
203
|
+
const diff = 0.5;
|
|
204
|
+
if (image.width * diff > destinationSize.width) {
|
|
205
|
+
let oc = document.createElement("canvas");
|
|
206
|
+
const octx = oc.getContext("2d");
|
|
207
|
+
octx.imageSmoothingEnabled = true;
|
|
208
|
+
octx.imageSmoothingQuality = "high";
|
|
209
|
+
oc.width = image.width * diff;
|
|
210
|
+
oc.height = image.height * diff;
|
|
211
|
+
octx.drawImage(image, 0, 0, oc.width, oc.height);
|
|
212
|
+
let { width } = oc;
|
|
213
|
+
let { height } = oc;
|
|
214
|
+
while (width * diff > destinationSize.width) {
|
|
215
|
+
const tmp = document.createElement("canvas");
|
|
216
|
+
tmp.width = Math.max(Math.floor(width * diff), destinationSize.width);
|
|
217
|
+
tmp.height = Math.max(Math.floor(height * diff), destinationSize.height);
|
|
218
|
+
const tmpCtx = tmp.getContext("2d");
|
|
219
|
+
tmpCtx.imageSmoothingEnabled = true;
|
|
220
|
+
tmpCtx.imageSmoothingQuality = "high";
|
|
221
|
+
tmpCtx.drawImage(oc, 0, 0, width, height, 0, 0, tmp.width, tmp.height);
|
|
222
|
+
oc = tmp;
|
|
223
|
+
width = oc.width;
|
|
224
|
+
height = oc.height;
|
|
225
|
+
}
|
|
226
|
+
if (drawInfo.rad !== 0) {
|
|
227
|
+
ctx.setTransform(Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), dx, dy);
|
|
228
|
+
}
|
|
229
|
+
ctx.drawImage(oc, 0, 0, width, height, 0, 0, destinationSize.width, destinationSize.height);
|
|
230
|
+
} else {
|
|
231
|
+
if (drawInfo.rad !== 0) {
|
|
232
|
+
ctx.setTransform(Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), dx, dy);
|
|
233
|
+
}
|
|
234
|
+
ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, destinationSize.width, destinationSize.height);
|
|
235
|
+
}
|
|
236
|
+
return canvas;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* リサイズサイズの取得
|
|
240
|
+
*
|
|
241
|
+
* @param image
|
|
242
|
+
* @param resizeType
|
|
243
|
+
* @param resizeSize
|
|
244
|
+
* @returns {{width: number, height: number}}
|
|
245
|
+
*/
|
|
246
|
+
_getDestinationSize = (image, resizeType, resizeSize) => {
|
|
247
|
+
const destinationSize = {
|
|
248
|
+
width: 0,
|
|
249
|
+
height: 0,
|
|
250
|
+
resize: true
|
|
251
|
+
};
|
|
252
|
+
if (!resizeType) {
|
|
253
|
+
if (image.width > image.height) {
|
|
254
|
+
resizeType = "width";
|
|
255
|
+
} else {
|
|
256
|
+
resizeType = "height";
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (resizeType.substring(0, 1) === "h") {
|
|
260
|
+
if (image.height < resizeSize) {
|
|
261
|
+
destinationSize.width = image.width;
|
|
262
|
+
destinationSize.height = image.height;
|
|
263
|
+
destinationSize.resize = false;
|
|
264
|
+
} else {
|
|
265
|
+
destinationSize.width = image.width * (resizeSize / image.height);
|
|
266
|
+
destinationSize.height = resizeSize;
|
|
267
|
+
}
|
|
268
|
+
} else if (image.width < resizeSize) {
|
|
269
|
+
destinationSize.width = image.width;
|
|
270
|
+
destinationSize.height = image.height;
|
|
271
|
+
destinationSize.resize = false;
|
|
272
|
+
} else {
|
|
273
|
+
destinationSize.width = resizeSize;
|
|
274
|
+
destinationSize.height = image.height * (resizeSize / image.width);
|
|
275
|
+
}
|
|
276
|
+
return destinationSize;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* 画像のローテーション対応
|
|
280
|
+
*
|
|
281
|
+
* @param image
|
|
282
|
+
* @param canvas
|
|
283
|
+
* @param destinationSize
|
|
284
|
+
* @returns {Promise}
|
|
285
|
+
*/
|
|
286
|
+
_fixImageRotation(image, canvas, destinationSize) {
|
|
287
|
+
return new Promise((resolve) => {
|
|
288
|
+
this._getExifData(image).then((exif) => {
|
|
289
|
+
const drawInfo = {
|
|
290
|
+
rad: 0,
|
|
291
|
+
dx: 0,
|
|
292
|
+
dy: 0
|
|
293
|
+
};
|
|
294
|
+
switch (exif.Orientation) {
|
|
295
|
+
case 8:
|
|
296
|
+
canvas.width = destinationSize.height;
|
|
297
|
+
canvas.height = destinationSize.width;
|
|
298
|
+
drawInfo.rad = -90 * Math.PI / 180;
|
|
299
|
+
drawInfo.dy = canvas.height;
|
|
300
|
+
break;
|
|
301
|
+
case 3:
|
|
302
|
+
drawInfo.rad = 180 * Math.PI / 180;
|
|
303
|
+
drawInfo.dx = canvas.width;
|
|
304
|
+
drawInfo.dy = canvas.height;
|
|
305
|
+
break;
|
|
306
|
+
case 6:
|
|
307
|
+
canvas.width = destinationSize.height;
|
|
308
|
+
canvas.height = destinationSize.width;
|
|
309
|
+
drawInfo.rad = 90 * Math.PI / 180;
|
|
310
|
+
drawInfo.dx = canvas.width;
|
|
311
|
+
break;
|
|
312
|
+
default:
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
resolve(drawInfo);
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Exif情報の取得
|
|
321
|
+
*
|
|
322
|
+
* @param image
|
|
323
|
+
* @returns {Promise}
|
|
324
|
+
*/
|
|
325
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
326
|
+
_getExifData(image) {
|
|
327
|
+
return new Promise((resolve) => {
|
|
328
|
+
import(
|
|
329
|
+
/* webpackChunkName: "exif-js" */
|
|
330
|
+
"exif-js"
|
|
331
|
+
).then((Exif) => {
|
|
332
|
+
Exif.getData(image, () => {
|
|
333
|
+
const res = Exif.getAllTags(image);
|
|
334
|
+
resolve(res);
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
export {
|
|
342
|
+
ResizeImageUtil
|
|
343
|
+
};
|
|
344
|
+
//# sourceMappingURL=chunk-AMZYQ4DG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resize-image/util.ts"],"sourcesContent":["import { dataUrlToBlob } from '@ablogcms/utils/file';\n\ninterface DrawInfo {\n rad: number;\n dx: number;\n dy: number;\n}\n\ninterface DestinationSize {\n width: number;\n height: number;\n resize: boolean;\n}\n\ninterface DataUrlRes {\n dataUrl: string;\n resize: boolean;\n}\n\ninterface BlobRes {\n blob: Blob;\n resize: boolean;\n}\n\nexport default class ResizeImageUtil {\n /**\n * URLからBASE64画像でリサイズ画像を取得\n *\n * @param url\n * @param resizeType (null=long side, width, height)\n * @param resizeSize (length)\n * @param callback\n */\n async getDataUrlFromUrl(\n url: string,\n resizeType: string,\n resizeSize: number,\n callback: () => void\n ): Promise<DataUrlRes> {\n const Mime = await import(/* webpackChunkName: \"mime-types\" */ 'mime-types');\n const mimeType = Mime.lookup(url) || 'image/png';\n const image = new Image();\n image.crossOrigin = 'anonymous';\n image.src = url;\n\n const res = await this.getDataURL(image, mimeType, resizeType, resizeSize, callback);\n return res;\n }\n\n /**\n * URLからBLOBデータでリサイズ画像を取得\n *\n * @param url\n * @param resizeType\n * @param resizeSize\n * @param callback\n */\n async getBlobFromUrl(url: string, resizeType: string, resizeSize: number, callback: () => void): Promise<BlobRes> {\n const Mime = await import(/* webpackChunkName: \"mime-types\" */ 'mime-types');\n const mimeType = Mime.lookup(url) || 'image/png';\n const image = new Image();\n image.crossOrigin = 'anonymous';\n image.src = url;\n\n const res = await this.getBlob(image, mimeType, resizeType, resizeSize, callback);\n return res;\n }\n\n /**\n * FileからBASE64画像でリサイズ画像を取得\n *\n * @param file\n * @param resizeType\n * @param resizeSize\n * @param callback\n * @returns {Promise}\n */\n async getDataUrlFromFile(\n file: File,\n resizeType: string,\n resizeSize: number,\n callback: () => void\n ): Promise<DataUrlRes> {\n const mimeType = file.type || 'image/png';\n const image = new Image();\n image.src = this._createObjectURL(file);\n\n const res = await this.getDataURL(image, mimeType, resizeType, resizeSize, callback);\n return res;\n }\n\n /**\n * FileからBLOBデータでリサイズ画像を取得\n *\n * @param file\n * @param resizeType\n * @param resizeSize\n * @param callback\n * @returns {Promise}\n */\n async getBlobFromFile(file: File, resizeType: string, resizeSize: number, callback?: () => void): Promise<BlobRes> {\n const mimeType = file.type || 'image/png';\n const image = new Image();\n image.src = this._createObjectURL(file);\n const res = await this.getBlob(image, mimeType, resizeType, resizeSize, callback);\n return res;\n }\n\n /**\n * BASE64画像を取得\n *\n * @param image\n * @param mimeType\n * @param resizeType\n * @param resizeSize\n * @param callback\n * @returns {Promise}\n */\n getDataURL(\n image: HTMLImageElement,\n mimeType: string,\n resizeType: string,\n resizeSize: number,\n callback: (dataUrl: string, resize: boolean) => void\n ): Promise<DataUrlRes> {\n return new Promise((resolve) => {\n const onload = () => {\n const canvas = document.createElement('canvas');\n if (!resizeSize) {\n resizeSize = image.width;\n }\n const destinationSize = this._getDestinationSize(image, resizeType, resizeSize);\n const drawInfo = {\n rad: 0,\n dx: 0,\n dy: 0,\n };\n\n canvas.width = destinationSize.width;\n canvas.height = destinationSize.height;\n\n this._drawImage(image, canvas, destinationSize, drawInfo);\n const dataUrl = canvas.toDataURL(mimeType);\n resolve({\n dataUrl,\n resize: destinationSize.resize,\n });\n if (typeof callback === 'function') {\n callback(dataUrl, destinationSize.resize);\n }\n };\n if (image.width) {\n onload();\n } else {\n image.onload = onload;\n }\n });\n }\n\n /**\n * リサイズした上で、Blobデータを取得\n *\n * @param image\n * @param mimeType\n * @param resizeType\n * @param resizeSize\n * @param callback\n * @returns {Promise}\n */\n getBlob(\n image: HTMLImageElement,\n mimeType: string,\n resizeType: string,\n resizeSize: number,\n callback?: (blob: Blob | null, resize: boolean) => void\n ): Promise<BlobRes> {\n return new Promise((resolve, reject) => {\n const onload = () => {\n const canvas = document.createElement('canvas');\n if (!resizeSize) {\n resizeSize = image.width;\n }\n const destinationSize = this._getDestinationSize(image, resizeType, resizeSize);\n const drawInfo = {\n rad: 0,\n dx: 0,\n dy: 0,\n };\n canvas.width = destinationSize.width;\n canvas.height = destinationSize.height;\n\n this._drawImage(image, canvas, destinationSize, drawInfo);\n canvas.toBlob(\n (blob) => {\n if (blob === null) {\n reject(new Error('Failed to create Blob'));\n return;\n }\n resolve({\n blob,\n resize: destinationSize.resize,\n });\n if (typeof callback === 'function') {\n callback(blob, destinationSize.resize);\n }\n },\n mimeType,\n 1\n );\n };\n if (image.width) {\n onload();\n } else {\n image.onload = onload;\n }\n });\n }\n\n /**\n * データUrlをBlobに変換\n *\n * @param dataUrl\n * @returns {*}\n */\n dataUrlToBlob(dataUrl: string): Blob {\n return dataUrlToBlob(dataUrl);\n }\n\n /**\n * fileからデータURL作成\n *\n * @param file\n * @returns {*}\n * @private\n */\n _createObjectURL(file: File): string {\n const createObjectURL = window.URL && window.URL.createObjectURL;\n return createObjectURL(file);\n }\n\n /**\n * リサイズ画像の書き出し\n *\n * @param image\n * @param canvas\n * @param destinationSize\n * @param drawInfo\n * @returns {*}\n */\n _drawImage(\n image: HTMLImageElement,\n canvas: HTMLCanvasElement,\n destinationSize: { width: number; height: number },\n drawInfo: DrawInfo\n ): HTMLCanvasElement {\n const ctx = canvas.getContext('2d')!;\n // 高品質補間を有効化\n ctx.imageSmoothingEnabled = true;\n ctx.imageSmoothingQuality = 'high';\n const { rad, dx, dy } = drawInfo;\n const diff = 0.5;\n\n if (image.width * diff > destinationSize.width) {\n // スムーズ処理を入れて、リサイズ\n let oc = document.createElement('canvas');\n const octx = oc.getContext('2d')!;\n // 高品質補間を有効化\n octx.imageSmoothingEnabled = true;\n octx.imageSmoothingQuality = 'high';\n\n // step 1 we reduce the image to half by using an off-screen canvas\n oc.width = image.width * diff;\n oc.height = image.height * diff;\n octx.drawImage(image, 0, 0, oc.width, oc.height);\n\n let { width } = oc;\n let { height } = oc;\n\n // step 2 reuses the off-screen canvas and draws the image reduced to half again\n while (width * diff > destinationSize.width) {\n const tmp = document.createElement('canvas');\n tmp.width = Math.max(Math.floor(width * diff), destinationSize.width);\n tmp.height = Math.max(Math.floor(height * diff), destinationSize.height);\n\n const tmpCtx = tmp.getContext('2d')!;\n tmpCtx.imageSmoothingEnabled = true;\n tmpCtx.imageSmoothingQuality = 'high';\n tmpCtx.drawImage(oc, 0, 0, width, height, 0, 0, tmp.width, tmp.height);\n\n oc = tmp;\n width = oc.width;\n height = oc.height;\n }\n // step 3 we draw once more to main canvas, again reduced to half but to the final size\n if (drawInfo.rad !== 0) {\n ctx.setTransform(Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), dx, dy);\n }\n ctx.drawImage(oc, 0, 0, width, height, 0, 0, destinationSize.width, destinationSize.height);\n } else {\n // 一気にリサイズ\n if (drawInfo.rad !== 0) {\n ctx.setTransform(Math.cos(rad), Math.sin(rad), -Math.sin(rad), Math.cos(rad), dx, dy);\n }\n ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, destinationSize.width, destinationSize.height);\n }\n return canvas;\n }\n\n /**\n * リサイズサイズの取得\n *\n * @param image\n * @param resizeType\n * @param resizeSize\n * @returns {{width: number, height: number}}\n */\n _getDestinationSize = (image: HTMLImageElement, resizeType: string, resizeSize: number): DestinationSize => {\n const destinationSize: DestinationSize = {\n width: 0,\n height: 0,\n resize: true,\n };\n\n // Long side\n if (!resizeType) {\n if (image.width > image.height) {\n resizeType = 'width';\n } else {\n resizeType = 'height';\n }\n }\n\n if (resizeType.substring(0, 1) === 'h') {\n // Portrait\n if (image.height < resizeSize) {\n destinationSize.width = image.width;\n destinationSize.height = image.height;\n destinationSize.resize = false;\n } else {\n destinationSize.width = image.width * (resizeSize / image.height);\n destinationSize.height = resizeSize;\n }\n\n // Landscape\n } else if (image.width < resizeSize) {\n destinationSize.width = image.width;\n destinationSize.height = image.height;\n destinationSize.resize = false;\n } else {\n destinationSize.width = resizeSize;\n destinationSize.height = image.height * (resizeSize / image.width);\n }\n\n return destinationSize;\n };\n\n /**\n * 画像のローテーション対応\n *\n * @param image\n * @param canvas\n * @param destinationSize\n * @returns {Promise}\n */\n _fixImageRotation(\n image: HTMLImageElement,\n canvas: HTMLCanvasElement,\n destinationSize: DestinationSize\n ): Promise<DrawInfo> {\n return new Promise((resolve) => {\n this._getExifData(image).then((exif) => {\n const drawInfo = {\n rad: 0,\n dx: 0,\n dy: 0,\n };\n\n switch (exif.Orientation) {\n case 8:\n canvas.width = destinationSize.height;\n canvas.height = destinationSize.width;\n drawInfo.rad = (-90 * Math.PI) / 180;\n drawInfo.dy = canvas.height;\n break;\n case 3:\n drawInfo.rad = (180 * Math.PI) / 180;\n drawInfo.dx = canvas.width;\n drawInfo.dy = canvas.height;\n break;\n case 6:\n canvas.width = destinationSize.height;\n canvas.height = destinationSize.width;\n drawInfo.rad = (90 * Math.PI) / 180;\n drawInfo.dx = canvas.width;\n break;\n default:\n break;\n }\n resolve(drawInfo);\n });\n });\n }\n\n /**\n * Exif情報の取得\n *\n * @param image\n * @returns {Promise}\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _getExifData(image: HTMLImageElement): Promise<any> {\n return new Promise((resolve) => {\n import(/* webpackChunkName: \"exif-js\" */ 'exif-js').then((Exif) => {\n // @ts-expect-error type definition is not correct\n Exif.getData(image, () => {\n const res = Exif.getAllTags(image);\n resolve(res);\n });\n });\n });\n }\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAwB9B,IAAqB,kBAArB,MAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnC,MAAM,kBACJ,KACA,YACA,YACA,UACqB;AACrB,UAAM,OAAO,MAAM;AAAA;AAAA,MAA4C;AAAA,IAAY;AAC3E,UAAM,WAAW,KAAK,OAAO,GAAG,KAAK;AACrC,UAAM,QAAQ,IAAI,MAAM;AACxB,UAAM,cAAc;AACpB,UAAM,MAAM;AAEZ,UAAM,MAAM,MAAM,KAAK,WAAW,OAAO,UAAU,YAAY,YAAY,QAAQ;AACnF,WAAO;AAAA,EACT;AAAA;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