From 3d2b4ba20d42997aa3a2ae6a04cc650253e761d6 Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 20 Apr 2022 20:39:31 +0800 Subject: [PATCH] chore: build h5 --- packages/uni-h5/dist/uni-h5.cjs.js | 154 +++++++++++++++++------------ packages/uni-h5/dist/uni-h5.es.js | 154 +++++++++++++++++------------ 2 files changed, 186 insertions(+), 122 deletions(-) diff --git a/packages/uni-h5/dist/uni-h5.cjs.js b/packages/uni-h5/dist/uni-h5.cjs.js index f082ed86f..86ed0ddb2 100644 --- a/packages/uni-h5/dist/uni-h5.cjs.js +++ b/packages/uni-h5/dist/uni-h5.cjs.js @@ -8190,6 +8190,40 @@ var MapMarker = /* @__PURE__ */ defineSystemComponent({ }; } }); +function hexToRgba(hex) { + if (!hex) { + return { + r: 0, + g: 0, + b: 0, + a: 0 + }; + } + let tmpHex = hex.slice(1); + const tmpHexLen = tmpHex.length; + if (![3, 4, 6, 8].includes(tmpHexLen)) { + return { + r: 0, + g: 0, + b: 0, + a: 0 + }; + } + if (tmpHexLen === 3 || tmpHexLen === 4) { + tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1"); + } + let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g); + const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16); + if (!sa) { + return { r, g: g2, b, a: 1 }; + } + return { + r, + g: g2, + b, + a: (`0x100${sa}` - 65536) / 255 + }; +} const props$6 = { points: { type: Array, @@ -8260,25 +8294,48 @@ var MapPolyline = /* @__PURE__ */ defineSystemComponent({ path.push(new maps.LatLng(point.latitude, point.longitude)); }); const strokeWeight = Number(option.width) || 1; - polyline = new maps.Polyline({ + const { + r: sr, + g: sg, + b: sb, + a: sa + } = hexToRgba(option.color); + const { + r: br, + g: bg, + b: bb, + a: ba + } = hexToRgba(option.borderColor); + const polylineOptions = { map, clickable: false, path, strokeWeight, strokeColor: option.color || void 0, strokeDashStyle: option.dottedLine ? "dash" : "solid" - }); + }; const borderWidth = Number(option.borderWidth) || 0; + const polylineBorderOptions = { + map, + clickable: false, + path, + strokeWeight: strokeWeight + borderWidth * 2, + strokeColor: option.borderColor || void 0, + strokeDashStyle: option.dottedLine ? "dash" : "solid" + }; + if ("Color" in maps) { + polylineOptions.strokeColor = new maps.Color(sr, sg, sb, sa); + polylineBorderOptions.strokeColor = new maps.Color(br, bg, bb, ba); + } else { + polylineOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`; + polylineOptions.strokeOpacity = sa; + polylineBorderOptions.strokeColor = `rgb(${br}, ${bg}, ${bb})`; + polylineBorderOptions.strokeOpacity = ba; + } if (borderWidth) { - polylineBorder = new maps.Polyline({ - map, - clickable: false, - path, - strokeWeight: strokeWeight + borderWidth * 2, - strokeColor: option.borderColor || void 0, - strokeDashStyle: option.dottedLine ? "dash" : "solid" - }); + polylineBorder = new maps.Polyline(polylineBorderOptions); } + polyline = new maps.Polyline(polylineOptions); } addPolyline(props2); vue.watch(props2, updatePolyline); @@ -8299,11 +8356,11 @@ const props$5 = { }, color: { type: String, - default: "" + default: "#000000" }, fillColor: { type: String, - default: "" + default: "#00000000" }, radius: { type: [Number, String], @@ -8336,27 +8393,36 @@ var MapCircle = /* @__PURE__ */ defineSystemComponent({ } function addCircle(option) { const center = new maps.LatLng(option.latitude, option.longitude); - function getColor(color) { - const c = color && color.match(/#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?/); - if ("Color" in maps) { - if (c && c.length) { - return maps.Color.fromHex(c[0], Number("0x" + c[1] || 255) / 255).toRGBA(); - } else { - return void 0; - } - } - return color; - } - circle = new maps.Circle({ + const circleOptions = { map, center, clickable: false, radius: option.radius, strokeWeight: Number(option.strokeWidth) || 1, - fillColor: getColor(option.fillColor) || getColor("#00000001"), - strokeColor: getColor(option.color) || "#000000", strokeDashStyle: "solid" - }); + }; + const { + r: fr, + g: fg, + b: fb, + a: fa + } = hexToRgba(option.fillColor); + const { + r: sr, + g: sg, + b: sb, + a: sa + } = hexToRgba(option.color); + if ("Color" in maps) { + circleOptions.fillColor = new maps.Color(fr, fg, fb, fa); + circleOptions.strokeColor = new maps.Color(sr, sg, sb, sa); + } else { + circleOptions.fillColor = `rgb(${fr}, ${fg}, ${fb})`; + circleOptions.fillOpacity = fa; + circleOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`; + circleOptions.strokeOpacity = sa; + } + circle = new maps.Circle(circleOptions); } addCircle(props2); vue.watch(props2, updateCircle); @@ -8488,40 +8554,6 @@ var props$3 = { default: 0 } }; -function hexToRgba(hex) { - if (!hex) { - return { - r: 0, - g: 0, - b: 0, - a: 0 - }; - } - let tmpHex = hex.slice(1); - const tmpHexLen = tmpHex.length; - if (![3, 4, 6, 8].includes(tmpHexLen)) { - return { - r: 0, - g: 0, - b: 0, - a: 0 - }; - } - if (tmpHexLen === 3 || tmpHexLen === 4) { - tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1"); - } - let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g); - const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16); - if (!sa) { - return { r, g: g2, b, a: 1 }; - } - return { - r, - g: g2, - b, - a: (`0x100${sa}` - 65536) / 255 - }; -} var MapPolygon = /* @__PURE__ */ defineSystemComponent({ name: "MapPolygon", props: props$3, diff --git a/packages/uni-h5/dist/uni-h5.es.js b/packages/uni-h5/dist/uni-h5.es.js index cb26f9e7b..7a8595cee 100644 --- a/packages/uni-h5/dist/uni-h5.es.js +++ b/packages/uni-h5/dist/uni-h5.es.js @@ -15814,6 +15814,40 @@ var MapMarker = /* @__PURE__ */ defineSystemComponent({ }; } }); +function hexToRgba(hex) { + if (!hex) { + return { + r: 0, + g: 0, + b: 0, + a: 0 + }; + } + let tmpHex = hex.slice(1); + const tmpHexLen = tmpHex.length; + if (![3, 4, 6, 8].includes(tmpHexLen)) { + return { + r: 0, + g: 0, + b: 0, + a: 0 + }; + } + if (tmpHexLen === 3 || tmpHexLen === 4) { + tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1"); + } + let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g); + const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16); + if (!sa) { + return { r, g: g2, b, a: 1 }; + } + return { + r, + g: g2, + b, + a: (`0x100${sa}` - 65536) / 255 + }; +} const props$d = { points: { type: Array, @@ -15884,25 +15918,48 @@ var MapPolyline = /* @__PURE__ */ defineSystemComponent({ path.push(new maps2.LatLng(point.latitude, point.longitude)); }); const strokeWeight = Number(option.width) || 1; - polyline = new maps2.Polyline({ + const { + r: sr, + g: sg, + b: sb, + a: sa + } = hexToRgba(option.color); + const { + r: br, + g: bg, + b: bb, + a: ba + } = hexToRgba(option.borderColor); + const polylineOptions = { map, clickable: false, path, strokeWeight, strokeColor: option.color || void 0, strokeDashStyle: option.dottedLine ? "dash" : "solid" - }); + }; const borderWidth = Number(option.borderWidth) || 0; + const polylineBorderOptions = { + map, + clickable: false, + path, + strokeWeight: strokeWeight + borderWidth * 2, + strokeColor: option.borderColor || void 0, + strokeDashStyle: option.dottedLine ? "dash" : "solid" + }; + if ("Color" in maps2) { + polylineOptions.strokeColor = new maps2.Color(sr, sg, sb, sa); + polylineBorderOptions.strokeColor = new maps2.Color(br, bg, bb, ba); + } else { + polylineOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`; + polylineOptions.strokeOpacity = sa; + polylineBorderOptions.strokeColor = `rgb(${br}, ${bg}, ${bb})`; + polylineBorderOptions.strokeOpacity = ba; + } if (borderWidth) { - polylineBorder = new maps2.Polyline({ - map, - clickable: false, - path, - strokeWeight: strokeWeight + borderWidth * 2, - strokeColor: option.borderColor || void 0, - strokeDashStyle: option.dottedLine ? "dash" : "solid" - }); + polylineBorder = new maps2.Polyline(polylineBorderOptions); } + polyline = new maps2.Polyline(polylineOptions); } addPolyline(props2); watch(props2, updatePolyline); @@ -15924,11 +15981,11 @@ const props$c = { }, color: { type: String, - default: "" + default: "#000000" }, fillColor: { type: String, - default: "" + default: "#00000000" }, radius: { type: [Number, String], @@ -15961,27 +16018,36 @@ var MapCircle = /* @__PURE__ */ defineSystemComponent({ } function addCircle(option) { const center = new maps2.LatLng(option.latitude, option.longitude); - function getColor(color) { - const c = color && color.match(/#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?/); - if ("Color" in maps2) { - if (c && c.length) { - return maps2.Color.fromHex(c[0], Number("0x" + c[1] || 255) / 255).toRGBA(); - } else { - return void 0; - } - } - return color; - } - circle = new maps2.Circle({ + const circleOptions = { map, center, clickable: false, radius: option.radius, strokeWeight: Number(option.strokeWidth) || 1, - fillColor: getColor(option.fillColor) || getColor("#00000001"), - strokeColor: getColor(option.color) || "#000000", strokeDashStyle: "solid" - }); + }; + const { + r: fr, + g: fg, + b: fb, + a: fa + } = hexToRgba(option.fillColor); + const { + r: sr, + g: sg, + b: sb, + a: sa + } = hexToRgba(option.color); + if ("Color" in maps2) { + circleOptions.fillColor = new maps2.Color(fr, fg, fb, fa); + circleOptions.strokeColor = new maps2.Color(sr, sg, sb, sa); + } else { + circleOptions.fillColor = `rgb(${fr}, ${fg}, ${fb})`; + circleOptions.fillOpacity = fa; + circleOptions.strokeColor = `rgb(${sr}, ${sg}, ${sb})`; + circleOptions.strokeOpacity = sa; + } + circle = new maps2.Circle(circleOptions); } addCircle(props2); watch(props2, updateCircle); @@ -20214,40 +20280,6 @@ var props$3 = { default: 0 } }; -function hexToRgba(hex) { - if (!hex) { - return { - r: 0, - g: 0, - b: 0, - a: 0 - }; - } - let tmpHex = hex.slice(1); - const tmpHexLen = tmpHex.length; - if (![3, 4, 6, 8].includes(tmpHexLen)) { - return { - r: 0, - g: 0, - b: 0, - a: 0 - }; - } - if (tmpHexLen === 3 || tmpHexLen === 4) { - tmpHex = tmpHex.replace(/(\w{1})/g, "$1$1"); - } - let [sr, sg, sb, sa] = tmpHex.match(/(\w{2})/g); - const r = parseInt(sr, 16), g2 = parseInt(sg, 16), b = parseInt(sb, 16); - if (!sa) { - return { r, g: g2, b, a: 1 }; - } - return { - r, - g: g2, - b, - a: (`0x100${sa}` - 65536) / 255 - }; -} var MapPolygon = /* @__PURE__ */ defineSystemComponent({ name: "MapPolygon", props: props$3, -- GitLab