@fleet-frontend/mower-maps 0.2.5-beta.30 → 0.2.5-beta.31

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.
@@ -37,6 +37,8 @@ interface CommonContextType {
37
37
  /** 宿主服务端签名回调(优先于 googleMapStaticUrlSigningSecret) */
38
38
  signGoogleStaticMapUrl?: (unsignedUrl: string) => Promise<string> | string;
39
39
  onH5FirstSelectObstaclePoint?: () => void;
40
+ /** MowerMap 实例创建时内部生成的通道 clipPath id,同一实例内共用 */
41
+ channelClipPathId?: string;
40
42
  }
41
43
  export declare const CommonContext: import("react").Context<{
42
44
  sn: string;
@@ -68,6 +70,7 @@ export declare const CommonContext: import("react").Context<{
68
70
  locale: {};
69
71
  signGoogleStaticMapUrl: any;
70
72
  onH5FirstSelectObstaclePoint: any;
73
+ channelClipPathId: string;
71
74
  }>;
72
75
  export declare const CommonContextProvider: import("react").Provider<{
73
76
  sn: string;
@@ -99,6 +102,7 @@ export declare const CommonContextProvider: import("react").Provider<{
99
102
  locale: {};
100
103
  signGoogleStaticMapUrl: any;
101
104
  onH5FirstSelectObstaclePoint: any;
105
+ channelClipPathId: string;
102
106
  }>;
103
107
  export declare const useCommonContext: () => CommonContextType;
104
108
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/context/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAA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CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAC;IACjC,qDAAqD;IACrD,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC3E,4BAA4B,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1C,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BxB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,yBAAqD,CAAC"}
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { memo, useMemo, useEffect, useState, useRef, useCallback, createContext, useContext, useLayoutEffect, forwardRef, useImperativeHandle } from 'react';
3
+ import React__default, { memo, useMemo, useEffect, useState, useRef, useCallback, createContext, useContext, useLayoutEffect, forwardRef, useImperativeHandle, useId } from 'react';
4
4
  import ReactDOM, { createPortal } from 'react-dom';
5
5
 
6
6
  function globals (defs) {
@@ -22709,12 +22709,13 @@ const CommonContext = createContext({
22709
22709
  locale: {},
22710
22710
  signGoogleStaticMapUrl: undefined,
22711
22711
  onH5FirstSelectObstaclePoint: undefined,
22712
+ channelClipPathId: '',
22712
22713
  });
22713
22714
  const CommonContextProvider = CommonContext.Provider;
22714
22715
  const useCommonContext = () => useContext(CommonContext);
22715
22716
 
22716
22717
  const ChannelClipPath = React__default.memo(() => {
22717
- const { svgViewBox, sn } = useCommonContext();
22718
+ const { svgViewBox, channelClipPathId } = useCommonContext();
22718
22719
  const { svgElementDatas } = useSvgEditContext();
22719
22720
  const boundaryData = svgElementDatas?.[DataType.BOUNDARY] || [];
22720
22721
  const [minX, minY, maxX, maxY] = useMemo(() => {
@@ -22893,7 +22894,7 @@ const ChannelClipPath = React__default.memo(() => {
22893
22894
  });
22894
22895
  return baseD;
22895
22896
  }, [boundaryData, minX, minY, maxX, maxY]);
22896
- return (jsx("defs", { children: jsx("clipPath", { id: `channel-clip-path-${sn}`, fillRule: "evenodd", children: jsx("path", { d: d }) }) }));
22897
+ return (jsx("defs", { children: jsx("clipPath", { id: channelClipPathId, fillRule: "evenodd", children: jsx("path", { d: d }) }) }));
22897
22898
  });
22898
22899
 
22899
22900
  /**
@@ -25382,7 +25383,8 @@ const BoundaryElement = ({ data, isHover }) => {
25382
25383
  };
25383
25384
 
25384
25385
  const ChannelElement = ({ data }) => {
25385
- const { sn } = useCommonContext();
25386
+ const { channelClipPathId } = useCommonContext();
25387
+ const clipPathUrl = `url(#${channelClipPathId})`;
25386
25388
  const points = data.points;
25387
25389
  const style = data.style;
25388
25390
  let pathData = `M ${points[0][0]} ${points[0][1]}`;
@@ -25392,7 +25394,7 @@ const ChannelElement = ({ data }) => {
25392
25394
  const topLineWidth = dp2px(style.lineWidth).toString();
25393
25395
  const bottomLineWidth = dp2px(style.bottomLineWidth).toString();
25394
25396
  const dashLength = dp2px(style.lineWidth);
25395
- return (jsxs("g", { id: data.id.toString(), children: [jsx("path", { d: pathData, fill: "none", stroke: "#8498A9", strokeWidth: bottomLineWidth, strokeLinejoin: "round", opacity: style.opacity || 1, style: { clipPath: `url(#channel-clip-path-${sn})` } }), jsx("path", { d: pathData, fill: "none", stroke: "#FFFFFF", strokeWidth: topLineWidth, strokeLinejoin: "round", strokeDasharray: `${dashLength * 2} ${dashLength}`, opacity: style.opacity || 1, style: { clipPath: `url(#channel-clip-path-${sn})` } })] }));
25397
+ return (jsxs("g", { id: data.id.toString(), children: [jsx("path", { d: pathData, fill: "none", stroke: "#8498A9", strokeWidth: bottomLineWidth, strokeLinejoin: "round", opacity: style.opacity || 1, style: { clipPath: clipPathUrl } }), jsx("path", { d: pathData, fill: "none", stroke: "#FFFFFF", strokeWidth: topLineWidth, strokeLinejoin: "round", strokeDasharray: `${dashLength * 2} ${dashLength}`, opacity: style.opacity || 1, style: { clipPath: clipPathUrl } })] }));
25396
25398
  };
25397
25399
 
25398
25400
  /**
@@ -29748,6 +29750,22 @@ const SvgEditMap = forwardRef(({ mapConfig, onEditInfoMapChange, editMap }, ref)
29748
29750
  });
29749
29751
  SvgEditMap.displayName = 'SvgEditMap';
29750
29752
 
29753
+ /** 清理为合法的 SVG/HTML id 片段 */
29754
+ function sanitizeSvgIdPart(value) {
29755
+ return value.replace(/[^a-zA-Z0-9_.-]/g, '_');
29756
+ }
29757
+ /**
29758
+ * 通道 clipPath 的 SVG id
29759
+ * 组合 sn、useId、时间戳、随机数,避免同页多地图实例 id 冲突
29760
+ */
29761
+ function createChannelClipPathId(params) {
29762
+ const snPart = sanitizeSvgIdPart(params.sn || 'map');
29763
+ const reactPart = sanitizeSvgIdPart(params.reactId.replace(/:/g, ''));
29764
+ const timestamp = Date.now();
29765
+ const randomPart = Math.random().toString(36).slice(2, 10);
29766
+ return `channel-clip-path-${snPart}-${reactPart}-${timestamp}-${randomPart}`;
29767
+ }
29768
+
29751
29769
  var _path;
29752
29770
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
29753
29771
  var SvgMobileAddPoint = function SvgMobileAddPoint(props) {
@@ -29824,6 +29842,8 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29824
29842
  ...INIT_EDIT_MAP_INFO,
29825
29843
  });
29826
29844
  const [mowingPartitions, setMowingPartitions] = useState([]);
29845
+ const reactInstanceId = useId();
29846
+ const channelClipPathId = useMemo(() => createChannelClipPathId({ sn, reactId: reactInstanceId }), [sn, reactInstanceId]);
29827
29847
  const minDistance = useMemo(() => {
29828
29848
  return getMinSvgDistanceByModel(modelType);
29829
29849
  }, [modelType]);
@@ -30058,6 +30078,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
30058
30078
  locale,
30059
30079
  signGoogleStaticMapUrl,
30060
30080
  onH5FirstSelectObstaclePoint,
30081
+ channelClipPathId,
30061
30082
  };
30062
30083
  }, [
30063
30084
  sn,
@@ -30084,6 +30105,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
30084
30105
  locale,
30085
30106
  signGoogleStaticMapUrl,
30086
30107
  onH5FirstSelectObstaclePoint,
30108
+ channelClipPathId,
30087
30109
  ]);
