@zero-library/common 2.3.2 → 2.3.4

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/dist/index.cjs.js CHANGED
@@ -488,7 +488,14 @@ var setInterval2 = (fn, t) => {
488
488
  };
489
489
  };
490
490
  var genNonDuplicateID = () => {
491
- return crypto.randomUUID();
491
+ if (crypto?.randomUUID) {
492
+ return crypto.randomUUID();
493
+ }
494
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
495
+ const r = Math.random() * 16 | 0;
496
+ const v = c === "x" ? r : r & 3 | 8;
497
+ return v.toString(16);
498
+ });
492
499
  };
493
500
  var copyText = async (text, prompt = "\u590D\u5236\u6210\u529F") => {
494
501
  try {
@@ -8589,7 +8596,6 @@ var MarkdownEditor_default = ({
8589
8596
  content: value,
8590
8597
  contentType: "markdown",
8591
8598
  onUpdate: () => {
8592
- console.log("update \u6587\u672C\u6539\u53D8");
8593
8599
  const markdownOutput = getMarkdown();
8594
8600
  if (markdownOutput === lastContentRef.current) return;
8595
8601
  lastContentRef.current = markdownOutput;
@@ -8733,7 +8739,7 @@ var styles_module_default7 = {
8733
8739
  rect: "styles_module_rect",
8734
8740
  score: "styles_module_score"
8735
8741
  };
8736
- var MarkDrawing_default = ({ children, detections, originalSize }) => {
8742
+ var MarkDrawing_default = ({ children, detections, originalSize, scopeRender }) => {
8737
8743
  const containerRef = React.useRef(null);
8738
8744
  const [containerSize, setContainerSize] = React.useState({
8739
8745
  width: originalSize.width,
@@ -8754,7 +8760,7 @@ var MarkDrawing_default = ({ children, detections, originalSize }) => {
8754
8760
  const scaleY = containerSize.height / originalSize.height;
8755
8761
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: styles_module_default7.container, children: [
8756
8762
  children,
8757
- detections.map((det, idx) => {
8763
+ detections?.map((det, idx) => {
8758
8764
  const [x1, y1, x2, y2] = det.bbox;
8759
8765
  const left = x1 * scaleX;
8760
8766
  const top = y1 * scaleY;
@@ -8781,7 +8787,7 @@ var MarkDrawing_default = ({ children, detections, originalSize }) => {
8781
8787
  left,
8782
8788
  top: Math.max(top - 20, 0)
8783
8789
  },
8784
- children: det.score.toFixed(3)
8790
+ children: scopeRender ? scopeRender(det.score) : det.score
8785
8791
  }
8786
8792
  )
8787
8793
  ] }, idx);