@konoui/mjimage 0.0.21 → 0.0.22

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.
@@ -4,13 +4,15 @@ export interface ImageHelperConfig {
4
4
  scale?: number;
5
5
  imageHostPath?: string;
6
6
  imageHostUrl?: string;
7
+ imageExt?: "svg" | "webp";
7
8
  svgSprite?: boolean;
8
9
  }
9
10
  declare class BaseHelper {
10
11
  readonly tileWidth: number;
11
12
  readonly tileHeight: number;
12
- readonly image_host_path: string;
13
- readonly image_host_url: string;
13
+ readonly imageHostPath: string;
14
+ readonly imageHostUrl: string;
15
+ readonly imageExt: string;
14
16
  readonly scale: number;
15
17
  readonly svgSprite: boolean;
16
18
  constructor(props?: ImageHelperConfig);
@@ -33,13 +33,14 @@ var core_2 = require("../core");
33
33
  var BaseHelper = (function () {
34
34
  function BaseHelper(props) {
35
35
  if (props === void 0) { props = {}; }
36
- var _a, _b, _c, _d;
36
+ var _a, _b, _c, _d, _e;
37
37
  this.scale = (_a = props.scale) !== null && _a !== void 0 ? _a : 1;
38
- this.image_host_path = (_b = props.imageHostPath) !== null && _b !== void 0 ? _b : "";
39
- this.image_host_url = (_c = props.imageHostUrl) !== null && _c !== void 0 ? _c : "";
38
+ this.imageHostPath = (_b = props.imageHostPath) !== null && _b !== void 0 ? _b : "";
39
+ this.imageHostUrl = (_c = props.imageHostUrl) !== null && _c !== void 0 ? _c : "";
40
+ this.imageExt = (_d = props.imageExt) !== null && _d !== void 0 ? _d : "svg";
40
41
  this.tileWidth = core_2.TILE_CONTEXT.WIDTH * this.scale;
41
42
  this.tileHeight = core_2.TILE_CONTEXT.HEIGHT * this.scale;
42
- this.svgSprite = (_d = props.svgSprite) !== null && _d !== void 0 ? _d : false;
43
+ this.svgSprite = (_e = props.svgSprite) !== null && _e !== void 0 ? _e : false;
43
44
  }
44
45
  BaseHelper.prototype.getDiffTileHeightWidth = function (t) {
45
46
  var size = t.imageSize(this.scale);
@@ -107,11 +108,11 @@ var BaseHelper = (function () {
107
108
  return "".concat(tile.t).concat(n);
108
109
  };
109
110
  BaseHelper.prototype.buildURL = function (tile) {
110
- var filename = "".concat(BaseHelper.buildID(tile), ".svg");
111
- if (this.image_host_url != "") {
112
- return "".concat(this.image_host_url).concat(filename);
111
+ var filename = "".concat(BaseHelper.buildID(tile), ".").concat(this.imageExt);
112
+ if (this.imageHostUrl != "") {
113
+ return "".concat(this.imageHostUrl).concat(filename);
113
114
  }
114
- return "".concat(this.image_host_path).concat(filename);
115
+ return "".concat(this.imageHostPath).concat(filename);
115
116
  };
116
117
  return BaseHelper;
117
118
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konoui/mjimage",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Generates Mahjong tiles in SVG format.",
5
5
  "author": "konoui",
6
6
  "license": "MIT",
@@ -53,10 +53,16 @@
53
53
  "module": {}
54
54
  },
55
55
  "alias": {},
56
- "staticFiles": {
57
- "staticPath": "static/svg",
58
- "staticOutPath": "svg"
59
- },
56
+ "staticFiles": [
57
+ {
58
+ "staticPath": "static/svg",
59
+ "staticOutPath": "svg"
60
+ },
61
+ {
62
+ "staticPath": "static/webp",
63
+ "staticOutPath": "webp"
64
+ }
65
+ ],
60
66
  "devDependencies": {
61
67
  "@parcel/reporter-bundle-analyzer": "^2.12.0",
62
68
  "@parcel/transformer-inline-string": "^2.9.3",