30088
30110
  /**
30089
30111
  * 这里做了一个配置,以防以后如果有多种不同的类型的情况,需要展示不同的元素
@@ -30428,7 +30450,9 @@ MowerMapRenderer.displayName = 'MowerMapRenderer';
30428
30450
 
30429
30451
  // 默认配置
30430
30452
  const defaultMapConfig = DEFAULT_STYLES;
30431
- const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn }) => {
30453
+ const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn, }) => {
30454
+ const reactInstanceId = useId();
30455
+ const channelClipPathId = useMemo(() => createChannelClipPathId({ sn, reactId: reactInstanceId }), [sn, reactInstanceId]);
30432
30456
  // 合并配置
30433
30457
  const mergedMapConfig = useMemo(() => {
30434
30458
  return merge$1(defaultMapConfig, mapConfig);
@@ -30488,8 +30512,9 @@ const BoundarySvgRender = React__default.memo(({ mapJson, unStructMapData, id, m
30488
30512
  return {
30489
30513
  sn,
30490
30514
  svgViewBox: boundaryViewBox,
30515
+ channelClipPathId,
30491
30516
  };
30492
- }, [sn, boundaryViewBox]);
30517
+ }, [sn, boundaryViewBox, channelClipPathId]);
30493
30518
  const style = useMemo(() => {
30494
30519
  if (!maxHeight) {
30495
30520
  if (boundaryViewBox?.width > boundaryViewBox?.height) {
package/dist/index.js CHANGED
@@ -22729,12 +22729,13 @@ const CommonContext = React.createContext({
22729
22729
  locale: {},
22730
22730
  signGoogleStaticMapUrl: undefined,
22731
22731
  onH5FirstSelectObstaclePoint: undefined,
22732
+ channelClipPathId: '',
22732
22733
  });
22733
22734
  const CommonContextProvider = CommonContext.Provider;
22734
22735
  const useCommonContext = () => React.useContext(CommonContext);
22735
22736
 
22736
22737
  const ChannelClipPath = React.memo(() => {
22737
- const { svgViewBox, sn } = useCommonContext();
22738
+ const { svgViewBox, channelClipPathId } = useCommonContext();
22738
22739
  const { svgElementDatas } = useSvgEditContext();
22739
22740
  const boundaryData = svgElementDatas?.[exports.DataType.BOUNDARY] || [];
22740
22741
  const [minX, minY, maxX, maxY] = React.useMemo(() => {
@@ -22913,7 +22914,7 @@ const ChannelClipPath = React.memo(() => {
22913
22914
  });
22914
22915
  return baseD;
22915
22916
  }, [boundaryData, minX, minY, maxX, maxY]);
22916
- return (jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: `channel-clip-path-${sn}`, fillRule: "evenodd", children: jsxRuntime.jsx("path", { d: d }) }) }));
22917
+ return (jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: channelClipPathId, fillRule: "evenodd", children: jsxRuntime.jsx("path", { d: d }) }) }));
22917
22918
  });
22918
22919
 
22919
22920
  /**
@@ -25402,7 +25403,8 @@ const BoundaryElement = ({ data, isHover }) => {
25402
25403
  };
25403
25404
 
25404
25405
  const ChannelElement = ({ data }) => {
25405
- const { sn } = useCommonContext();
25406
+ const { channelClipPathId } = useCommonContext();
25407
+ const clipPathUrl = `url(#${channelClipPathId})`;
25406
25408
  const points = data.points;
25407
25409
  const style = data.style;
25408
25410
  let pathData = `M ${points[0][0]} ${points[0][1]}`;
@@ -25412,7 +25414,7 @@ const ChannelElement = ({ data }) => {
25412
25414
  const topLineWidth = dp2px(style.lineWidth).toString();
25413
25415
  const bottomLineWidth = dp2px(style.bottomLineWidth).toString();
25414
25416
  const dashLength = dp2px(style.lineWidth);
25415
- return (jsxRuntime.jsxs("g", { id: data.id.toString(), children: [jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: "#8498A9", strokeWidth: bottomLineWidth, strokeLinejoin: "round", opacity: style.opacity || 1, style: { clipPath: `url(#channel-clip-path-${sn})` } }), jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: "#FFFFFF", strokeWidth: topLineWidth, strokeLinejoin: "round", strokeDasharray: `${dashLength * 2} ${dashLength}`, opacity: style.opacity || 1, style: { clipPath: `url(#channel-clip-path-${sn})` } })] }));
25417
+ return (jsxRuntime.jsxs("g", { id: data.id.toString(), children: [jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: "#8498A9", strokeWidth: bottomLineWidth, strokeLinejoin: "round", opacity: style.opacity || 1, style: { clipPath: clipPathUrl } }), jsxRuntime.jsx("path", { d: pathData, fill: "none", stroke: "#FFFFFF", strokeWidth: topLineWidth, strokeLinejoin: "round", strokeDasharray: `${dashLength * 2} ${dashLength}`, opacity: style.opacity || 1, style: { clipPath: clipPathUrl } })] }));
25416
25418
  };
25417
25419
 
25418
25420
  /**
@@ -29768,6 +29770,22 @@ const SvgEditMap = React.forwardRef(({ mapConfig, onEditInfoMapChange, editMap }
29768
29770
  });
29769
29771
  SvgEditMap.displayName = 'SvgEditMap';
29770
29772
 
29773
+ /** 清理为合法的 SVG/HTML id 片段 */
29774
+ function sanitizeSvgIdPart(value) {
29775
+ return value.replace(/[^a-zA-Z0-9_.-]/g, '_');
29776
+ }
29777
+ /**
29778
+ * 通道 clipPath 的 SVG id
29779
+ * 组合 sn、useId、时间戳、随机数,避免同页多地图实例 id 冲突
29780
+ */
29781
+ function createChannelClipPathId(params) {
29782
+ const snPart = sanitizeSvgIdPart(params.sn || 'map');
29783
+ const reactPart = sanitizeSvgIdPart(params.reactId.replace(/:/g, ''));
29784
+ const timestamp = Date.now();
29785
+ const randomPart = Math.random().toString(36).slice(2, 10);
29786
+ return `channel-clip-path-${snPart}-${reactPart}-${timestamp}-${randomPart}`;
29787
+ }
29788
+
29771
29789
  var _path;
29772
29790
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
29773
29791
  var SvgMobileAddPoint = function SvgMobileAddPoint(props) {
@@ -29844,6 +29862,8 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
29844
29862
  ...INIT_EDIT_MAP_INFO,
29845
29863
  });
29846
29864
  const [mowingPartitions, setMowingPartitions] = React.useState([]);
29865
+ const reactInstanceId = React.useId();
29866
+ const channelClipPathId = React.useMemo(() => createChannelClipPathId({ sn, reactId: reactInstanceId }), [sn, reactInstanceId]);
29847
29867
  const minDistance = React.useMemo(() => {
29848
29868
  return getMinSvgDistanceByModel(modelType);
29849
29869
  }, [modelType]);
@@ -30078,6 +30098,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
30078
30098
  locale,
30079
30099
  signGoogleStaticMapUrl,
30080
30100
  onH5FirstSelectObstaclePoint,
30101
+ channelClipPathId,
30081
30102
  };
30082
30103
  }, [
30083
30104
  sn,
@@ -30104,6 +30125,7 @@ modelType, showStraddleBoundaryBorder = true, mapRef, mapJson, pathJson, realTim
30104
30125
  locale,
30105
30126
  signGoogleStaticMapUrl,
30106
30127
  onH5FirstSelectObstaclePoint,
30128
+ channelClipPathId,
30107
30129
  ]);
30108
30130
  /**
30109
30131
  * 这里做了一个配置,以防以后如果有多种不同的类型的情况,需要展示不同的元素
@@ -30448,7 +30470,9 @@ MowerMapRenderer.displayName = 'MowerMapRenderer';
30448
30470
 
30449
30471
  // 默认配置
30450
30472
  const defaultMapConfig = DEFAULT_STYLES;
30451
- const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn }) => {
30473
+ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth = 300, maxHeight, boundaryPadding = 50, mapConfig, sn, }) => {
30474
+ const reactInstanceId = React.useId();
30475
+ const channelClipPathId = React.useMemo(() => createChannelClipPathId({ sn, reactId: reactInstanceId }), [sn, reactInstanceId]);
30452
30476
  // 合并配置
30453
30477
  const mergedMapConfig = React.useMemo(() => {
30454
30478
  return merge$1(defaultMapConfig, mapConfig);
@@ -30508,8 +30532,9 @@ const BoundarySvgRender = React.memo(({ mapJson, unStructMapData, id, maxWidth =
30508
30532
  return {
30509
30533
  sn,
30510
30534
  svgViewBox: boundaryViewBox,
30535
+ channelClipPathId,
30511
30536
  };
30512
- }, [sn, boundaryViewBox]);
30537
+ }, [sn, boundaryViewBox, channelClipPathId]);
30513
30538
  const style = React.useMemo(() => {
30514
30539
  if (!maxHeight) {
30515
30540
  if (boundaryViewBox?.width > boundaryViewBox?.height) {
@@ -11,6 +11,6 @@ interface BoundarySvgRenderProps {
11
11
  mapConfig?: MapConfig;
12
12
  sn?: string;
13
13
  }
14
- declare const BoundarySvgRender: React.MemoExoticComponent<({ mapJson, unStructMapData, id, maxWidth, maxHeight, boundaryPadding, mapConfig, sn }: BoundarySvgRenderProps) => import("react/jsx-runtime").JSX.Element>;
14
+ declare const BoundarySvgRender: React.MemoExoticComponent<({ mapJson, unStructMapData, id, maxWidth, maxHeight, boundaryPadding, mapConfig, sn, }: BoundarySvgRenderProps) => import("react/jsx-runtime").JSX.Element>;
15
15
  export default BoundarySvgRender;
16
16
  //# sourceMappingURL=BoundarySvgRender.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BoundarySvgRender.d.ts","sourceRoot":"","sources":["../../src/render/BoundarySvgRender.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAK9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM3C,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAID,QAAA,MAAM,iBAAiB,oHAC8E,sBAAsB,6CA4I1H,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"BoundarySvgRender.d.ts","sourceRoot":"","sources":["../../src/render/BoundarySvgRender.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAK9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAO3C,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAID,QAAA,MAAM,iBAAiB,qHAUlB,sBAAsB,6CAkJ1B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MowerMapRenderer.d.ts","sourceRoot":"","sources":["../../src/render/MowerMapRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAwBf,OAAO,EAGL,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AA0B3B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,GAAG,CAAC;KACb;CACF;AAMD,eAAO,MAAM,gBAAgB,mGAy1B5B,CAAC;AAIF,eAAe,gBAAgB,CAAC;AAChC,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"MowerMapRenderer.d.ts","sourceRoot":"","sources":["../../src/render/MowerMapRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AAwBf,OAAO,EAGL,qBAAqB,EACrB,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AA2B3B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,GAAG,CAAC;KACb;CACF;AAMD,eAAO,MAAM,gBAAgB,mGA+1B5B,CAAC;AAIF,eAAe,gBAAgB,CAAC;AAChC,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 通道 clipPath 的 SVG id
3
+ * 组合 sn、useId、时间戳、随机数,避免同页多地图实例 id 冲突
4
+ */
5
+ export declare function createChannelClipPathId(params: {
6
+ sn?: string;
7
+ reactId: string;
8
+ }): string;
9
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/ChannelClipPath/constants.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAMxF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/ChannelElement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlD,UAAU,mBAAmB;IAC3B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,QAAA,MAAM,cAAc,GAAI,UAAU,mBAAmB,4CAqCpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/render/svgElement/ChannelElement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIlD,UAAU,mBAAmB;IAC3B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,QAAA,MAAM,cAAc,GAAI,UAAU,mBAAmB,4CAsCpD,CAAC;AAEF,eAAe,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleet-frontend/mower-maps",
3
- "version": "0.2.5-beta.30",
3
+ "version": "0.2.5-beta.31",
4
4
  "type": "module",
5
5
  "description": "a mower maps in google maps",
6
6
  "main": "dist/index.js",